From 16f6a28b1ff2080f849eaedd2b09e07ab634ef28 Mon Sep 17 00:00:00 2001
From: Daniel Antrim <dantrim@lbl.gov>
Date: Tue, 1 Dec 2020 08:59:39 -0800
Subject: [PATCH 01/13] add format checking scripts and CI format_checkk stage

---
 .clang-format               | 156 ++++++++++++++
 .gitlab-ci.yml              |  16 +-
 CPPLINT.cfg                 |  14 ++
 bash/check_format.sh        | 124 +++++++++++
 Dockerfile => ci/Dockerfile |   0
 ci/run-clang-format.py      | 404 ++++++++++++++++++++++++++++++++++++
 6 files changed, 710 insertions(+), 4 deletions(-)
 create mode 100644 .clang-format
 create mode 100644 CPPLINT.cfg
 create mode 100644 bash/check_format.sh
 rename Dockerfile => ci/Dockerfile (100%)
 create mode 100755 ci/run-clang-format.py

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..4352550b
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,156 @@
+---
+Language:        Cpp
+# BasedOnStyle:  Google
+AccessModifierOffset: -4
+AlignAfterOpenBracket: Align
+AlignConsecutiveMacros: false
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Left
+AlignOperands:   true
+AlignTrailingComments: true
+AllowAllArgumentsOnNextLine: true
+AllowAllConstructorInitializersOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortLambdasOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: WithoutElse
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: Yes
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterCaseLabel:  false
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: false
+  AfterStruct:     false
+  AfterUnion:      false
+  AfterExternBlock: false
+  BeforeCatch:     false
+  BeforeElse:      false
+  IndentBraces:    false
+  SplitEmptyFunction: true
+  SplitEmptyRecord: true
+  SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit:     80
+CommentPragmas:  '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: true
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:
+  - foreach
+  - Q_FOREACH
+  - BOOST_FOREACH
+IncludeBlocks:   Regroup
+IncludeCategories:
+  - Regex:           '^<ext/.*\.h>'
+    Priority:        2
+  - Regex:           '^<.*\.h>'
+    Priority:        1
+  - Regex:           '^<.*'
+    Priority:        2
+  - Regex:           '.*'
+    Priority:        3
+IncludeIsMainRegex: '([-_](test|unittest))?$'
+IndentCaseLabels: true
+IndentPPDirectives: None
+IndentWidth:     4
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Never
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 1
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+PointerAlignment: Left
+RawStringFormats:
+  - Language:        Cpp
+    Delimiters:
+      - cc
+      - CC
+      - cpp
+      - Cpp
+      - CPP
+      - 'c++'
+      - 'C++'
+    CanonicalDelimiter: ''
+    BasedOnStyle:    google
+  - Language:        TextProto
+    Delimiters:
+      - pb
+      - PB
+      - proto
+      - PROTO
+    EnclosingFunctions:
+      - EqualsProto
+      - EquivToProto
+      - PARSE_PARTIAL_TEXT_PROTO
+      - PARSE_TEST_PROTO
+      - PARSE_TEXT_PROTO
+      - ParseTextOrDie
+      - ParseTextProtoOrDie
+    CanonicalDelimiter: ''
+    BasedOnStyle:    google
+ReflowComments:  true
+SortIncludes:    true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 2
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Auto
+StatementMacros:
+  - Q_UNUSED
+  - QT_REQUIRE_VERSION
+TabWidth:        8
+UseTab:          Never
+...
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fe0ddfcd..560cb0e5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,5 @@
 stages:
+  - format_check
   - build
   - package
   - deploy
@@ -18,6 +19,17 @@ variables:
                      cmake3
                      json-devel
                      libusb-devel
+                     python3-devel
+    - python3 -m pip install --upgrade --no-cache-dir pip setuptools wheel
+
+format_check:
+    extends: .base
+    stage: format_check
+    script:
+      - python3 -m pip install cpplint
+      - python3 -m pip install clang-format
+      - echo " *** Checking format ***"
+      - source bash/check_format.sh
 
 build-bare:
   extends: .base
@@ -28,14 +40,12 @@ build-bare:
     - cmake3 ..
     - make
 
-
 build-bare-python:
   extends: .base
   stage: build
   variables:
     GIT_SUBMODULE_STRATEGY: recursive
   script:
-    - yum -y install python3-devel
     - mkdir build
     - cd build
     - cmake3 -DUSE_PYTHON=on ..
@@ -51,7 +61,6 @@ build-pip-install:
   variables:
     GIT_SUBMODULE_STRATEGY: recursive
   script:
-    - yum -y install python3-devel
     - python3 -m venv myenv
     - source myenv/bin/activate
     - pip install -U pip
@@ -64,7 +73,6 @@ build-pip-install:
     - python3 -c "import labRemote.ec"
     - python3 -c "from labRemote.com import GPIBSerialCom"
 
-
 build:
   extends: .base
   stage: build
diff --git a/CPPLINT.cfg b/CPPLINT.cfg
new file mode 100644
index 00000000..e4007f7d
--- /dev/null
+++ b/CPPLINT.cfg
@@ -0,0 +1,14 @@
+set noparent
+linelength = 80
+filter=-legal/copyright
+filter=-build/header_guard
+filter=-build/include_what_you_use
+filter=-runtime/int
+filter=-runtime/explicit
+filter=-runtime/references
+filter=-whitespace/comments
+filter=-build/include_order
+filter=-build/include_subdir
+filter=-build/c++11
+filter=-runtime/printf
+filter=-build/namespaces
diff --git a/bash/check_format.sh b/bash/check_format.sh
new file mode 100644
index 00000000..7e51cfad
--- /dev/null
+++ b/bash/check_format.sh
@@ -0,0 +1,124 @@
+#!/bin/bash
+
+############################################################
+#
+# A script to check the formatting of the labRemote source
+# code, according to clang-format and CPPLINT rules.
+#
+# author: Daniel Joseph Antrim
+# author-email: daniel.joseph.antrim AT cern.ch
+# date: December 2020
+#
+############################################################
+
+RESET="\033[0m"
+RED="\033[1m\033[31m"
+BLUE="\033[1m\033[34m"
+YELLOW="\033[1m\033[33m"
+GREEN="\033[1m\033[32m"
+
+function print_usage {
+
+    printf " Usage: source /path/to/check_format.sh [OPTIONS]\n"
+    printf "\n"
+    printf " Options:\n"
+    printf "     -a|--apply     apply the suggested format fixes in place (WARNING: overwrites existing files)\n"
+    printf "     -h|--help      show this help message\n"
+    printf "\n"
+    printf " Notes:\n"
+    printf "      Providing the -a (--apply) command line option performs an IN-PLACE\n"
+    printf "      application of the fixes that are suggested when you run this\n"
+    printf "      script without providing any command line options. That means\n"
+    printf "      the files will be over-written. Be sure to back-up with git beforehand\n"
+    printf "      if you are worried about any issues.\n"
+}
+
+function check_files {
+
+    apply_format_fix=${1}
+    if [[ "${apply_format_fix}" == "1" ]]; then
+        printf "${YELLOW} -- check_format: Applying formatting fixes to files that fail formatting check!${RESET}\n"
+    fi
+
+    dirs_to_exclude="exts configs"
+
+    format_status="0"
+    extensions=".cpp .h"
+    for extension in ${extensions};
+    do
+        printf "${BLUE} -- check_format: Checking *${extension} files %s${RESET}\n"
+        for labremote_subdirectory in ./src/*; do
+            subdirectory_name=$(basename ${labremote_subdirectory})
+            if $(echo ${dirs_to_exclude} |grep -w -q ${subdirectory_name}); then
+                continue
+            fi
+            files=$(find ${labremote_subdirectory} -name *${extension})
+            for fname in ${files};
+            do    
+                printf "${BLUE} -- check_format: > file: ${fname}${RESET}\n"
+                $(cpplint --quiet ${fname} > /dev/null)
+                if [[ "$?" == "1" ]]; then
+                    printf "${RED} -- check_format: FORMAT FAILURE: File ${fname} fails formatting check${RESET}\n"
+                    ./ci/run-clang-format.py ${fname}
+                    if [[ "${apply_format_fix}" == "1" ]]; then
+                        printf "${YELLOW} -- check_format: Applying format fixes to ${fname}...${RESET}\n"
+                        clang-format -i ${fname}
+                    fi
+                    format_status="1"
+                fi
+            done # fname
+        done # labremote_subdirectory
+    done # extension
+    if [ ! ${format_status} -eq "0" ];
+    then
+        return 1
+    else
+        return 0
+    fi
+}
+
+function main {
+
+    apply_format_fix=0
+    while test $# -gt 0
+    do
+        case $1 in
+            -h)
+                print_usage
+                return 0
+                ;;
+            --help)
+                print_usage
+                return 0
+                ;;
+            -d)
+            -a)
+                apply_format_fix=1
+                ;;
+            --apply)
+                apply_format_fix=1
+                ;;
+            *)
+                printf "${RED} check_format: Invalid argument provided: $1\n ${RESET}"
+                return 1
+        esac
+        shift
+    done
+                
+    format_ok=0
+    if ! check_files ${apply_format_fix}; then
+        format_ok=1
+    fi
+    if [[ "${format_ok}" == "1" ]]; then
+        printf "${RED} -- check_format: RESULT: FORMATTING FAILED${RESET}\n"
+        return 1
+    else
+        printf "${GREEN} -- check_format: RESULT: FORMATTING SUCCESS${RESET}\n"
+        return 0
+    fi
+}
+
+#______________
+main $*
+
+
diff --git a/Dockerfile b/ci/Dockerfile
similarity index 100%
rename from Dockerfile
rename to ci/Dockerfile
diff --git a/ci/run-clang-format.py b/ci/run-clang-format.py
new file mode 100755
index 00000000..bd753b3d
--- /dev/null
+++ b/ci/run-clang-format.py
@@ -0,0 +1,404 @@
+#!/usr/bin/env python
+"""A wrapper script around clang-format, suitable for linting multiple files
+and to use for continuous integration.
+
+This is an alternative API for the clang-format command line.
+It runs over multiple files and directories in parallel.
+A diff output is produced and a sensible exit code is returned.
+
+Taken from: https://github.com/Sarcasm/run-clang-format
+
+"""
+
+from __future__ import print_function, unicode_literals
+
+import argparse
+import codecs
+import difflib
+import fnmatch
+import io
+import errno
+import multiprocessing
+import os
+import signal
+import subprocess
+import sys
+import traceback
+
+from functools import partial
+
+try:
+    from subprocess import DEVNULL  # py3k
+except ImportError:
+    DEVNULL = open(os.devnull, "wb")
+
+
+DEFAULT_EXTENSIONS = 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'
+DEFAULT_CLANG_FORMAT_IGNORE = '.clang-format-ignore'
+
+
+class ExitStatus:
+    SUCCESS = 0
+    DIFF = 1
+    TROUBLE = 2
+
+def excludes_from_file(ignore_file):
+    excludes = []
+    try:
+        with io.open(ignore_file, 'r', encoding='utf-8') as f:
+            for line in f:
+                if line.startswith('#'):
+                    # ignore comments
+                    continue
+                pattern = line.rstrip()
+                if not pattern:
+                    # allow empty lines
+                    continue
+                excludes.append(pattern)
+    except EnvironmentError as e:
+        if e.errno != errno.ENOENT:
+            raise
+    return excludes;
+
+def list_files(files, recursive=False, extensions=None, exclude=None):
+    if extensions is None:
+        extensions = []
+    if exclude is None:
+        exclude = []
+
+    out = []
+    for file in files:
+        if recursive and os.path.isdir(file):
+            for dirpath, dnames, fnames in os.walk(file):
+                fpaths = [os.path.join(dirpath, fname) for fname in fnames]
+                for pattern in exclude:
+                    # os.walk() supports trimming down the dnames list
+                    # by modifying it in-place,
+                    # to avoid unnecessary directory listings.
+                    dnames[:] = [
+                        x for x in dnames
+                        if
+                        not fnmatch.fnmatch(os.path.join(dirpath, x), pattern)
+                    ]
+                    fpaths = [
+                        x for x in fpaths if not fnmatch.fnmatch(x, pattern)
+                    ]
+                for f in fpaths:
+                    ext = os.path.splitext(f)[1][1:]
+                    if ext in extensions:
+                        out.append(f)
+        else:
+            out.append(file)
+    return out
+
+
+def make_diff(file, original, reformatted):
+    return list(
+        difflib.unified_diff(
+            original,
+            reformatted,
+            fromfile='{}\t(original)'.format(file),
+            tofile='{}\t(reformatted)'.format(file),
+            n=3))
+
+
+class DiffError(Exception):
+    def __init__(self, message, errs=None):
+        super(DiffError, self).__init__(message)
+        self.errs = errs or []
+
+
+class UnexpectedError(Exception):
+    def __init__(self, message, exc=None):
+        super(UnexpectedError, self).__init__(message)
+        self.formatted_traceback = traceback.format_exc()
+        self.exc = exc
+
+
+def run_clang_format_diff_wrapper(args, file):
+    try:
+        ret = run_clang_format_diff(args, file)
+        return ret
+    except DiffError:
+        raise
+    except Exception as e:
+        raise UnexpectedError('{}: {}: {}'.format(file, e.__class__.__name__,
+                                                  e), e)
+
+
+def run_clang_format_diff(args, file):
+    try:
+        with io.open(file, 'r', encoding='utf-8') as f:
+            original = f.readlines()
+    except IOError as exc:
+        raise DiffError(str(exc))
+    
+    if args.in_place:
+        invocation = [args.clang_format_executable, '-i', file]
+    else:
+        invocation = [args.clang_format_executable, file]
+
+    if args.dry_run:
+        print(" ".join(invocation))
+        return [], []
+
+    # Use of utf-8 to decode the process output.
+    #
+    # Hopefully, this is the correct thing to do.
+    #
+    # It's done due to the following assumptions (which may be incorrect):
+    # - clang-format will returns the bytes read from the files as-is,
+    #   without conversion, and it is already assumed that the files use utf-8.
+    # - if the diagnostics were internationalized, they would use utf-8:
+    #   > Adding Translations to Clang
+    #   >
+    #   > Not possible yet!
+    #   > Diagnostic strings should be written in UTF-8,
+    #   > the client can translate to the relevant code page if needed.
+    #   > Each translation completely replaces the format string
+    #   > for the diagnostic.
+    #   > -- http://clang.llvm.org/docs/InternalsManual.html#internals-diag-translation
+    #
+    # It's not pretty, due to Python 2 & 3 compatibility.
+    encoding_py3 = {}
+    if sys.version_info[0] >= 3:
+        encoding_py3['encoding'] = 'utf-8'
+
+    try:
+        proc = subprocess.Popen(
+            invocation,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+            universal_newlines=True,
+            **encoding_py3)
+    except OSError as exc:
+        raise DiffError(
+            "Command '{}' failed to start: {}".format(
+                subprocess.list2cmdline(invocation), exc
+            )
+        )
+    proc_stdout = proc.stdout
+    proc_stderr = proc.stderr
+    if sys.version_info[0] < 3:
+        # make the pipes compatible with Python 3,
+        # reading lines should output unicode
+        encoding = 'utf-8'
+        proc_stdout = codecs.getreader(encoding)(proc_stdout)
+        proc_stderr = codecs.getreader(encoding)(proc_stderr)
+    # hopefully the stderr pipe won't get full and block the process
+    outs = list(proc_stdout.readlines())
+    errs = list(proc_stderr.readlines())
+    proc.wait()
+    if proc.returncode:
+        raise DiffError(
+            "Command '{}' returned non-zero exit status {}".format(
+                subprocess.list2cmdline(invocation), proc.returncode
+            ),
+            errs,
+        )
+    if args.in_place:
+        return [], errs
+    return make_diff(file, original, outs), errs
+
+
+def bold_red(s):
+    return '\x1b[1m\x1b[31m' + s + '\x1b[0m'
+
+
+def colorize(diff_lines):
+    def bold(s):
+        return '\x1b[1m' + s + '\x1b[0m'
+
+    def cyan(s):
+        return '\x1b[36m' + s + '\x1b[0m'
+
+    def green(s):
+        return '\x1b[32m' + s + '\x1b[0m'
+
+    def red(s):
+        return '\x1b[31m' + s + '\x1b[0m'
+
+    for line in diff_lines:
+        if line[:4] in ['--- ', '+++ ']:
+            yield bold(line)
+        elif line.startswith('@@ '):
+            yield cyan(line)
+        elif line.startswith('+'):
+            yield green(line)
+        elif line.startswith('-'):
+            yield red(line)
+        else:
+            yield line
+
+
+def print_diff(diff_lines, use_color):
+    if use_color:
+        diff_lines = colorize(diff_lines)
+    if sys.version_info[0] < 3:
+        sys.stdout.writelines((l.encode('utf-8') for l in diff_lines))
+    else:
+        sys.stdout.writelines(diff_lines)
+
+
+def print_trouble(prog, message, use_colors):
+    error_text = 'error:'
+    if use_colors:
+        error_text = bold_red(error_text)
+    print("{}: {} {}".format(prog, error_text, message), file=sys.stderr)
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument(
+        '--clang-format-executable',
+        metavar='EXECUTABLE',
+        help='path to the clang-format executable',
+        default='clang-format')
+    parser.add_argument(
+        '--extensions',
+        help='comma separated list of file extensions (default: {})'.format(
+            DEFAULT_EXTENSIONS),
+        default=DEFAULT_EXTENSIONS)
+    parser.add_argument(
+        '-r',
+        '--recursive',
+        action='store_true',
+        help='run recursively over directories')
+    parser.add_argument(
+        '-d',
+        '--dry-run',
+        action='store_true',
+        help='just print the list of files')
+    parser.add_argument(
+        '-i',
+        '--in-place',
+        action='store_true',
+        help='format file instead of printing differences')
+    parser.add_argument('files', metavar='file', nargs='+')
+    parser.add_argument(
+        '-q',
+        '--quiet',
+        action='store_true',
+        help="disable output, useful for the exit code")
+    parser.add_argument(
+        '-j',
+        metavar='N',
+        type=int,
+        default=0,
+        help='run N clang-format jobs in parallel'
+        ' (default number of cpus + 1)')
+    parser.add_argument(
+        '--color',
+        default='auto',
+        choices=['auto', 'always', 'never'],
+        help='show colored diff (default: auto)')
+    parser.add_argument(
+        '-e',
+        '--exclude',
+        metavar='PATTERN',
+        action='append',
+        default=[],
+        help='exclude paths matching the given glob-like pattern(s)'
+        ' from recursive search')
+
+    args = parser.parse_args()
+
+    # use default signal handling, like diff return SIGINT value on ^C
+    # https://bugs.python.org/issue14229#msg156446
+    signal.signal(signal.SIGINT, signal.SIG_DFL)
+    try:
+        signal.SIGPIPE
+    except AttributeError:
+        # compatibility, SIGPIPE does not exist on Windows
+        pass
+    else:
+        signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+    colored_stdout = False
+    colored_stderr = False
+    if args.color == 'always':
+        colored_stdout = True
+        colored_stderr = True
+    elif args.color == 'auto':
+        colored_stdout = sys.stdout.isatty()
+        colored_stderr = sys.stderr.isatty()
+
+    version_invocation = [args.clang_format_executable, str("--version")]
+    try:
+        subprocess.check_call(version_invocation, stdout=DEVNULL)
+    except subprocess.CalledProcessError as e:
+        print_trouble(parser.prog, str(e), use_colors=colored_stderr)
+        return ExitStatus.TROUBLE
+    except OSError as e:
+        print_trouble(
+            parser.prog,
+            "Command '{}' failed to start: {}".format(
+                subprocess.list2cmdline(version_invocation), e
+            ),
+            use_colors=colored_stderr,
+        )
+        return ExitStatus.TROUBLE
+
+    retcode = ExitStatus.SUCCESS
+
+    excludes = excludes_from_file(DEFAULT_CLANG_FORMAT_IGNORE)
+    excludes.extend(args.exclude)
+
+    files = list_files(
+        args.files,
+        recursive=args.recursive,
+        exclude=excludes,
+        extensions=args.extensions.split(','))
+
+    if not files:
+        return
+
+    njobs = args.j
+    if njobs == 0:
+        njobs = multiprocessing.cpu_count() + 1
+    njobs = min(len(files), njobs)
+
+    if njobs == 1:
+        # execute directly instead of in a pool,
+        # less overhead, simpler stacktraces
+        it = (run_clang_format_diff_wrapper(args, file) for file in files)
+        pool = None
+    else:
+        pool = multiprocessing.Pool(njobs)
+        it = pool.imap_unordered(
+            partial(run_clang_format_diff_wrapper, args), files)
+        pool.close()
+    while True:
+        try:
+            outs, errs = next(it)
+        except StopIteration:
+            break
+        except DiffError as e:
+            print_trouble(parser.prog, str(e), use_colors=colored_stderr)
+            retcode = ExitStatus.TROUBLE
+            sys.stderr.writelines(e.errs)
+        except UnexpectedError as e:
+            print_trouble(parser.prog, str(e), use_colors=colored_stderr)
+            sys.stderr.write(e.formatted_traceback)
+            retcode = ExitStatus.TROUBLE
+            # stop at the first unexpected error,
+            # something could be very wrong,
+            # don't process all files unnecessarily
+            if pool:
+                pool.terminate()
+            break
+        else:
+            sys.stderr.writelines(errs)
+            if outs == []:
+                continue
+            if not args.quiet:
+                print_diff(outs, use_color=colored_stdout)
+            if retcode == ExitStatus.SUCCESS:
+                retcode = ExitStatus.DIFF
+    if pool:
+        pool.join()
+    return retcode
+
+
+if __name__ == '__main__':
+    sys.exit(main())
-- 
GitLab


From 1038cc6862b036cce5115656e3b060f7f373032c Mon Sep 17 00:00:00 2001
From: Daniel Antrim <dantrim@lbl.gov>
Date: Tue, 1 Dec 2020 09:23:29 -0800
Subject: [PATCH 02/13] fix check_format script

---
 .gitlab-ci.yml       |  2 +-
 bash/check_format.sh | 25 +++++++++++++++++++++----
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 560cb0e5..f431680a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,7 +29,7 @@ format_check:
       - python3 -m pip install cpplint
       - python3 -m pip install clang-format
       - echo " *** Checking format ***"
-      - source bash/check_format.sh
+      - source bash/check_format.sh --verbose
 
 build-bare:
   extends: .base
diff --git a/bash/check_format.sh b/bash/check_format.sh
index 7e51cfad..15a36822 100644
--- a/bash/check_format.sh
+++ b/bash/check_format.sh
@@ -22,6 +22,7 @@ function print_usage {
     printf " Usage: source /path/to/check_format.sh [OPTIONS]\n"
     printf "\n"
     printf " Options:\n"
+    printf "     -v|--verbose   print-out all cpplint and clang-format output"
     printf "     -a|--apply     apply the suggested format fixes in place (WARNING: overwrites existing files)\n"
     printf "     -h|--help      show this help message\n"
     printf "\n"
@@ -36,6 +37,7 @@ function print_usage {
 function check_files {
 
     apply_format_fix=${1}
+    verbose=${2}
     if [[ "${apply_format_fix}" == "1" ]]; then
         printf "${YELLOW} -- check_format: Applying formatting fixes to files that fail formatting check!${RESET}\n"
     fi
@@ -56,10 +58,19 @@ function check_files {
             for fname in ${files};
             do    
                 printf "${BLUE} -- check_format: > file: ${fname}${RESET}\n"
-                $(cpplint --quiet ${fname} > /dev/null)
+                cmd="cpplint ${fname}"
+                if [[ "${verbose}" == "0" ]]; then
+                    $cmd 2> /dev/null
+                else
+                    $cmd
+                fi
                 if [[ "$?" == "1" ]]; then
                     printf "${RED} -- check_format: FORMAT FAILURE: File ${fname} fails formatting check${RESET}\n"
-                    ./ci/run-clang-format.py ${fname}
+                    cmd="./ci/run-clang-format.py ${fname}"
+                    if [[ "${verbose}" == "0" ]]; then
+                        cmd="${cmd} --quiet"
+                    fi
+                    $cmd
                     if [[ "${apply_format_fix}" == "1" ]]; then
                         printf "${YELLOW} -- check_format: Applying format fixes to ${fname}...${RESET}\n"
                         clang-format -i ${fname}
@@ -80,6 +91,7 @@ function check_files {
 function main {
 
     apply_format_fix=0
+    verbose=0
     while test $# -gt 0
     do
         case $1 in
@@ -91,13 +103,18 @@ function main {
                 print_usage
                 return 0
                 ;;
-            -d)
             -a)
                 apply_format_fix=1
                 ;;
             --apply)
                 apply_format_fix=1
                 ;;
+            -v)
+                verbose=1
+                ;;
+            --verbose)
+                verbose=1
+                ;;
             *)
                 printf "${RED} check_format: Invalid argument provided: $1\n ${RESET}"
                 return 1
@@ -106,7 +123,7 @@ function main {
     done
                 
     format_ok=0
-    if ! check_files ${apply_format_fix}; then
+    if ! check_files ${apply_format_fix} ${verbose}; then
         format_ok=1
     fi
     if [[ "${format_ok}" == "1" ]]; then
-- 
GitLab


From 18ef894dc1d8cc706dcfbc71587618bfd0bb1fb7 Mon Sep 17 00:00:00 2001
From: Daniel Antrim <dantrim@lbl.gov>
Date: Tue, 1 Dec 2020 09:35:15 -0800
Subject: [PATCH 03/13] clang-format access modifier indent +1 as per google
 style and cpplint

---
 .clang-format | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.clang-format b/.clang-format
index 4352550b..a2a03fab 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,7 +1,7 @@
 ---
 Language:        Cpp
 # BasedOnStyle:  Google
-AccessModifierOffset: -4
+AccessModifierOffset: -3
 AlignAfterOpenBracket: Align
 AlignConsecutiveMacros: false
 AlignConsecutiveAssignments: false
-- 
GitLab


From db353cc4b5a0ac75ca1b486da9e593d4e788e2ac Mon Sep 17 00:00:00 2001
From: Daniel Antrim <dantrim@lbl.gov>
Date: Tue, 1 Dec 2020 10:54:20 -0800
Subject: [PATCH 04/13] apply format check fixes

---
 .clang-format                                 |    2 +-
 .gitlab-ci.yml                                |    2 +-
 CPPLINT.cfg                                   |    6 +
 bash/check_format.sh                          |    2 +-
 src/examples/chiller_example.cpp              |  218 +-
 src/examples/control_powersupply_example.cpp  |  195 +-
 src/examples/datasink_example.cpp             |  173 +-
 src/examples/devcomuino_example.cpp           |  156 +-
 src/examples/fluke_test.cpp                   |   24 +-
 src/examples/ntc_example.cpp                  |  242 +-
 src/examples/pixel_scope_run.cpp              |   87 +-
 src/examples/scope_test.cpp                   |   77 +-
 src/examples/sht85_test.cpp                   |   47 +-
 src/labRemote/module.cpp                      |    4 +-
 src/libChiller/IChiller.cpp                   |   17 +-
 src/libChiller/IChiller.h                     |   86 +-
 src/libChiller/PolySciLM.cpp                  |  109 +-
 src/libChiller/PolySciLM.h                    |  105 +-
 src/libChiller/python.cpp                     |  117 +-
 src/libCom/CharDeviceCom.cpp                  |  159 +-
 src/libCom/CharDeviceCom.h                    |  264 +--
 src/libCom/ComRegistry.cpp                    |   35 +-
 src/libCom/ComRegistry.h                      |   37 +-
 src/libCom/GPIBNICom.cpp                      |  247 +-
 src/libCom/GPIBNICom.h                        |  268 +--
 src/libCom/GPIBSerialCom.cpp                  |   98 +-
 src/libCom/GPIBSerialCom.h                    |  156 +-
 src/libCom/ICom.h                             |  209 +-
 src/libCom/SerialCom.cpp                      |  432 ++--
 src/libCom/SerialCom.h                        |  423 ++--
 src/libCom/TextSerialCom.cpp                  |  134 +-
 src/libCom/TextSerialCom.h                    |  144 +-
 src/libCom/python.cpp                         |  397 +---
 src/libDataSink/CSVSink.cpp                   |  416 ++--
 src/libDataSink/CSVSink.h                     |  277 +--
 src/libDataSink/CombinedSink.cpp              |  131 +-
 src/libDataSink/CombinedSink.h                |   91 +-
 src/libDataSink/ConsoleSink.cpp               |  273 +--
 src/libDataSink/ConsoleSink.h                 |  241 +-
 src/libDataSink/DataSinkRegistry.cpp          |   38 +-
 src/libDataSink/DataSinkRegistry.h            |   42 +-
 src/libDataSink/IDataSink.cpp                 |    9 +-
 src/libDataSink/IDataSink.h                   |  335 +--
 src/libDataSink/InfluxDBSink.cpp              |  260 +--
 src/libDataSink/InfluxDBSink.h                |  236 +-
 src/libDataSink/python.cpp                    |  393 +---
 src/libDevCom/AD56X9.cpp                      |   74 +-
 src/libDevCom/AD56X9.h                        |   60 +-
 src/libDevCom/AD799X.cpp                      |  152 +-
 src/libDevCom/AD799X.h                        |   55 +-
 src/libDevCom/ADCDevComuino.cpp               |   49 +-
 src/libDevCom/ADCDevComuino.h                 |   73 +-
 src/libDevCom/ADCDevice.cpp                   |   48 +-
 src/libDevCom/ADCDevice.h                     |  179 +-
 src/libDevCom/AMAC.cpp                        |  764 +++---
 src/libDevCom/AMAC.h                          |  428 ++--
 src/libDevCom/ChecksumException.cpp           |   17 +-
 src/libDevCom/ChecksumException.h             |   15 +-
 src/libDevCom/ClimateSensor.cpp               |   17 +-
 src/libDevCom/ClimateSensor.h                 |   96 +-
 src/libDevCom/ComIOException.h                |   15 +-
 src/libDevCom/DAC5571.cpp                     |   52 +-
 src/libDevCom/DAC5571.h                       |   31 +-
 src/libDevCom/DAC5574.cpp                     |   90 +-
 src/libDevCom/DAC5574.h                       |   31 +-
 src/libDevCom/DACDevice.cpp                   |   77 +-
 src/libDevCom/DACDevice.h                     |  253 +-
 src/libDevCom/DeviceCalibration.h             |   39 +-
 src/libDevCom/DeviceCom.h                     |   69 +-
 src/libDevCom/DummyCalibration.h              |   11 +-
 src/libDevCom/FT232H.cpp                      |   11 +-
 src/libDevCom/FT232H.h                        |   21 +-
 src/libDevCom/FileCalibration.cpp             |   58 +-
 src/libDevCom/FileCalibration.h               |   31 +-
 src/libDevCom/HIH4000.cpp                     |   64 +-
 src/libDevCom/HIH4000.h                       |   64 +-
 src/libDevCom/HIH6130.cpp                     |   54 +-
 src/libDevCom/HIH6130.h                       |   39 +-
 src/libDevCom/I2CCom.cpp                      |   13 +-
 src/libDevCom/I2CCom.h                        |   23 +-
 src/libDevCom/I2CDevCom.cpp                   |  551 +++--
 src/libDevCom/I2CDevCom.h                     |   74 +-
 src/libDevCom/I2CDevComuino.cpp               |  213 +-
 src/libDevCom/I2CDevComuino.h                 |   90 +-
 src/libDevCom/I2CFTDICom.cpp                  |  389 ++--
 src/libDevCom/I2CFTDICom.h                    |   72 +-
 src/libDevCom/IOExpander.cpp                  |   38 +-
 src/libDevCom/IOExpander.h                    |   34 +-
 src/libDevCom/LTC2451.cpp                     |   75 +-
 src/libDevCom/LTC2451.h                       |   51 +-
 src/libDevCom/LinearCalibration.cpp           |   16 +-
 src/libDevCom/LinearCalibration.h             |   39 +-
 src/libDevCom/MAX11619.cpp                    |   48 +-
 src/libDevCom/MAX11619.h                      |   26 +-
 src/libDevCom/MCP23008.cpp                    |   29 +-
 src/libDevCom/MCP23008.h                      |   45 +-
 src/libDevCom/MCP23017.cpp                    |   43 +-
 src/libDevCom/MCP23017.h                      |   65 +-
 src/libDevCom/MCP3425.cpp                     |  209 +-
 src/libDevCom/MCP3425.h                       |   67 +-
 src/libDevCom/MCP3428.cpp                     |  216 +-
 src/libDevCom/MCP3428.h                       |   83 +-
 src/libDevCom/MCP4801.cpp                     |   56 +-
 src/libDevCom/MCP4801.h                       |   31 +-
 src/libDevCom/MPSSEChip.cpp                   |  215 +-
 src/libDevCom/MPSSEChip.h                     |  324 +--
 src/libDevCom/MuxDevice.h                     |   21 +-
 src/libDevCom/NTCSensor.cpp                   |   66 +-
 src/libDevCom/NTCSensor.h                     |  103 +-
 src/libDevCom/NotSupportedException.h         |   15 +-
 src/libDevCom/OutOfRangeException.cpp         |   14 +-
 src/libDevCom/OutOfRangeException.h           |   22 +-
 src/libDevCom/PCA9548ACom.cpp                 |  448 ++--
 src/libDevCom/PCA9548ACom.h                   |   79 +-
 src/libDevCom/PGA11x.cpp                      |    9 +-
 src/libDevCom/PGA11x.h                        |   17 +-
 src/libDevCom/PtSensor.cpp                    |   72 +-
 src/libDevCom/PtSensor.h                      |  106 +-
 src/libDevCom/SHT85.cpp                       |   99 +-
 src/libDevCom/SHT85.h                         |   41 +-
 src/libDevCom/SPICom.h                        |   15 +-
 src/libDevCom/SPIDevCom.cpp                   |  180 +-
 src/libDevCom/SPIDevCom.h                     |   80 +-
 src/libDevCom/Si7021.cpp                      |  107 +-
 src/libDevCom/Si7021.h                        |   48 +-
 src/libDevCom/UIOCom.cpp                      |  111 +-
 src/libDevCom/UIOCom.h                        |   79 +-
 src/libDevCom/examples/Si7021_example.cpp     |   43 +-
 src/libDevCom/examples/ftdi_adc_example.cpp   |   41 +-
 src/libDevCom/examples/temp_hum_monitor.cpp   |  247 +-
 src/libDevCom/examples/tempsensor_monitor.cpp |   61 +-
 src/libDevCom/examples/uio.cpp                |  129 +-
 src/libDevCom/python.cpp                      |  617 ++---
 src/libEquipConf/DataSinkConf.cpp             |  188 +-
 src/libEquipConf/DataSinkConf.h               |  208 +-
 src/libEquipConf/EquipConf.cpp                |  225 +-
 src/libEquipConf/EquipConf.h                  |  201 +-
 src/libEquipConf/python.cpp                   |   55 +-
 src/libGalil/arrays.cpp                       |  712 +++---
 src/libGalil/gclib.h                          | 1170 ++++++----
 src/libGalil/gclib_errors.h                   |  130 +-
 src/libGalil/gclib_record.h                   | 2061 +++++++++--------
 src/libGalil/gclibo.cpp                       |  654 +++---
 src/libGalil/gclibo.h                         |  702 +++---
 src/libImageRec/OpenCVHelper.cpp              |  149 +-
 src/libImageRec/OpenCVHelper.h                |    3 +-
 src/libLoad/Bk85xx.cpp                        |   69 +-
 src/libLoad/Bk85xx.h                          |   58 +-
 src/libLoad/GenericLoad.h                     |   14 +-
 src/libLoad/TTILD400P.cpp                     |  129 +-
 src/libLoad/TTILD400P.h                       |   68 +-
 src/libMeter/Fluke8842.cpp                    |   36 +-
 src/libMeter/Fluke8842.h                      |   37 +-
 src/libMeter/HP3478A.cpp                      |  151 +-
 src/libMeter/HP3478A.h                        |   39 +-
 src/libMeter/Keithley2000.cpp                 |   37 +-
 src/libMeter/Keithley2000.h                   |   35 +-
 src/libMeter/PM6680.cpp                       |   20 +-
 src/libMeter/PM6680.h                         |   38 +-
 src/libPS/AgilentE36300APs.h                  |   14 +-
 src/libPS/AgilentE3631APs.cpp                 |   17 +-
 src/libPS/AgilentE3631APs.h                   |   42 +-
 src/libPS/AgilentE3634APs.h                   |   14 +-
 src/libPS/AgilentE364xAPs.h                   |   18 +-
 src/libPS/AgilentPs.cpp                       |   14 +-
 src/libPS/AgilentPs.h                         |   41 +-
 src/libPS/Bk16XXPs.cpp                        |  267 ++-
 src/libPS/Bk16XXPs.h                          |  128 +-
 src/libPS/DT54xxPs.cpp                        |  231 +-
 src/libPS/DT54xxPs.h                          |  229 +-
 src/libPS/IPowerSupply.cpp                    |   90 +-
 src/libPS/IPowerSupply.h                      |  339 ++-
 src/libPS/Keithley22XX.cpp                    |  191 +-
 src/libPS/Keithley22XX.h                      |   80 +-
 src/libPS/Keithley24XX.cpp                    |  169 +-
 src/libPS/Keithley24XX.h                      |  139 +-
 src/libPS/PowerSupplyChannel.cpp              |  129 +-
 src/libPS/PowerSupplyChannel.h                |  274 +--
 src/libPS/PowerSupplyRegistry.cpp             |   33 +-
 src/libPS/PowerSupplyRegistry.h               |   39 +-
 src/libPS/RS_HMPXXXX.h                        |   15 +-
 src/libPS/RigolDP832.h                        |   17 +-
 src/libPS/SCPIPs.cpp                          |  152 +-
 src/libPS/SCPIPs.h                            |  285 +--
 src/libPS/SorensenPs.cpp                      |  127 +-
 src/libPS/SorensenPs.h                        |   78 +-
 src/libPS/TTIPs.cpp                           |  144 +-
 src/libPS/TTIPs.h                             |   80 +-
 src/libPS/TTIXXXDPPs.h                        |   11 +-
 src/libPS/TTIXXXSPPs.h                        |   11 +-
 src/libPS/TTIXXXTPPs.cpp                      |    7 +-
 src/libPS/TTIXXXTPPs.h                        |   12 +-
 src/libPS/python.cpp                          |  533 ++---
 src/libScope/PS6000.cpp                       |  928 ++++----
 src/libScope/PS6000.h                         |  194 +-
 src/libScope/PicoScope.h                      |   70 +-
 src/libScope/Tektronix654C.cpp                |  105 +-
 src/libScope/Tektronix654C.h                  |   56 +-
 src/libUtils/ClassRegistry.h                  |   15 +-
 src/libUtils/Logger.cpp                       |   73 +-
 src/libUtils/Logger.h                         |   66 +-
 src/libWaferProb/ControllerBase.cpp           |  173 +-
 src/libWaferProb/ControllerBase.h             |   73 +-
 src/libWaferProb/ControllerGalil.cpp          |  391 ++--
 src/libWaferProb/ControllerGalil.h            |  130 +-
 src/libWaferProb/ControllerZaber.cpp          |  397 ++--
 src/libWaferProb/ControllerZaber.h            |   73 +-
 src/libWaferProb/Handler.cpp                  |  171 +-
 src/libWaferProb/Handler.h                    |    7 +-
 src/libWaferProb/Helper.cpp                   |   28 +-
 src/libWaferProb/Helper.h                     |   10 +-
 src/libWaferProb/MotionController.cpp         |  177 +-
 src/libWaferProb/MotionController.h           |   81 +-
 src/libWaveFormGen/PG8133A.cpp                |   61 +-
 src/libWaveFormGen/PG8133A.h                  |   54 +-
 src/libWaveFormGen/WF33120A.cpp               |   76 +-
 src/libWaveFormGen/WF33120A.h                 |   54 +-
 src/libZaber/z_common.h                       |   51 +-
 src/libZaber/za_serial.cpp                    | 1342 +++++------
 src/libZaber/za_serial.h                      |  119 +-
 src/tools/ftdi_list.cpp                       |   84 +-
 src/tools/ftdi_setidentity.cpp                |  245 +-
 src/tools/gpibscan.cpp                        |  230 +-
 src/tools/listSupportedPS.cpp                 |   78 +-
 src/tools/powersupply.cpp                     |  466 ++--
 src/tools/ps_monitor.cpp                      |  193 +-
 226 files changed, 16465 insertions(+), 17421 deletions(-)
 mode change 100755 => 100644 src/labRemote/module.cpp
 mode change 100755 => 100644 src/libCom/CharDeviceCom.cpp
 mode change 100755 => 100644 src/libCom/CharDeviceCom.h
 mode change 100755 => 100644 src/libCom/GPIBSerialCom.cpp
 mode change 100755 => 100644 src/libCom/GPIBSerialCom.h
 mode change 100755 => 100644 src/libCom/ICom.h
 mode change 100755 => 100644 src/libCom/SerialCom.cpp
 mode change 100755 => 100644 src/libCom/SerialCom.h
 mode change 100755 => 100644 src/libCom/TextSerialCom.cpp
 mode change 100755 => 100644 src/libCom/TextSerialCom.h
 mode change 100755 => 100644 src/libCom/python.cpp
 mode change 100755 => 100644 src/libEquipConf/python.cpp
 mode change 100755 => 100644 src/libGalil/arrays.cpp
 mode change 100755 => 100644 src/libGalil/gclib.h
 mode change 100755 => 100644 src/libGalil/gclib_errors.h
 mode change 100755 => 100644 src/libGalil/gclib_record.h
 mode change 100755 => 100644 src/libGalil/gclibo.cpp
 mode change 100755 => 100644 src/libGalil/gclibo.h
 mode change 100755 => 100644 src/libPS/python.cpp

diff --git a/.clang-format b/.clang-format
index a2a03fab..6092f9a2 100644
--- a/.clang-format
+++ b/.clang-format
@@ -36,7 +36,7 @@ BraceWrapping:
   AfterUnion:      false
   AfterExternBlock: false
   BeforeCatch:     false
-  BeforeElse:      false
+  BeforeElse:      true
   IndentBraces:    false
   SplitEmptyFunction: true
   SplitEmptyRecord: true
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f431680a..e3aec108 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,6 @@
 stages:
-  - format_check
   - build
+  - format_check
   - package
   - deploy
 
diff --git a/CPPLINT.cfg b/CPPLINT.cfg
index e4007f7d..bd0646dc 100644
--- a/CPPLINT.cfg
+++ b/CPPLINT.cfg
@@ -12,3 +12,9 @@ filter=-build/include_subdir
 filter=-build/c++11
 filter=-runtime/printf
 filter=-build/namespaces
+filter=-runtime/string
+filter=-readability/todo
+filter=-whitespace/parens
+filter=-readability/braces
+filter=-whitespace/braces
+filter=-runtime/threadsafe
diff --git a/bash/check_format.sh b/bash/check_format.sh
index 15a36822..c6a971f6 100644
--- a/bash/check_format.sh
+++ b/bash/check_format.sh
@@ -42,7 +42,7 @@ function check_files {
         printf "${YELLOW} -- check_format: Applying formatting fixes to files that fail formatting check!${RESET}\n"
     fi
 
-    dirs_to_exclude="exts configs"
+    dirs_to_exclude="exts configs libGalil"
 
     format_status="0"
     extensions=".cpp .h"
diff --git a/src/examples/chiller_example.cpp b/src/examples/chiller_example.cpp
index 85a8689e..33c7af3d 100644
--- a/src/examples/chiller_example.cpp
+++ b/src/examples/chiller_example.cpp
@@ -1,115 +1,129 @@
-#include "PolySciLM.h"
-#include "Logger.h"
-
-#include <iostream>
 #include <getopt.h>
+
 #include <chrono>
-#include <thread>
-#include <string>
+#include <iostream>
 #include <memory>
+#include <string>
+#include <thread>
 
-float target_temp=15;
-std::string device="";
-speed_t baud=B9600;
+#include "Logger.h"
+#include "PolySciLM.h"
 
-void usage(char *argv[])
-{
-  std::cerr << "" << std::endl;
-  std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
-  std::cerr << "List of options:" << std::endl; 
-  std::cerr << " -p, --port ADDR     Set the address of the port connected to the chiller" << std::endl;  
-  std::cerr << " -b, --baud BAUD     Set the baud rate of the chiller (default: 9600)" << std::endl;  
-  std::cerr << " -t, --temperature T Set the target temperature of the chiller (default: " << target_temp << ")" << std::endl;  
-  std::cerr << " -d, --debug         Enable more verbose printout, use multiple for increased debug level"  << std::endl;
-  std::cerr << " -h, --help          List the commands and options available"  << std::endl;
+void usage(char* argv[]) {
+    std::cerr << "" << std::endl;
+    std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
+    std::cerr << "List of options:" << std::endl;
+    std::cerr << " -p, --port ADDR     Set the address of the port connected "
+                 "to the chiller"
+              << std::endl;
+    std::cerr << " -b, --baud BAUD     Set the baud rate of the chiller "
+                 "(default: 9600)"
+              << std::endl;
+    std::cerr << " -t, --temperature T Set the target temperature of the "
+                 "chiller (default: "
+              << target_temp << ")" << std::endl;
+    std::cerr << " -d, --debug         Enable more verbose printout, use "
+                 "multiple for increased debug level"
+              << std::endl;
+    std::cerr << " -h, --help          List the commands and options available"
+              << std::endl;
 }
 
-int main(int argc, char* argv[]) 
-{ 
-  // Parse command-line
-    if (argc < 1)
-  {
-    usage(argv);
-    return 1;
-   }
-  
-  int c;
-  while (true) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"port",  required_argument, 0,  'p' },
-      {"baud",  required_argument, 0,  'b' },
-      {"temperature",  required_argument, 0,  't' },
-      {"debug",    no_argument      , 0,  'd' },
-      {"help",     no_argument      , 0,  'h' },
-      {0,          0,                 0,  0 }
-    };
-                                                                                
-    c = getopt_long(argc, argv, "p:b:t:dh", long_options, &option_index);
-    if (c == -1)  break;
-    switch (c) {
-      case 'p':
-	device = optarg;
-	break;
-      case 'b': {
-        std::string baud_str=optarg;
-        if(baud_str=="2400") baud=B2400;
-        else if(baud_str=="4800") baud=B4800;
-        else if(baud_str=="9600") baud=B9600;
-        else if(baud_str=="19200") baud=B19200;
-        else {
-          std::cerr << "Invalid baud rate '" << optarg << "' supplied. Use either 2400, 4800, 9600, or 19200. Aborting." << std::endl;
-          return 1;
-        }
-        break;
-      }
-      case 't':
-        try
-        {
-	    target_temp = std::stof(optarg);
-        }
-        catch(const std::invalid_argument& e)
-        {
-	    std::cerr << "Temperature must be a number. "<< optarg << "supplied. Aborting." << std::endl;
-	    return 1;
+int main(int argc, char* argv[]) {
+    // Parse command-line
+    if (argc < 1) {
+        usage(argv);
+        return 1;
+    }
+
+    // inputs
+    float target_temp = 15; // Celsius
+    std::string device = "";
+    speed_t baud = B9600;
+
+    int c;
+    while (true) {
+        int option_index = 0;
+        static struct option long_options[] = {
+            {"port", required_argument, 0, 'p'},
+            {"baud", required_argument, 0, 'b'},
+            {"temperature", required_argument, 0, 't'},
+            {"debug", no_argument, 0, 'd'},
+            {"help", no_argument, 0, 'h'},
+            {0, 0, 0, 0}};
+
+        c = getopt_long(argc, argv, "p:b:t:dh", long_options, &option_index);
+        if (c == -1) break;
+        switch (c) {
+            case 'p':
+                device = optarg;
+                break;
+            case 'b': {
+                std::string baud_str = optarg;
+                if (baud_str == "2400") {
+                    baud = B2400;
+                } else if (baud_str == "4800") {
+                    baud = B4800;
+                } else if (baud_str == "9600") {
+                    baud = B9600;
+                } else if (baud_str == "19200") {
+                    baud = B19200;
+                } else {
+                    std::cerr << "Invalid baud rate '" << optarg
+                              << "' supplied. Use either 2400, 4800, 9600, or "
+                                 "19200. Aborting."
+                              << std::endl;
+                    return 1;
+                }
+                break;
+            }
+            case 't':
+                try {
+                    target_temp = std::stof(optarg);
+                } catch (const std::invalid_argument& e) {
+                    std::cerr << "Temperature must be a number. " << optarg
+                              << "supplied. Aborting." << std::endl;
+                    return 1;
+                }
+                break;
+            case 'd':
+                logIt::incrDebug();
+                break;
+            case 'h':
+                usage(argv);
+                return 1;
+            default:
+                std::cerr << "Invalid option '" << c << "' supplied. Aborting."
+                          << std::endl;
+                usage(argv);
+                return 1;
         }
-	break;
-      case 'd':
-	logIt::incrDebug();
-	break;
-      case 'h':
-	usage(argv);
-	return 1;
-      default:
-	std::cerr << "Invalid option '" << c << "' supplied. Aborting." << std::endl;
-	usage(argv);
-	return 1;
-      }
-  }
+    }
+
+    if (device == "") {
+        std::cerr << "No device port specified for the Arduino. Aborting."
+                  << std::endl;
+        usage(argv);
+        return 1;
+    }
 
-  if(device=="") {
-      std::cerr << "No device port specified for the Arduino. Aborting." <<std::endl;
-      usage(argv);
-      return 1;
-  }
+    logger(logDEBUG) << "Device port: " << device;
 
-  logger(logDEBUG) << "Device port: " << device;
-  
-  std::shared_ptr<TextSerialCom> com = 
-    std::make_shared<TextSerialCom>(device,baud);
-  com->setTermination("\r");
+    std::shared_ptr<TextSerialCom> com =
+        std::make_shared<TextSerialCom>(device, baud);
+    com->setTermination("\r");
 
-  PolySciLM chiller;
-  chiller.setCom(com);
-  chiller.init();
-  chiller.turnOn();
-  chiller.setTargetTemperature(target_temp);
+    PolySciLM chiller;
+    chiller.setCom(com);
+    chiller.init();
+    chiller.turnOn();
+    chiller.setTargetTemperature(target_temp);
 
-  while(true) {
-    float temp=chiller.measureTemperature();
-    logger(logINFO) << "Temperature: " << temp;
-    float stemp=chiller.getTargetTemperature();
-    logger(logINFO) << "Set Temperature: " << stemp;
-    std::this_thread::sleep_for(std::chrono::seconds(1));
-  }
+    while (true) {
+        float temp = chiller.measureTemperature();
+        logger(logINFO) << "Temperature: " << temp;
+        float stemp = chiller.getTargetTemperature();
+        logger(logINFO) << "Set Temperature: " << stemp;
+        std::this_thread::sleep_for(std::chrono::seconds(1));
+    }
 }
diff --git a/src/examples/control_powersupply_example.cpp b/src/examples/control_powersupply_example.cpp
index b4847e48..a1947cba 100644
--- a/src/examples/control_powersupply_example.cpp
+++ b/src/examples/control_powersupply_example.cpp
@@ -1,115 +1,112 @@
-#include <unistd.h>
-#include <stdlib.h>
 #include <getopt.h>
+#include <stdlib.h>
+#include <unistd.h>
+
 #include <iostream>
 #include <memory>
 #include <string>
 
-#include "Logger.h"
+#include "AgilentPs.h"
 #include "EquipConf.h"
+#include "Logger.h"
 #include "PowerSupplyChannel.h"
-#include "AgilentPs.h"
-
-//------ SETTINGS
-std::string configFile;
-std::string channelName;
-//---------------
 
-
-void usage(char *argv[])
-{
-  std::cerr << "Usage: " << argv[0] << " configfile.json channelname" << std::endl;
-  std::cerr << "" << std::endl;
-  std::cerr << "List of options:" << std::endl;
-  std::cerr << " -d, --debug       Enable more verbose printout, use multiple for increased debug level"  << std::endl;
-  std::cerr << "" << std::endl;
-  std::cerr << "" << std::endl;
+void usage(char *argv[]) {
+    std::cerr << "Usage: " << argv[0] << " configfile.json channelname"
+              << std::endl;
+    std::cerr << "" << std::endl;
+    std::cerr << "List of options:" << std::endl;
+    std::cerr << " -d, --debug       Enable more verbose printout, use "
+                 "multiple for increased debug level"
+              << std::endl;
+    std::cerr << "" << std::endl;
+    std::cerr << "" << std::endl;
 }
 
-int main(int argc, char*argv[])
-{
+int main(int argc, char *argv[]) {
+    if (argc < 1) {
+        usage(argv);
+        return 1;
+    }
+
+    // settings
+    std::string configFile = "";
+    std::string channelName = "";
+
+    // Parse command-line
+    int c;
+    while (1) {
+        int option_index = 0;
+        static struct option long_options[] = {{"debug", no_argument, 0, 'd'},
+                                               {0, 0, 0, 0}};
+
+        c = getopt_long(argc, argv, "d", long_options, &option_index);
+        if (c == -1) break;
+
+        switch (c) {
+            case 'd':
+                logIt::incrDebug();
+                break;
+            default:
+                std::cerr << "Invalid option '" << c << "' supplied. Aborting."
+                          << std::endl;
+                std::cerr << std::endl;
+                usage(argv);
+                return 1;
+        }
+    }
 
-  if (argc < 1)
-    {
-      usage(argv);
-      return 1;
+    if (optind > argc - 2) {
+        logger(logERROR) << "Missing positional arguments.";
+        usage(argv);
+        return 1;
     }
 
-  //Parse command-line
-  int c;
-  while (1) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"debug",    no_argument      , 0,  'd' },
-      {0,          0,                 0,  0 }
-    };
-    
-    c = getopt_long(argc, argv, "d", long_options, &option_index);
-    if (c == -1)
-      break;
-
-    switch (c)
-      {
-      case 'd':
-	logIt::incrDebug();
-	break;
-      default:
-	std::cerr << "Invalid option '" << c << "' supplied. Aborting." << std::endl;
-	std::cerr << std::endl;
-	usage(argv);
-	return 1;
-      }
-  }
-
-  if(optind>argc-2)
-    {
-      logger(logERROR) << "Missing positional arguments.";
-      usage(argv);
-      return 1;
+    configFile = argv[optind++];
+    channelName = argv[optind++];
+
+    logger(logDEBUG) << "Settings:";
+    logger(logDEBUG) << " Config file: " << configFile;
+    logger(logDEBUG) << " PS channel: " << channelName;
+
+    //
+    // Create hardware database
+    EquipConf hw;
+    hw.setHardwareConfig(configFile);
+
+    logger(logDEBUG) << "Configuring power-supply.";
+    std::shared_ptr<PowerSupplyChannel> PS =
+        hw.getPowerSupplyChannel(channelName);
+
+    logger(logDEBUG) << "Program power-supply.";
+    PS->program();
+
+    // Now interpret command
+    logger(logDEBUG) << "Sending commend to power-supply.";
+
+    logger(logINFO) << "Program";
+    PS->program();
+    logger(logINFO) << "Turn ON";
+    PS->turnOn();
+    logger(logINFO) << "Voltage: " << PS->measureVoltage();
+    logger(logINFO) << "Current: " << PS->measureCurrent();
+
+    // To acces a function that is only defined for a specific powersupply
+    // (Agilent in this case), need to cast back
+    std::shared_ptr<AgilentPs> Agilent =
+        std::dynamic_pointer_cast<AgilentPs>(PS->getPowerSupply());
+    if (Agilent == nullptr) {
+        logger(logWARNING) << "The power supply is not an Agilent, can't "
+                              "execute required action";
+    } else {
+        logger(logINFO) << "Switch off beeping for Agilent PS";
+        Agilent->beepOff();
     }
 
-  configFile =argv[optind++];
-  channelName=argv[optind++];
-
-  logger(logDEBUG) << "Settings:";
-  logger(logDEBUG) << " Config file: " << configFile;
-  logger(logDEBUG) << " PS channel: " << channelName;
-  
-  //
-  // Create hardware database
-  EquipConf hw;
-  hw.setHardwareConfig(configFile);
-
-  logger(logDEBUG) << "Configuring power-supply.";
-  std::shared_ptr<PowerSupplyChannel> PS = hw.getPowerSupplyChannel(channelName);
-  
-  logger(logDEBUG) << "Program power-supply.";
-  PS->program();
-
-  
-  //Now interpret command
-  logger(logDEBUG) << "Sending commend to power-supply.";
-
-  logger(logINFO) << "Program";
-  PS->program();
-  logger(logINFO) << "Turn ON";
-  PS->turnOn();
-  logger(logINFO) << "Voltage: " << PS->measureVoltage();
-  logger(logINFO) << "Current: " << PS->measureCurrent();
-
-  //To acces a function that is only defined for a specific powersupply (Agilent in this case), need to cast back 
-  std::shared_ptr<AgilentPs> Agilent = std::dynamic_pointer_cast<AgilentPs>(PS->getPowerSupply());
-  if (Agilent == nullptr) 
-    logger(logWARNING)<<"The power supply is not an Agilent, can't execute required action";
-  else { 
-    logger(logINFO) << "Switch off beeping for Agilent PS";
-    Agilent->beepOff();
-  }
-
-  logger(logINFO) << "Turn OFF";
-  PS->turnOff();
-
-  logger(logINFO) << "All done";  
-  
-  return 0;
+    logger(logINFO) << "Turn OFF";
+    PS->turnOff();
+
+    logger(logINFO) << "All done";
+
+    return 0;
 }
diff --git a/src/examples/datasink_example.cpp b/src/examples/datasink_example.cpp
index 4abf2226..b62fa7f3 100644
--- a/src/examples/datasink_example.cpp
+++ b/src/examples/datasink_example.cpp
@@ -1,113 +1,102 @@
-#include <unistd.h>
-#include <stdlib.h>
 #include <getopt.h>
+#include <stdlib.h>
+#include <unistd.h>
+
 #include <iostream>
 #include <memory>
+#include <random>
 #include <string>
 #include <thread>
-#include <random>
 
-#include "Logger.h"
 #include "DataSinkConf.h"
 #include "IDataSink.h"
-
-//------ SETTINGS
-std::string configFile;
-std::string streamName;
-//---------------
+#include "Logger.h"
 
 
-void usage(char *argv[])
-{
-  std::cerr << "Usage: " << argv[0] << " configfile.json streamName" << std::endl;
-  std::cerr << "" << std::endl;
-  std::cerr << "List of options:" << std::endl;
-  std::cerr << " -d, --debug       Enable more verbose printout, use multiple for increased debug level" << std::endl;
-  std::cerr << "" << std::endl;
-  std::cerr << "" << std::endl;
+void usage(char *argv[]) {
+    std::cerr << "Usage: " << argv[0] << " configfile.json streamName"
+              << std::endl;
+    std::cerr << "" << std::endl;
+    std::cerr << "List of options:" << std::endl;
+    std::cerr << " -d, --debug       Enable more verbose printout, use "
+                 "multiple for increased debug level"
+              << std::endl;
+    std::cerr << "" << std::endl;
+    std::cerr << "" << std::endl;
 }
 
-int main(int argc, char*argv[])
-{
+int main(int argc, char *argv[]) {
+    if (argc < 1) {
+        usage(argv);
+        return 1;
+    }
 
-  if (argc < 1)
-    {
-      usage(argv);
-      return 1;
+    // Parse command-line
+    int c;
+    while (1) {
+        int option_index = 0;
+        static struct option long_options[] = {{"debug", no_argument, 0, 'd'},
+                                               {0, 0, 0, 0}};
+
+        c = getopt_long(argc, argv, "d", long_options, &option_index);
+        if (c == -1) break;
+
+        switch (c) {
+            case 'd':
+                logIt::incrDebug();
+                break;
+            default:
+                std::cerr << "Invalid option '" << c << "' supplied. Aborting."
+                          << std::endl;
+                std::cerr << std::endl;
+                usage(argv);
+                return 1;
+        }
     }
 
-  //Parse command-line
-  int c;
-  while (1) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"debug",    no_argument      , 0,  'd' },
-      {0,          0,                 0,  0 }
-    };
-    
-    c = getopt_long(argc, argv, "d", long_options, &option_index);
-    if (c == -1)
-      break;
-
-    switch (c)
-      {
-      case 'd':
-	logIt::incrDebug();
-	break;
-      default:
-	std::cerr << "Invalid option '" << c << "' supplied. Aborting." << std::endl;
-	std::cerr << std::endl;
-	usage(argv);
-	return 1;
-      }
-  }
-
-  if(optind>argc-2)
-    {
-      logger(logERROR) << "Missing positional arguments.";
-      usage(argv);
-      return 1;
+    if (optind > argc - 2) {
+        logger(logERROR) << "Missing positional arguments.";
+        usage(argv);
+        return 1;
     }
 
-  configFile =argv[optind++];
-  streamName =argv[optind++];
-
-  logger(logDEBUG) << "Settings:";
-  logger(logDEBUG) << " Config file: " << configFile;
-  logger(logDEBUG) << " Stream name: " << streamName;
-
-  // Crease stream
-  DataSinkConf ds;
-  ds.setHardwareConfig(configFile);
-  std::shared_ptr<IDataSink> stream = ds.getDataStream(streamName);
-
-  //
-  // Measurement loop
-
-  std::random_device rd{};
-  std::mt19937 gen{rd()};
-
-  std::normal_distribution<> d0{20,1};
-  stream->setTag("location","room");
-  for(uint32_t i=0;i<4;i++)
-    {
-      stream->startMeasurement("climate", std::chrono::system_clock::now());
-      stream->setField("temperature", d0(gen));
-      stream->recordPoint();
-      stream->endMeasurement();
-      std::this_thread::sleep_for(std::chrono::seconds(1));
+    std::string configFile = argv[optind++];
+    std::string streamName = argv[optind++];
+
+    logger(logDEBUG) << "Settings:";
+    logger(logDEBUG) << " Config file: " << configFile;
+    logger(logDEBUG) << " Stream name: " << streamName;
+
+    // Crease stream
+    DataSinkConf ds;
+    ds.setHardwareConfig(configFile);
+    std::shared_ptr<IDataSink> stream = ds.getDataStream(streamName);
+
+    //
+    // Measurement loop
+
+    std::random_device rd{};
+    std::mt19937 gen{rd()};
+
+    std::normal_distribution<> d0{20, 1};
+    stream->setTag("location", "room");
+    for (uint32_t i = 0; i < 4; i++) {
+        stream->startMeasurement("climate", std::chrono::system_clock::now());
+        stream->setField("temperature", d0(gen));
+        stream->recordPoint();
+        stream->endMeasurement();
+        std::this_thread::sleep_for(std::chrono::seconds(1));
     }
 
-  stream->setTag("location","fridge");  
-  std::normal_distribution<> d1{0,1};
-  for(uint32_t i=0;i<4;i++)
-    {
-      stream->startMeasurement("climate", std::chrono::system_clock::now());
-      stream->setField("temperature", d1(gen));
-      stream->recordPoint();
-      stream->endMeasurement();
-      std::this_thread::sleep_for(std::chrono::seconds(1));
+    stream->setTag("location", "fridge");
+    std::normal_distribution<> d1{0, 1};
+    for (uint32_t i = 0; i < 4; i++) {
+        stream->startMeasurement("climate", std::chrono::system_clock::now());
+        stream->setField("temperature", d1(gen));
+        stream->recordPoint();
+        stream->endMeasurement();
+        std::this_thread::sleep_for(std::chrono::seconds(1));
     }
-  
-  return 0;
+
+    return 0;
 }
diff --git a/src/examples/devcomuino_example.cpp b/src/examples/devcomuino_example.cpp
index c5fa8e84..dd7bb95d 100644
--- a/src/examples/devcomuino_example.cpp
+++ b/src/examples/devcomuino_example.cpp
@@ -1,86 +1,84 @@
 //#include "SerialCom.h"
-#include "TextSerialCom.h"
-#include "Logger.h"
 #include <chrono>
-#include <thread>
-#include <sstream>
-#include <iomanip>
 #include <cstdint>
+#include <iomanip>
+#include <sstream>
+#include <thread>
+
+#include "Logger.h"
+#include "TextSerialCom.h"
+
+// Example code on how to send commands to a Si7021 sensor connected to the
+// Aruino via I2C
+// https://cdn-learn.adafruit.com/assets/assets/000/035/931/original/Support_Documents_TechnicalDocs_Si7021-A20.pdf
+
+int main(int argc, char* argv[]) {
+    TextSerialCom com("/dev/ttyACM2", B9600);
+    com.setTermination("\r\n");
+    com.init();
+
+    logIt::incrDebug();
+    logIt::incrDebug();
+    logIt::incrDebug();
+
+    // Not fully sure why a long sleep here is needed, but
+    // without it the code hangs the first time the Arduino
+    // is accessed after uploading a sketch
+    std::this_thread::sleep_for(std::chrono::seconds(5));
+
+    //
+    // Fun test commands
+
+    com.send("I2C WRITE 40 84B8");
+    com.receive();
+
+    com.send("I2C READ 40 1");
+    std::string response = com.receive();
+    logger(logDEBUG) << response;
+
+    com.send("I2C WRITE 40 0xE7");
+    com.receive();
+
+    com.send("I2C READ 40 1");
+    std::string response1 = com.receive();
+    logger(logINFO) << "Register status: " << response1;
+
+    while (true) {  // measure humidity
+        com.send("I2C WRITE 40 F5");
+        com.receive();
+
+        com.send("I2C READ 40 3");
+        std::string response2 = com.receive();
+
+        std::stringstream ss;
+        uint32_t out;
+        ss << std::hex << response2;
+        ss >> out;
+        uint16_t h = (out >> 8) & 0xffff;
+        uint16_t hc = out & 0x0000ff;
+
+        logger(logDEBUG) << "Raw Humidity data from sensor: " << response2
+                         << "  raw Humidity: " << h << " Checksum:" << hc;
+
+        float humidata = (125 * h / 65536.) - 6;
+        logger(logINFO) << "Calibrated humidity: " << humidata;
+
+        com.send("I2C WRITE 40 E0");
+        com.receive();
+
+        com.send("I2C READ 40 3");
+        std::string response3 = com.receive();
+
+        ss << std::hex << response3;
+        ss >> out;
+        uint16_t t = (out >> 8) & 0xffff;
+        uint16_t tc = out & 0x0000ff;
+        logger(logDEBUG) << "Raw Temperature data from sensor: " << response3
+                         << "  raw Temperature: " << t << " Checksum:" << tc;
 
-//Example code on how to send commands to a Si7021 sensor connected to the Aruino via I2C  
-//https://cdn-learn.adafruit.com/assets/assets/000/035/931/original/Support_Documents_TechnicalDocs_Si7021-A20.pdf
-
-int main(int argc, char* argv[]) 
-{
-  TextSerialCom com("/dev/ttyACM2", B9600);
-  com.setTermination("\r\n");
-  com.init();
-
-  logIt::incrDebug();
-  logIt::incrDebug();
-  logIt::incrDebug();
-
-
-  // Not fully sure why a long sleep here is needed, but
-  // without it the code hangs the first time the Arduino
-  // is accessed after uploading a sketch
-  std::this_thread::sleep_for(std::chrono::seconds(5));
-
-  //
-  // Fun test commands
-
-  com.send("I2C WRITE 40 84B8");
-  com.receive();
-
-  com.send("I2C READ 40 1");
-  std::string response = com.receive();
-  logger (logDEBUG) << response;
-  
-  com.send("I2C WRITE 40 0xE7");
-  com.receive();
-
-  com.send("I2C READ 40 1");
-  std::string response1= com.receive();
-  logger (logINFO) <<"Register status: "<<response1;
-  
-  while (true)
-    {// measure humidity 
-      com.send("I2C WRITE 40 F5");
-      com.receive();
-      
-      com.send("I2C READ 40 3");
-      std::string response2= com.receive();
-            
-      std::stringstream ss;
-      uint32_t out;
-      ss << std::hex << response2;
-      ss >> out;
-      uint16_t h =(out >> 8) & 0xffff;
-      uint16_t hc= out       & 0x0000ff;
-      
-      logger(logDEBUG) <<"Raw Humidity data from sensor: "<< response2<<"  raw Humidity: "<<h<< " Checksum:"<< hc;
-      
-      float humidata=(125*h/65536.)-6;
-      logger (logINFO) <<"Calibrated humidity: "<<humidata;
-      
-      
-      com.send("I2C WRITE 40 E0");
-      com.receive();
-      
-      com.send("I2C READ 40 3");
-      std::string response3 = com.receive();
-      
-      ss << std::hex << response3;
-      ss >> out;
-      uint16_t t =(out >> 8) & 0xffff;
-      uint16_t tc= out       & 0x0000ff;
-      logger(logDEBUG) <<"Raw Temperature data from sensor: "<< response3<<"  raw Temperature: "<<t<< " Checksum:"<< tc;
-      
-      float tempdata=(175.72*t/65536)-46.85;
-      logger (logINFO) <<"Calibrated Temperature:"<< tempdata;
-      
+        float tempdata = (175.72 * t / 65536) - 46.85;
+        logger(logINFO) << "Calibrated Temperature:" << tempdata;
     }
 
- 
-  return 0;
+    return 0;
 }
diff --git a/src/examples/fluke_test.cpp b/src/examples/fluke_test.cpp
index 88e7a8ec..fabc14e8 100644
--- a/src/examples/fluke_test.cpp
+++ b/src/examples/fluke_test.cpp
@@ -1,21 +1,19 @@
 #include <iostream>
 
-#include "Logger.h"
 #include "Fluke8842.h"
+#include "Logger.h"
 
-int main(int argc, char*argv[]) {
-
-  Fluke8842 meter(argv[1], 6);
-  meter.init();
+int main(int argc, char* argv[]) {
+    Fluke8842 meter(argv[1], 6);
+    meter.init();
 
-  meter.setSense(FlukeMode::VOLTAGEDC);
+    meter.setSense(FlukeMode::VOLTAGEDC);
 
-  for (unsigned i=0; i<10; i++) {
-    logger(logINFO) << meter.sense();
-    //std::cout<<meter.sense()<<std::endl;
-    std::this_thread::sleep_for(std::chrono::seconds(1));
-  }
+    for (unsigned i = 0; i < 10; i++) {
+        logger(logINFO) << meter.sense();
+        // std::cout<<meter.sense()<<std::endl;
+        std::this_thread::sleep_for(std::chrono::seconds(1));
+    }
 
-  return 0;
+    return 0;
 }
-
diff --git a/src/examples/ntc_example.cpp b/src/examples/ntc_example.cpp
index 10898bc2..f126745b 100644
--- a/src/examples/ntc_example.cpp
+++ b/src/examples/ntc_example.cpp
@@ -1,150 +1,154 @@
-#include "TextSerialCom.h"
-#include "NTCSensor.h"
-#include "Logger.h"
-#include <iostream>
 #include <getopt.h>
+
 #include <chrono>
-#include <thread>
-#include <sstream>
-#include <iomanip>
 #include <cstdint>
-#include <string>
+#include <iomanip>
+#include <iostream>
 #include <memory>
+#include <sstream>
+#include <string>
+#include <thread>
+
+#include "Logger.h"
+#include "NTCSensor.h"
+#include "TextSerialCom.h"
 
 // Voltage powering the NTC
-float voltage=5.0;
+float voltage = 5.0;
 // The pin on the Arduino connected to the NTC
-uint8_t pin=0;
+uint8_t pin = 0;
 // The address of the device port connected to the Arduino
-std::string device=""; 
+std::string device = "";
 // Resistance of resistor in voltage divider
-float Rvdiv=10000.0;
+float Rvdiv = 10000.0;
 // The total voltage across the voltage divider
-float V=5.0;
+float V = 5.0;
 
 // Information specific to the NTC
 // Part number: 103KT1608
 // See https://www.datasheets360.com/pdf/6686957959228959166
 // ---------------------------------------------------------
 // Reference temperature in Kelvin
-float refTemp=298.15;
+float refTemp = 298.15;
 // Resistance at reference temperature in ohms
-float Rref=10000.0;
+float Rref = 10000.0;
 // B value for NTC in Kelvin
-float Bntc=3435;
+float Bntc = 3435;
 
-void usage(char *argv[])
-{
-  std::cerr << "" << std::endl;
-  std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
-  std::cerr << "List of options:" << std::endl; 
-  std::cerr << " -p, --pin P         Set the Arduino pin number connected to the NTC (default: " << pin << ")" << std::endl;  
-  std::cerr << " -r, --resistance R  Set the resistance in the voltage divider (default: " << Rvdiv << ")" << std::endl;
-  std::cerr << " -a, --port ADDR   Set the address of the port connected to the Arduino" << std::endl;  
-  std::cerr << " -d, --debug         Enable more verbose printout, use multiple for increased debug level"  << std::endl;
-  std::cerr << " -h, --help          List the commands and options available"  << std::endl;
-  std::cerr << "" << std::endl;
+void usage(char* argv[]) {
+    std::cerr << "" << std::endl;
+    std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
+    std::cerr << "List of options:" << std::endl;
+    std::cerr << " -p, --pin P         Set the Arduino pin number connected to "
+                 "the NTC (default: "
+              << pin << ")" << std::endl;
+    std::cerr << " -r, --resistance R  Set the resistance in the voltage "
+                 "divider (default: "
+              << Rvdiv << ")" << std::endl;
+    std::cerr << " -a, --port ADDR   Set the address of the port connected to "
+                 "the Arduino"
+              << std::endl;
+    std::cerr << " -d, --debug         Enable more verbose printout, use "
+                 "multiple for increased debug level"
+              << std::endl;
+    std::cerr << " -h, --help          List the commands and options available"
+              << std::endl;
+    std::cerr << "" << std::endl;
 }
 
+int main(int argc, char* argv[]) {
+    // Parse command-line
+    if (argc < 1) {
+        usage(argv);
+        return 1;
+    }
+
+    int c;
+    while (true) {
+        int option_index = 0;
+        static struct option long_options[] = {
+            {"pin", required_argument, 0, 'p'},
+            {"resistance", required_argument, 0, 'r'},
+            {"port", required_argument, 0, 'a'},
+            {"debug", no_argument, 0, 'd'},
+            {"help", no_argument, 0, 'h'},
+            {0, 0, 0, 0}};
 
-int main(int argc, char* argv[]) 
-{ 
-  //Parse command-line  
-  if (argc < 1)
-  {
-    usage(argv);
-    return 1;
-   }
-  
-  int c;
-  while (true) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"pin", required_argument, 0,  'p' },
-      {"resistance",  required_argument, 0,  'r' },
-      {"port",  required_argument, 0,  'a' },
-      {"debug",    no_argument      , 0,  'd' },
-      {"help",     no_argument      , 0,  'h' },
-      {0,          0,                 0,  0 }
-    };
-                                                                                
-    c = getopt_long(argc, argv, "p:r:a:dh", long_options, &option_index);
-    if (c == -1)  break;
-    switch (c) {
-      case 'p':
-        try
-        {
-	    pin = (uint8_t)std::stoi(optarg);
-        }
-        catch(const std::invalid_argument& e)
-        {
-	    std::cerr << "Pin must be a number. "<< optarg << "supplied. Aborting." << std::endl;
-      	    std::cerr << std::endl;
-            usage(argv);
-	    return 1;
-        }
-	break;
-      case 'a':
-	device = optarg;
-	break;
-      case 'r':
-	try
-	{
-            Rvdiv = std::stoi(optarg);
-	}
-	catch(const std::invalid_argument& e)
-	{
-	    std::cerr << "Resistance must be a number. "<< optarg << "supplied. Aborting." << std::endl;
-      	    std::cerr << std::endl;
-            usage(argv);
-	    return 1;
+        c = getopt_long(argc, argv, "p:r:a:dh", long_options, &option_index);
+        if (c == -1) break;
+        switch (c) {
+            case 'p':
+                try {
+                    pin = (uint8_t)std::stoi(optarg);
+                } catch (const std::invalid_argument& e) {
+                    std::cerr << "Pin must be a number. " << optarg
+                              << "supplied. Aborting." << std::endl;
+                    std::cerr << std::endl;
+                    usage(argv);
+                    return 1;
+                }
+                break;
+            case 'a':
+                device = optarg;
+                break;
+            case 'r':
+                try {
+                    Rvdiv = std::stoi(optarg);
+                } catch (const std::invalid_argument& e) {
+                    std::cerr << "Resistance must be a number. " << optarg
+                              << "supplied. Aborting." << std::endl;
+                    std::cerr << std::endl;
+                    usage(argv);
+                    return 1;
+                }
+                break;
+            case 'd':
+                logIt::incrDebug();
+                break;
+            case 'h':
+                usage(argv);
+                return 1;
+            default:
+                std::cerr << "Invalid option '" << c << "' supplied. Aborting."
+                          << std::endl;
+                std::cerr << std::endl;
+                usage(argv);
+                return 1;
         }
-	break;
-      case 'd':
-	logIt::incrDebug();
-	break;
-      case 'h':
-	usage(argv);
-	return 1;
-      default:
-	std::cerr << "Invalid option '" << c << "' supplied. Aborting." << std::endl;
-	std::cerr << std::endl;
-	usage(argv);
-	return 1;
-      }
-  }
+    }
 
-  if(device=="") {
-      std::cerr << "No device port specified for the Arduino. Aborting." <<std::endl;
-      usage(argv);
-      return 1;
-  }
+    if (device == "") {
+        std::cerr << "No device port specified for the Arduino. Aborting."
+                  << std::endl;
+        usage(argv);
+        return 1;
+    }
 
-  logger(logDEBUG) << "Device port: " << device;
-  logger(logDEBUG) << "Pin: " << (int)pin;
+    logger(logDEBUG) << "Device port: " << device;
+    logger(logDEBUG) << "Pin: " << static_cast<int>(pin;)
 
-  std::shared_ptr<TextSerialCom> com = std::make_shared<TextSerialCom>(device,B9600);
-  com->setTermination("\r\n");
-  com->setTimeout(5);
-  com->init();
+    std::shared_ptr<TextSerialCom> com =
+        std::make_shared<TextSerialCom>(device, B9600);
+    com->setTermination("\r\n");
+    com->setTimeout(5);
+    com->init();
 
-  NTCSensor sensor(pin, com, refTemp, Rref, Bntc, Rvdiv, V);
-  sensor.init();
+    NTCSensor sensor(pin, com, refTemp, Rref, Bntc, Rvdiv, V);
+    sensor.init();
 
-  while (true)
-    {
-      // Temperature in Celsius
-      try {
-        sensor.read();
-      } catch(const std::runtime_error& e) {
-          logger(logDEBUG) << e.what();
-          std::this_thread::sleep_for(std::chrono::seconds(1));
-          continue;
-      }
-      float temp=sensor.temperature();
-      logger(logINFO) << "Temperature: " << temp << " C";
-      std::this_thread::sleep_for(std::chrono::seconds(1));
+    while (true) {
+        // Temperature in Celsius
+        try {
+            sensor.read();
+        } catch (const std::runtime_error& e) {
+            logger(logDEBUG) << e.what();
+            std::this_thread::sleep_for(std::chrono::seconds(1));
+            continue;
+        }
+        float temp = sensor.temperature();
+        logger(logINFO) << "Temperature: " << temp << " C";
+        std::this_thread::sleep_for(std::chrono::seconds(1));
     }
 
-  return 0;
+    return 0;
 }
diff --git a/src/examples/pixel_scope_run.cpp b/src/examples/pixel_scope_run.cpp
index fedb91be..9fb7b154 100644
--- a/src/examples/pixel_scope_run.cpp
+++ b/src/examples/pixel_scope_run.cpp
@@ -1,6 +1,6 @@
-#include <iostream>
-#include <fstream>
 #include <chrono>
+#include <fstream>
+#include <iostream>
 
 #include "Logger.h"
 
@@ -8,64 +8,63 @@
 #include "PS6000.h"
 #endif
 
-int main(int argc, char* argv[])
-{
-  if(argc!=2)
-    {
-      std::cerr << "usage: " << argv[0] << " outfile.csv" << std::endl;
-      return 1;
+int main(int argc, char* argv[]) {
+    if (argc != 2) {
+        std::cerr << "usage: " << argv[0] << " outfile.csv" << std::endl;
+        return 1;
     }
 
 #ifndef SCOPE
-  logger(logERROR) << "Missing libScope";
-#else // SCOPE
+    logger(logERROR) << "Missing libScope";
+#else  // SCOPE
 
-  PicoScope *pico=new PS6000();
-  pico->open();
+    PicoScope* pico = new PS6000();
+    pico->open();
 
-  pico->setEnable(3,false);
-  pico->setPeriod(1e-9);
-  pico->setRange(0, 1000);
-  pico->setRange(1,  100);
-  pico->setRange(2, 1000);
-  pico->configChannels();
+    pico->setEnable(3, false);
+    pico->setPeriod(1e-9);
+    pico->setRange(0, 1000);
+    pico->setRange(1, 100);
+    pico->setRange(2, 1000);
+    pico->configChannels();
 
-  pico->setSamples(2048);
-  pico->setTriggerPosition(0.5);
+    pico->setSamples(2048);
+    pico->setTriggerPosition(0.5);
 
-  pico->setTrigger(0, 500, PicoScope::Direction::Rising);
+    pico->setTrigger(0, 500, PicoScope::Direction::Rising);
 
-  float period=pico->getPeriod();
+    float period = pico->getPeriod();
 
-  std::vector<std::vector<float>> data(3,std::vector<float>(2048));
+    std::vector<std::vector<float> > data(3, std::vector<float>(2048));
 
-  std::ofstream logfile(argv[1], std::fstream::out);
-  logfile << "run time A B C" << std::endl;
+    std::ofstream logfile(argv[1], std::fstream::out);
+    logfile << "run time A B C" << std::endl;
 
-  uint32_t i=0;
-  while(true)
-    {
-      auto start = std::chrono::steady_clock::now();
+    uint32_t i = 0;
+    while (true) {
+        auto start = std::chrono::steady_clock::now();
 
-      pico->run(data);
+        pico->run(data);
 
-      for(unsigned int row=0; row<data[0].size(); row++)
-      {
-  	logfile << i << " " << row*period;
-  	for(unsigned int ch=0; ch<data.size(); ch++)
-  	  logfile << " " << data[ch][row];
-  	logfile << std::endl;
-      }
+        for (unsigned int row = 0; row < data[0].size(); row++) {
+            logfile << i << " " << row * period;
+            for (unsigned int ch = 0; ch < data.size(); ch++)
+                logfile << " " << data[ch][row];
+            logfile << std::endl;
+        }
 
-      auto duration_read = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start);
-      std::cout << "time after read: " << duration_read.count() << " ms" << std::endl;
-      i++;
+        auto duration_read =
+            std::chrono::duration_cast<std::chrono::milliseconds>(
+                std::chrono::steady_clock::now() - start);
+        std::cout << "time after read: " << duration_read.count() << " ms"
+                  << std::endl;
+        i++;
     }
-  logfile.close();
+    logfile.close();
 
-  pico->close();
+    pico->close();
 
-#endif // SCOPE
+#endif  // SCOPE
 
-  return 0;
+    return 0;
 }
diff --git a/src/examples/scope_test.cpp b/src/examples/scope_test.cpp
index c46c62d8..df802ba5 100644
--- a/src/examples/scope_test.cpp
+++ b/src/examples/scope_test.cpp
@@ -1,6 +1,6 @@
-#include <iostream>
-#include <fstream>
 #include <chrono>
+#include <fstream>
+#include <iostream>
 
 #include "Logger.h"
 
@@ -10,53 +10,60 @@
 
 #define BUFFER_SIZE 2097152
 
-int main()
-{
+int main() {
 #ifndef SCOPE
-  logger(logERROR) << "Missing libScope";
-#else // SCOPE
+    logger(logERROR) << "Missing libScope";
+#else  // SCOPE
 
-  PicoScope *pico=new PS6000();
-  pico->open();
+    PicoScope *pico = new PS6000();
+    pico->open();
 
-  pico->setEnable(1,false);
-  pico->setEnable(2,false);
-  pico->setEnable(3,false);
-  pico->setPeriod(1e-8);
-  pico->setRange(0, 2000);
-  pico->configChannels();
+    pico->setEnable(1, false);
+    pico->setEnable(2, false);
+    pico->setEnable(3, false);
+    pico->setPeriod(1e-8);
+    pico->setRange(0, 2000);
+    pico->configChannels();
 
-  float period=pico->getPeriod();
+    float period = pico->getPeriod();
 
-  std::vector<std::vector<std::vector<float>>> allrunsdata(10, std::vector<std::vector<float>>(1,std::vector<float>(BUFFER_SIZE)));
-  //std::vector<std::vector<std::vector<int16_t>>> allrunsdata(10, std::vector<std::vector<int16_t>>(1,std::vector<int16_t>(BUFFER_SIZE)));
+    std::vector<std::vector<std::vector<float> > > allrunsdata(
+        10,
+        std::vector<std::vector<float> >(1, std::vector<float>(BUFFER_SIZE)));
+    // std::vector<std::vector<std::vector<int16_t>>> allrunsdata(10,
+    // std::vector<std::vector<int16_t>>(1,std::vector<int16_t>(BUFFER_SIZE)));
 
-  std::ofstream logfile("/tmp/scope.csv", std::fstream::out);
-  logfile << "run time A" << std::endl;
+    std::ofstream logfile("/tmp/scope.csv", std::fstream::out);
+    logfile << "run time A" << std::endl;
 
-  for(uint i=0; i<10; i++)
-    {
-      auto start = std::chrono::steady_clock::now();
+    for (uint i = 0; i < 10; i++) {
+        auto start = std::chrono::steady_clock::now();
 
-      pico->run(allrunsdata.at(i));
+        pico->run(allrunsdata.at(i));
 
-      auto duration_read = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start);
-      std::cout << "time after read: " << duration_read.count() << " ms" << std::endl;
+        auto duration_read =
+            std::chrono::duration_cast<std::chrono::milliseconds>(
+                std::chrono::steady_clock::now() - start);
+        std::cout << "time after read: " << duration_read.count() << " ms"
+                  << std::endl;
     }
 
-  auto start = std::chrono::steady_clock::now();
+    auto start = std::chrono::steady_clock::now();
 
-  for(uint i=0;i<allrunsdata.size();i++)
-    for(unsigned int row=0; row<allrunsdata[i][0].size(); row++)
-      logfile << i << " " << row*period << " " << allrunsdata[i][0][row] << std::endl;
+    for (uint i = 0; i < allrunsdata.size(); i++)
+        for (unsigned int row = 0; row < allrunsdata[i][0].size(); row++)
+            logfile << i << " " << row * period << " " << allrunsdata[i][0][row]
+                    << std::endl;
 
-  auto duration_write = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start);
-  std::cout << "time after write: " << duration_write.count() << " ms" << std::endl;
-  logfile.close();
+    auto duration_write = std::chrono::duration_cast<std::chrono::milliseconds>(
+        std::chrono::steady_clock::now() - start);
+    std::cout << "time after write: " << duration_write.count() << " ms"
+              << std::endl;
+    logfile.close();
 
-  pico->close();
+    pico->close();
 
-#endif // SCOPE
+#endif  // SCOPE
 
-  return 0;
+    return 0;
 }
diff --git a/src/examples/sht85_test.cpp b/src/examples/sht85_test.cpp
index 27f2c75a..758ef1b9 100644
--- a/src/examples/sht85_test.cpp
+++ b/src/examples/sht85_test.cpp
@@ -1,38 +1,39 @@
+#include "SHT85.h"
+
+#include <math.h>
+#include <unistd.h>
+
+#include <iomanip>
 #include <iostream>
 #include <memory>
-#include <iomanip>
-#include <unistd.h>
-#include <math.h>
 
 #include "FT232H.h"
+#include "I2CDevCom.h"
+#include "I2CDevComuino.h"
 #include "I2CFTDICom.h"
 #include "Logger.h"
-#include "SHT85.h"
 
-#include "I2CDevComuino.h"
-#include "I2CDevCom.h"
-
-int main(int argc, char*argv[])
-{
+int main(int argc, char* argv[]) {
 #ifdef FTDI
-  std::shared_ptr<MPSSEChip> ftdi=std::make_shared<FT232H>(MPSSEChip::Protocol::I2C, MPSSEChip::Speed::ONE_HUNDRED_KHZ, MPSSEChip::Endianness::MSBFirst);
-  std::shared_ptr<I2CCom> i2c=std::make_shared<I2CFTDICom>(ftdi, 0x44);
+    std::shared_ptr<MPSSEChip> ftdi = std::make_shared<FT232H>(
+        MPSSEChip::Protocol::I2C, MPSSEChip::Speed::ONE_HUNDRED_KHZ,
+        MPSSEChip::Endianness::MSBFirst);
+    std::shared_ptr<I2CCom> i2c = std::make_shared<I2CFTDICom>(ftdi, 0x44);
 #else
-  std::shared_ptr<TextSerialCom> TC(new TextSerialCom("/dev/ttyACM0", B9600));
-  TC->setTermination("\r\n");
-  TC->init();
+    std::shared_ptr<TextSerialCom> TC(new TextSerialCom("/dev/ttyACM0", B9600));
+    TC->setTermination("\r\n");
+    TC->init();
 
-  std::shared_ptr<I2CCom> i2c(new I2CDevComuino(0x44, TC));
-#endif // FTDI
+    std::shared_ptr<I2CCom> i2c(new I2CDevComuino(0x44, TC));
+#endif  // FTDI
 
-  std::shared_ptr<ClimateSensor> sensor=std::make_shared<SHT85>(i2c);
+    std::shared_ptr<ClimateSensor> sensor = std::make_shared<SHT85>(i2c);
 
-  for(uint32_t i=0;i<10000;i++)
-    {
-      sensor->read();
-      std::cout << sensor->temperature() << "\t" << sensor->humidity() << std::endl;
+    for (uint32_t i = 0; i < 10000; i++) {
+        sensor->read();
+        std::cout << sensor->temperature() << "\t" << sensor->humidity()
+                  << std::endl;
     }
 
-  return 0;
+    return 0;
 }
-
diff --git a/src/labRemote/module.cpp b/src/labRemote/module.cpp
old mode 100755
new mode 100644
index ae1853e0..63bd0f4c
--- a/src/labRemote/module.cpp
+++ b/src/labRemote/module.cpp
@@ -21,10 +21,10 @@ PYBIND11_MODULE(_labRemote, m) {
 
     py::module datasink = m.def_submodule("datasink");
     register_datasink(datasink);
-    
+
     py::module devcom = m.def_submodule("devcom");
     register_devcom(devcom);
-    
+
     py::module chiller = m.def_submodule("chiller");
     register_chiller(chiller);
 }
diff --git a/src/libChiller/IChiller.cpp b/src/libChiller/IChiller.cpp
index 95e8863c..0ce608b1 100644
--- a/src/libChiller/IChiller.cpp
+++ b/src/libChiller/IChiller.cpp
@@ -1,21 +1,14 @@
 #include "IChiller.h"
 
-IChiller::IChiller()
-{ }
+IChiller::IChiller() {}
 
-IChiller::~IChiller()
-{ }
+IChiller::~IChiller() {}
 
 void IChiller::setCom(std::shared_ptr<ICom> com) {
-    if(!com->is_open()) com->init();
+    if (!com->is_open()) com->init();
     m_com = com;
 }
 
+float IChiller::ctof(float t) { return (t * 9.0 / 5.0) + 32.0; }
 
-float IChiller::ctof(float t) {
-    return (t*9.0/5.0)+32.0;
-}
-
-float IChiller::ftoc(float t) {
-    return (t-32.0)*5.0/9.0;
-}
+float IChiller::ftoc(float t) { return (t - 32.0) * 5.0 / 9.0; }
diff --git a/src/libChiller/IChiller.h b/src/libChiller/IChiller.h
index 5ff07dce..cf99afbe 100644
--- a/src/libChiller/IChiller.h
+++ b/src/libChiller/IChiller.h
@@ -1,9 +1,9 @@
 #ifndef CHILLER_H
 #define CHILLER_H
 
-#include <string>
 #include <memory>
 #include <stdexcept>
+#include <string>
 
 #include "ICom.h"
 
@@ -11,49 +11,47 @@
 /**
  * All classes that inherit from this class have Python bindings.
  */
-class IChiller
-{
-public:
-  IChiller();
-  virtual ~IChiller();
-
-  //! Initialize the chiller and the interface
-  virtual void init()=0;
-  //! Set the communication object
-  /**
-   * 
-   * The object is initialized if not already.
-   * 
-   * \param com ICom instance for communicating with the chiller
-   */
-  void setCom(std::shared_ptr<ICom> com);
-  //! Turn the chiller on
-  virtual void turnOn()=0;
-  //! Turn the chiller off
-  virtual void turnOff()=0;
-  //! Set the target temperature of the chiller
-  /**
-   * \param temp The target temperature in Celsius
-   */ 
-  virtual void setTargetTemperature(float temp)=0;
-  //! Return the temperature that the chiller is set to in Celsius
-  virtual float getTargetTemperature()=0;
-  //! Return the current temperature of the chiller in Celsius
-  virtual float measureTemperature()=0;
-  //! Get the status of the chiller
-  /*
-   * \return true if chiller is on and working properly, and false otherwise
-   */ 
-  virtual bool getStatus()=0;
-
-protected:
-  std::shared_ptr<ICom> m_com; 
-
-  //! Convert Celcius to Fahrenheit
-  float ctof(float t);
-  //! Convert Fahrenheit to Celcius
-  float ftoc(float t);
-
+class IChiller {
+ public:
+    IChiller();
+    virtual ~IChiller();
+
+    //! Initialize the chiller and the interface
+    virtual void init() = 0;
+    //! Set the communication object
+    /**
+     *
+     * The object is initialized if not already.
+     *
+     * \param com ICom instance for communicating with the chiller
+     */
+    void setCom(std::shared_ptr<ICom> com);
+    //! Turn the chiller on
+    virtual void turnOn() = 0;
+    //! Turn the chiller off
+    virtual void turnOff() = 0;
+    //! Set the target temperature of the chiller
+    /**
+     * \param temp The target temperature in Celsius
+     */
+    virtual void setTargetTemperature(float temp) = 0;
+    //! Return the temperature that the chiller is set to in Celsius
+    virtual float getTargetTemperature() = 0;
+    //! Return the current temperature of the chiller in Celsius
+    virtual float measureTemperature() = 0;
+    //! Get the status of the chiller
+    /*
+     * \return true if chiller is on and working properly, and false otherwise
+     */
+    virtual bool getStatus() = 0;
+
+ protected:
+    std::shared_ptr<ICom> m_com;
+
+    //! Convert Celcius to Fahrenheit
+    float ctof(float t);
+    //! Convert Fahrenheit to Celcius
+    float ftoc(float t);
 };
 
 #endif
diff --git a/src/libChiller/PolySciLM.cpp b/src/libChiller/PolySciLM.cpp
index c9d932dc..b4dd412b 100644
--- a/src/libChiller/PolySciLM.cpp
+++ b/src/libChiller/PolySciLM.cpp
@@ -1,98 +1,97 @@
 #include "PolySciLM.h"
 
-PolySciLM::PolySciLM() : m_convert(false)
-{ }
+PolySciLM::PolySciLM() : m_convert(false) {}
 
-PolySciLM::~PolySciLM() 
-{ }
+PolySciLM::~PolySciLM() {}
 
-void PolySciLM::init() {
-    m_convert=!getTemperatureUnit();
-}
+void PolySciLM::init() { m_convert = !getTemperatureUnit(); }
 
 void PolySciLM::command(const std::string& cmd) {
-    std::string response=m_com->sendreceive(cmd);
-    if(response=="!") return;
-    else if(response=="?") {
-        logger(logDEBUG) << __PRETTY_FUNCTION__ << 
-          "-> Error in chiller on executing command '" << 
-          cmd << "'";
+    std::string response = m_com->sendreceive(cmd);
+    if (response == "!") {
+        return;
+    } else if (response == "?") {
+        logger(logDEBUG) << __PRETTY_FUNCTION__
+                         << "-> Error in chiller on executing command '" << cmd
+                         << "'";
         throw std::runtime_error("Error in chiller");
-    }
-    else {
-        logger(logDEBUG) << __PRETTY_FUNCTION__ <<
-          "-> Chiller returned unexpected response to command '" <<
-          cmd << "'";
+    } else {
+        logger(logDEBUG)
+            << __PRETTY_FUNCTION__
+            << "-> Chiller returned unexpected response to command '" << cmd
+            << "'";
         throw std::runtime_error("Unexpected response from chiller");
     }
 }
 
-void PolySciLM::turnOn() {
-    command("SO1");
-}
+void PolySciLM::turnOn() { command("SO1"); }
 
-void PolySciLM::turnOff() {
-    command("SO0");
-}
+void PolySciLM::turnOff() { command("SO0"); }
 
 void PolySciLM::setTargetTemperature(float temp) {
-    std::string cmd="SS";
-    if(m_convert) temp=ctof(temp);
+    std::string cmd = "SS";
+    if (m_convert) temp = ctof(temp);
     cmd.append(std::to_string(temp));
     command(cmd);
 }
 
 float PolySciLM::getTargetTemperature() {
-    std::string response=m_com->sendreceive("RS");
+    std::string response = m_com->sendreceive("RS");
     float temp;
-    if(response.substr(0,1)=="+") temp=std::stof(response.substr(1));
-    else if(response.substr(0,1)=="-") temp=-std::stof(response.substr(1));
-    else {
-        logger(logDEBUG) << __PRETTY_FUNCTION__ << 
-          " -> Unexpected response: " << response;
+    if (response.substr(0, 1) == "+") {
+        temp = std::stof(response.substr(1));
+    } else if (response.substr(0, 1) == "-") {
+        temp = -std::stof(response.substr(1));
+    } else {
+        logger(logDEBUG) << __PRETTY_FUNCTION__
+                         << " -> Unexpected response: " << response;
         throw std::runtime_error("Unexpected response from chiller");
     }
-    if(m_convert) temp=ftoc(temp);
+    if (m_convert) temp = ftoc(temp);
     return temp;
 }
 
 float PolySciLM::measureTemperature() {
-    std::string response=m_com->sendreceive("RT");
+    std::string response = m_com->sendreceive("RT");
     float temp;
-    if(response.substr(0,1)=="+") temp=std::stof(response.substr(1));
-    else if(response.substr(0,1)=="-") temp=-std::stof(response.substr(1));
-    else {
-        logger(logDEBUG) << __PRETTY_FUNCTION__ << 
-          " -> Unexpected response: " << response;
+    if (response.substr(0, 1) == "+") {
+        temp = std::stof(response.substr(1));
+    } else if (response.substr(0, 1) == "-") {
+        temp = -std::stof(response.substr(1));
+    } else {
+        logger(logDEBUG) << __PRETTY_FUNCTION__
+                         << " -> Unexpected response: " << response;
         throw std::runtime_error("Unexpected response from chiller");
     }
-    if(m_convert) temp=ftoc(temp);
+    if (m_convert) temp = ftoc(temp);
     return temp;
 }
 
 bool PolySciLM::getStatus() {
-    std::string response=m_com->sendreceive("RW");
-    if(response=="1") return true;
-    else if(response=="0") return false;
-    else {
-        logger(logDEBUG) << __PRETTY_FUNCTION__ << 
-          " -> Unexpected response: " << response;
+    std::string response = m_com->sendreceive("RW");
+    if (response == "1") {
+        return true;
+    } else if (response == "0") {
+        return false;
+    } else {
+        logger(logDEBUG) << __PRETTY_FUNCTION__
+                         << " -> Unexpected response: " << response;
         throw std::runtime_error("Unexpected response from chiller");
         return false;
     }
 }
 
-std::string PolySciLM::getFaultStatus() {
-    return m_com->sendreceive("RF");
-}
+std::string PolySciLM::getFaultStatus() { return m_com->sendreceive("RF"); }
 
 bool PolySciLM::getTemperatureUnit() {
-    std::string response=m_com->sendreceive("RU");
-    if(response=="C") return true;
-    else if(response=="F") return false;
-    else {
-        logger(logDEBUG) << __PRETTY_FUNCTION__ << 
-          " -> Unexpected response: " << response;
+    std::string response = m_com->sendreceive("RU");
+    if (response == "C") {
+        return true;
+    } else if (response == "F") {
+        return false;
+    } else {
+        logger(logDEBUG) << __PRETTY_FUNCTION__
+                         << " -> Unexpected response: " << response;
         throw std::runtime_error("Unexpected response from chiller");
     }
 }
diff --git a/src/libChiller/PolySciLM.h b/src/libChiller/PolySciLM.h
index 2d1365b7..11e8977c 100644
--- a/src/libChiller/PolySciLM.h
+++ b/src/libChiller/PolySciLM.h
@@ -1,24 +1,24 @@
 #ifndef POLYSCILM_H
 #define POLYSCILM_H
 
-#include <string>
-#include <stdexcept>
 #include <memory>
+#include <stdexcept>
+#include <string>
 
+#include "IChiller.h"
 #include "Logger.h"
 #include "TextSerialCom.h"
-#include "IChiller.h"
 
 //! \brief Object to interface with a PolyScience LM series chiller
 /**
- * The TextSerialCom passed to this object should already be 
- * initialized, be set to the same baud rate as the chiller, 
+ * The TextSerialCom passed to this object should already be
+ * initialized, be set to the same baud rate as the chiller,
  * and have the termination set to "\r".
  *
  * # Example
  *
  * ```
- * std::shared_ptr<TextSerialCom> com = 
+ * std::shared_ptr<TextSerialCom> com =
  *   std::make_shared<TextSerialCom>("/dev/ttyUSB0",B9600);
  * com->setTermination("\r");
  * com->init();
@@ -29,57 +29,56 @@
  * chiller.setSetTemperature(15.0);
  * ```
  *
- * The operator's manual for these chillers can be found at 
+ * The operator's manual for these chillers can be found at
  * https://www.polyscience.com/chillers/lm-series-benchtop-chiller-centrifugal-pump-0
  */
-class PolySciLM : public IChiller
-{
-public:
-  /**
-   * \param com The serial communication interface connected
-   *   to the chiller
-   */ 
-  PolySciLM();
-  ~PolySciLM();
+class PolySciLM : public IChiller {
+ public:
+    /**
+     * \param com The serial communication interface connected
+     *   to the chiller
+     */
+    PolySciLM();
+    ~PolySciLM();
+
+    //! Initialize the serial communication channel
+    void init();
+    //! Turn the chiller on
+    void turnOn();
+    //! Turn the chiller off
+    void turnOff();
+    //! Set the target temperature of the chiller
+    /**
+     * \param temp The target temperature in Celsius
+     */
+    void setTargetTemperature(float temp);
+    //! Return the temperature that the chiller is set to in Celsius
+    float getTargetTemperature();
+    //! Return the current temperature of the chiller in Celsius
+    float measureTemperature();
+    //! Get the status of the chiller
+    /**
+     * \return true if chiller is in "run" mode, and false if
+     *   it's in "standby" mode
+     */
+    bool getStatus();
+    //! Returns error fault codes
+    /**
+     * \return "00" if system OK, and an error code otherwise
+     */
+    std::string getFaultStatus();
 
-  //! Initialize the serial communication channel
-  void init();
-  //! Turn the chiller on
-  void turnOn();
-  //! Turn the chiller off
-  void turnOff();
-  //! Set the target temperature of the chiller
-  /**
-   * \param temp The target temperature in Celsius
-   */
-  void setTargetTemperature(float temp);
-  //! Return the temperature that the chiller is set to in Celsius
-  float getTargetTemperature();
-  //! Return the current temperature of the chiller in Celsius
-  float measureTemperature();
-  //! Get the status of the chiller
-  /**
-   * \return true if chiller is in "run" mode, and false if 
-   *   it's in "standby" mode
-   */
-  bool getStatus();
-  //! Returns error fault codes
-  /**
-   * \return "00" if system OK, and an error code otherwise
-   */ 
-  std::string getFaultStatus();
+ private:
+    //! True if conversion is necessary, false otherwise
+    bool m_convert;
 
-private:
-  //! True if conversion is necessary, false otherwise
-  bool m_convert;
-  
-  //! Send a command to the chiller
-  void command(const std::string& cmd);
-  //! Get the temperature units used by the chiller
-  /**
-  * \return true for Celsius and false for Fahrenheit
-  */
-  bool getTemperatureUnit();
+    //! Send a command to the chiller
+    void command(const std::string& cmd);
+    //! Get the temperature units used by the chiller
+    /**
+     * \return true for Celsius and false for Fahrenheit
+     */
+    bool getTemperatureUnit();
 };
 
 #endif
diff --git a/src/libChiller/python.cpp b/src/libChiller/python.cpp
index 7a7886a8..b3c5a011 100644
--- a/src/libChiller/python.cpp
+++ b/src/libChiller/python.cpp
@@ -7,87 +7,54 @@
 namespace py = pybind11;
 
 class PyIChiller : public IChiller {
-public:
-  using IChiller::IChiller;
+ public:
+    using IChiller::IChiller;
 
-  void init() override {
-    PYBIND11_OVERLOAD_PURE(
-      void,
-      IChiller,
-      init,
-    );
-  }
+    void init() override { PYBIND11_OVERLOAD_PURE(void, IChiller, init, ); }
 
-  void turnOn() override {
-    PYBIND11_OVERLOAD_PURE(
-      void,
-      IChiller,
-      turnOn,
-    );
-  }
- 
-  void turnOff() override {
-    PYBIND11_OVERLOAD_PURE(
-      void,
-      IChiller,
-      turnOff,
-    );
-  }
-  
-  void setTargetTemperature(float temp) override {
-    PYBIND11_OVERLOAD_PURE(
-      void,
-      IChiller,
-      setTargetTemperature,
-      temp
-    );
-  }
+    void turnOn() override { PYBIND11_OVERLOAD_PURE(void, IChiller, turnOn, ); }
 
-  float getTargetTemperature() override {
-    PYBIND11_OVERLOAD_PURE(
-      float,
-      IChiller,
-      getTargetTemperature,
-    );
-  }
+    void turnOff() override {
+        PYBIND11_OVERLOAD_PURE(void, IChiller, turnOff, );
+    }
 
-  float measureTemperature() override {
-    PYBIND11_OVERLOAD_PURE(
-      float,
-      IChiller,
-      measureTemperature,
-    );
-  }
+    void setTargetTemperature(float temp) override {
+        PYBIND11_OVERLOAD_PURE(void, IChiller, setTargetTemperature, temp);
+    }
 
-  bool getStatus() override {
-    PYBIND11_OVERLOAD_PURE(
-      bool,
-      IChiller,
-      getStatus,
-    );
-  }
+    float getTargetTemperature() override {
+        PYBIND11_OVERLOAD_PURE(float, IChiller, getTargetTemperature, );
+    }
+
+    float measureTemperature() override {
+        PYBIND11_OVERLOAD_PURE(float, IChiller, measureTemperature, );
+    }
+
+    bool getStatus() override {
+        PYBIND11_OVERLOAD_PURE(bool, IChiller, getStatus, );
+    }
 };
 
 void register_chiller(py::module& m) {
-  py::class_<IChiller, PyIChiller, std::shared_ptr<IChiller>>(m, "IChiller")
-    .def(py::init<>())
-    .def("init", &IChiller::init)
-    .def("setCom", &IChiller::setCom)
-    .def("turnOn", &IChiller::turnOn)
-    .def("turnOff", &IChiller::turnOff)
-    .def("setTargetTemperature", &IChiller::setTargetTemperature)
-    .def("getTargetTemperature", &IChiller::getTargetTemperature)
-    .def("measureTemperature", &IChiller::measureTemperature)
-    .def("getStatus", &IChiller::getStatus);
-
-  py::class_<PolySciLM, IChiller, std::shared_ptr<PolySciLM>>(m, "PolySciLM")
-    .def(py::init<>())
-    .def("init", &PolySciLM::init)
-    .def("turnOn", &PolySciLM::turnOn)
-    .def("turnOff", &PolySciLM::turnOff)
-    .def("setTargetTemperature", &PolySciLM::setTargetTemperature)
-    .def("getTargetTemperature", &PolySciLM::getTargetTemperature)
-    .def("measureTemperature", &PolySciLM::measureTemperature)
-    .def("getStatus", &PolySciLM::getStatus)
-    .def("getFaultStatus", &PolySciLM::getFaultStatus);
+    py::class_<IChiller, PyIChiller, std::shared_ptr<IChiller>>(m, "IChiller")
+        .def(py::init<>())
+        .def("init", &IChiller::init)
+        .def("setCom", &IChiller::setCom)
+        .def("turnOn", &IChiller::turnOn)
+        .def("turnOff", &IChiller::turnOff)
+        .def("setTargetTemperature", &IChiller::setTargetTemperature)
+        .def("getTargetTemperature", &IChiller::getTargetTemperature)
+        .def("measureTemperature", &IChiller::measureTemperature)
+        .def("getStatus", &IChiller::getStatus);
+
+    py::class_<PolySciLM, IChiller, std::shared_ptr<PolySciLM>>(m, "PolySciLM")
+        .def(py::init<>())
+        .def("init", &PolySciLM::init)
+        .def("turnOn", &PolySciLM::turnOn)
+        .def("turnOff", &PolySciLM::turnOff)
+        .def("setTargetTemperature", &PolySciLM::setTargetTemperature)
+        .def("getTargetTemperature", &PolySciLM::getTargetTemperature)
+        .def("measureTemperature", &PolySciLM::measureTemperature)
+        .def("getStatus", &PolySciLM::getStatus)
+        .def("getFaultStatus", &PolySciLM::getFaultStatus);
 }
diff --git a/src/libCom/CharDeviceCom.cpp b/src/libCom/CharDeviceCom.cpp
old mode 100755
new mode 100644
index c8d12a3b..c0ab7a13
--- a/src/libCom/CharDeviceCom.cpp
+++ b/src/libCom/CharDeviceCom.cpp
@@ -1,127 +1,114 @@
 #include "CharDeviceCom.h"
-#include "Logger.h"
 
 #include <fcntl.h>
-#include <unistd.h>
 #include <sys/file.h>
+#include <unistd.h>
 
 #include <cerrno>
 #include <cstring>
 #include <stdexcept>
 
-//Register com
+#include "Logger.h"
+
+// Register com
 #include "ComRegistry.h"
 REGISTER_COM(CharDeviceCom)
 
-CharDeviceCom::CharDeviceCom(const std::string& port)
-  : m_port(port)
-{ }
+CharDeviceCom::CharDeviceCom(const std::string &port) : m_port(port) {}
 
-CharDeviceCom::CharDeviceCom()
-{ }
+CharDeviceCom::CharDeviceCom() {}
 
-CharDeviceCom::~CharDeviceCom()
-{ if(m_dev) close(m_dev); }
+CharDeviceCom::~CharDeviceCom() {
+    if (m_dev) close(m_dev);
+}
 
-void CharDeviceCom::init()
-{
-  if(is_open()) return;
+void CharDeviceCom::init() {
+    if (is_open()) return;
 
-  if(m_port.empty())
-    throw std::runtime_error("CharDeviceCom::init requires a device name");
+    if (m_port.empty())
+        throw std::runtime_error("CharDeviceCom::init requires a device name");
 
-  m_dev = open(m_port.c_str(), O_RDWR | O_NOCTTY);
-  m_good = true;
+    m_dev = open(m_port.c_str(), O_RDWR | O_NOCTTY);
+    m_good = true;
 }
 
-void CharDeviceCom::send(const std::string& buf)
-{
-  lock();
-  int n_write = ::write(m_dev, buf.c_str(), buf.size());
-  unlock();
+void CharDeviceCom::send(const std::string &buf) {
+    lock();
+    int n_write = ::write(m_dev, buf.c_str(), buf.size());
+    unlock();
 
-  if(n_write<0)
-    throw std::runtime_error("Error writing to "+m_port+": "+std::strerror(errno));
+    if (n_write < 0)
+        throw std::runtime_error("Error writing to " + m_port + ": " +
+                                 std::strerror(errno));
 }
 
-void CharDeviceCom::send(char *buf, size_t length)
-{
-  lock();
-  int n_write = ::write(m_dev, buf, length);
-  unlock();
+void CharDeviceCom::send(char *buf, size_t length) {
+    lock();
+    int n_write = ::write(m_dev, buf, length);
+    unlock();
 
-  if(n_write<0)
-    throw std::runtime_error("Error writing to "+m_port+": "+std::strerror(errno));
+    if (n_write < 0)
+        throw std::runtime_error("Error writing to " + m_port + ": " +
+                                 std::strerror(errno));
 }
 
-std::string CharDeviceCom::receive()
-{
-  lock();
-  int n_read = ::read(m_dev, m_tmpbuf, MAX_READ);
-  unlock();
+std::string CharDeviceCom::receive() {
+    lock();
+    int n_read = ::read(m_dev, m_tmpbuf, MAX_READ);
+    unlock();
 
-  if(n_read>=0)
-    return std::string(m_tmpbuf, n_read);
-  else
-    throw std::runtime_error("Error reading from "+m_port+": "+std::strerror(errno));
+    if (n_read >= 0)
+        return std::string(m_tmpbuf, n_read);
+    else
+        throw std::runtime_error("Error reading from " + m_port + ": " +
+                                 std::strerror(errno));
 }
 
-uint32_t CharDeviceCom::receive(char *buf, size_t length)
-{
-  lock();
-  int n_read = ::read(m_dev, buf, length);
-  unlock();
+uint32_t CharDeviceCom::receive(char *buf, size_t length) {
+    lock();
+    int n_read = ::read(m_dev, buf, length);
+    unlock();
 
-  if(n_read<0)
-    throw std::runtime_error("Error reading from "+m_port+": "+std::strerror(errno));
+    if (n_read < 0)
+        throw std::runtime_error("Error reading from " + m_port + ": " +
+                                 std::strerror(errno));
 
-  return n_read;
+    return n_read;
 }
 
-std::string CharDeviceCom::sendreceive(const std::string& cmd)
-{
-  lock();
-  send(cmd);
-  std::string ret=receive();
-  unlock();
+std::string CharDeviceCom::sendreceive(const std::string &cmd) {
+    lock();
+    send(cmd);
+    std::string ret = receive();
+    unlock();
 
-  return ret;
+    return ret;
 }
 
-void CharDeviceCom::sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength)
-{
-  lock();
-  send(wbuf, wlength);
-  receive (rbuf, rlength);
-  unlock();
+void CharDeviceCom::sendreceive(char *wbuf, size_t wlength, char *rbuf,
+                                size_t rlength) {
+    lock();
+    send(wbuf, wlength);
+    receive(rbuf, rlength);
+    unlock();
 }
 
-void CharDeviceCom::lock()
-{
-  flock(m_dev, LOCK_EX);
-  m_lock_counter++;
-} 
-
-void CharDeviceCom::unlock()
-{
-  if(m_lock_counter==0) return; // No lock exists
-
-  m_lock_counter--;
-  if(m_lock_counter==0)
-    flock(m_dev, LOCK_UN);
-} 
-
-void CharDeviceCom::setConfiguration(const nlohmann::json& config)
-{
-  for (const auto &kv : config.items())
-    {
-      if(kv.key()=="port")
-	{
-	  m_port=kv.value();
-	}
-    }
+void CharDeviceCom::lock() {
+    flock(m_dev, LOCK_EX);
+    m_lock_counter++;
 }
 
-  
+void CharDeviceCom::unlock() {
+    if (m_lock_counter == 0) return;  // No lock exists
 
+    m_lock_counter--;
+    if (m_lock_counter == 0) flock(m_dev, LOCK_UN);
+}
 
+void CharDeviceCom::setConfiguration(const nlohmann::json &config) {
+    for (const auto &kv : config.items()) {
+        if (kv.key() == "port") {
+            m_port = kv.value();
+        }
+    }
+}
diff --git a/src/libCom/CharDeviceCom.h b/src/libCom/CharDeviceCom.h
old mode 100755
new mode 100644
index f98dc003..3e6c7de5
--- a/src/libCom/CharDeviceCom.h
+++ b/src/libCom/CharDeviceCom.h
@@ -1,144 +1,144 @@
 #ifndef CHARDEVICECOM_H
 #define CHARDEVICECOM_H
 
-#include <unordered_map>
-#include <string>
 #include <termios.h>
 
+#include <string>
+#include <unordered_map>
+
 #include "ICom.h"
 
-/** 
+/**
  * Implementation of communication via a character device.
  */
-class CharDeviceCom : public ICom
-{
-public:
-  /** \brief Create communication object and set settings
-   * @param port Device corresponding to the character device
-   */
-  CharDeviceCom(const std::string& port);
-  CharDeviceCom();
-
-  ~CharDeviceCom();
-
-  /** Open device and configure
-   */
-  virtual void init();
-
-  /** \brief Configure on JSON object
-   *
-   * Valid keys:
-   *  - `device`: Path to character device
-   *
-   * \param config JSON configuration
-   */
-  virtual void setConfiguration(const nlohmann::json& config);
-
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   * \param length Number of characters in `buf` that should be sent
-   */  
-  virtual void send(char *buf, size_t length);
-
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   */
-  virtual void send(const std::string& buf);
-
-  /** Read data from device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \return Received data
-   */  
-  virtual std::string receive();
-
-  /** Read data from device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Buffer where to store results 
-   * \param length Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  virtual uint32_t receive(char *buf, size_t length);
-
-  /** Write data to device and receive reply
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param cmd Data to be sent
-   *
-   * \return Returned data
-   */
-  virtual std::string sendreceive(const std::string& cmd);
-
-  /** Write data to device and receive reply
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param wbuf Data to be sent
-   * \param wlength Number of characters in `wbuf` that should be sent
-   * \param rbuf Buffer where to store results 
-   * \param rlength Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  virtual void sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength);
-  
-  /** Request exlusive access to device.
-   *
-   * If a single hardware bus is used to connect multiple devices,
-   * the access to all of them should be locked to remove changes
-   * of cross-talk.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   */  
-  virtual void lock();
-
-  /** Release exlusive access to device.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   */  
-  virtual void unlock();
-
-private:
-
-  /** \brief Configure device for serial communication
-   */
-  void config();
-
-  /** Configuration @{ */
-
-  /// Name of device
-  std::string m_port;
-
-  /** @} */
-
-  /** Run-time variables @{ */
-
-  //! File handle for communication
-  int m_dev =0;
-
-  //! Count number of lock() calls on this device
-  uint32_t m_lock_counter = 0;
-
-  /** @} */
-
-  //! Maximum number of characters to read using string buffers
-  static const unsigned MAX_READ = 4096;
-
-  //! Temporary buffer for ::read()
-  char m_tmpbuf[MAX_READ];
+class CharDeviceCom : public ICom {
+ public:
+    /** \brief Create communication object and set settings
+     * @param port Device corresponding to the character device
+     */
+    CharDeviceCom(const std::string& port);
+    CharDeviceCom();
+
+    ~CharDeviceCom();
+
+    /** Open device and configure
+     */
+    virtual void init();
+
+    /** \brief Configure on JSON object
+     *
+     * Valid keys:
+     *  - `device`: Path to character device
+     *
+     * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json& config);
+
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     * \param length Number of characters in `buf` that should be sent
+     */
+    virtual void send(char* buf, size_t length);
+
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     */
+    virtual void send(const std::string& buf);
+
+    /** Read data from device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \return Received data
+     */
+    virtual std::string receive();
+
+    /** Read data from device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Buffer where to store results
+     * \param length Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    virtual uint32_t receive(char* buf, size_t length);
+
+    /** Write data to device and receive reply
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param cmd Data to be sent
+     *
+     * \return Returned data
+     */
+    virtual std::string sendreceive(const std::string& cmd);
+
+    /** Write data to device and receive reply
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param wbuf Data to be sent
+     * \param wlength Number of characters in `wbuf` that should be sent
+     * \param rbuf Buffer where to store results
+     * \param rlength Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    virtual void sendreceive(char* wbuf, size_t wlength, char* rbuf,
+                             size_t rlength);
+
+    /** Request exlusive access to device.
+     *
+     * If a single hardware bus is used to connect multiple devices,
+     * the access to all of them should be locked to remove changes
+     * of cross-talk.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     */
+    virtual void lock();
+
+    /** Release exlusive access to device.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     */
+    virtual void unlock();
+
+ private:
+    /** \brief Configure device for serial communication
+     */
+    void config();
+
+    /** Configuration @{ */
+
+    /// Name of device
+    std::string m_port;
+
+    /** @} */
+
+    /** Run-time variables @{ */
+
+    //! File handle for communication
+    int m_dev = 0;
+
+    //! Count number of lock() calls on this device
+    uint32_t m_lock_counter = 0;
+
+    /** @} */
+
+    //! Maximum number of characters to read using string buffers
+    static const unsigned MAX_READ = 4096;
+
+    //! Temporary buffer for ::read()
+    char m_tmpbuf[MAX_READ];
 };
 
 #endif
diff --git a/src/libCom/ComRegistry.cpp b/src/libCom/ComRegistry.cpp
index 86ca92f7..3d82fbf6 100644
--- a/src/libCom/ComRegistry.cpp
+++ b/src/libCom/ComRegistry.cpp
@@ -2,35 +2,28 @@
 
 #include <iostream>
 
-namespace EquipRegistry
-{
+namespace EquipRegistry {
 
-  typedef ClassRegistry<ICom> RegistryCom;
+typedef ClassRegistry<ICom> RegistryCom;
 
-  static RegistryCom &registry()
-  {
+static RegistryCom& registry() {
     static RegistryCom instance;
     return instance;
-  }
+}
 
-  bool registerCom(const std::string& model, std::function<std::shared_ptr<ICom>()> f)
-  {
+bool registerCom(const std::string& model,
+                 std::function<std::shared_ptr<ICom>()> f) {
     return registry().registerClass(model, f);
-  }
-  
-  std::shared_ptr<ICom> createCom(const std::string& model)
-  {
+}
+
+std::shared_ptr<ICom> createCom(const std::string& model) {
     auto result = registry().makeClass(model);
-    if(result == nullptr)
-      std::cout << "No communication (ICom) of type " << model << " found\n";
+    if (result == nullptr)
+        std::cout << "No communication (ICom) of type " << model << " found\n";
 
     return result;
-  }
-  
-  std::vector<std::string> listCom()
-  {
-    return registry().listClasses();
-  }
-
 }
 
+std::vector<std::string> listCom() { return registry().listClasses(); }
+
+}  // namespace EquipRegistry
diff --git a/src/libCom/ComRegistry.h b/src/libCom/ComRegistry.h
index b57a5846..fb8f9af8 100644
--- a/src/libCom/ComRegistry.h
+++ b/src/libCom/ComRegistry.h
@@ -1,26 +1,25 @@
-#include "ClassRegistry.h"
-#include "ICom.h"
-
+#include <functional>
+#include <memory>
 #include <string>
 #include <vector>
-#include <memory>
-#include <functional>
+
+#include "ClassRegistry.h"
+#include "ICom.h"
 
 // Configuration helpers and registry for specific Com implementations
-namespace EquipRegistry
-{
-  /** Register new Com type into registry */
-  bool registerCom(const std::string& model,
-		   std::function<std::shared_ptr<ICom>()> f);
+namespace EquipRegistry {
+/** Register new Com type into registry */
+bool registerCom(const std::string& model,
+                 std::function<std::shared_ptr<ICom>()> f);
 
-  /** Get new instance of given power supply type */
-  std::shared_ptr<ICom> createCom(const std::string& model);
+/** Get new instance of given power supply type */
+std::shared_ptr<ICom> createCom(const std::string& model);
 
-  /** List available Com types */
-  std::vector<std::string> listCom();  
-}
+/** List available Com types */
+std::vector<std::string> listCom();
+}  // namespace EquipRegistry
 
-#define REGISTER_COM(model)						\
-  static bool _registered_##model =					\
-    EquipRegistry::registerCom(#model,					\
-			       std::function<std::shared_ptr<ICom>()>([]() { return std::make_shared<model>(); }));
+#define REGISTER_COM(model)                                       \
+    static bool _registered_##model = EquipRegistry::registerCom( \
+        #model, std::function<std::shared_ptr<ICom>()>(           \
+                    []() { return std::make_shared<model>(); }));
diff --git a/src/libCom/GPIBNICom.cpp b/src/libCom/GPIBNICom.cpp
index c428c98e..42560874 100644
--- a/src/libCom/GPIBNICom.cpp
+++ b/src/libCom/GPIBNICom.cpp
@@ -1,156 +1,159 @@
 #include <GPIBNICom.h>
 #include <gpib/ib.h>
-#include <string>
-#include <fstream>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #include <unistd.h>
 
+#include <fstream>
+#include <string>
+
 #include "Logger.h"
 
-//Register com
+// Register com
 #include "ComRegistry.h"
 REGISTER_COM(GPIBNICom)
 
-GPIBNICom::GPIBNICom(uint16_t board_id, uint16_t gpib_addr, uint16_t gpib_saddr) : ICom() {
-  m_good = false;
-  m_gpib_board = board_id;
-  m_gpib_addr = gpib_addr;
-  m_gpib_saddr = gpib_saddr;
-  m_read_tmo = T10s;
+GPIBNICom::GPIBNICom(uint16_t board_id, uint16_t gpib_addr, uint16_t gpib_saddr)
+    : ICom() {
+    m_good = false;
+    m_gpib_board = board_id;
+    m_gpib_addr = gpib_addr;
+    m_gpib_saddr = gpib_saddr;
+    m_read_tmo = T10s;
 }
 GPIBNICom::GPIBNICom() : ICom() {
-  m_good = false;
-  m_gpib_addr = 0;
-  m_gpib_saddr = 0;
-  m_gpib_board = 0;
-  m_read_tmo = T10s;
+    m_good = false;
+    m_gpib_addr = 0;
+    m_gpib_saddr = 0;
+    m_gpib_board = 0;
+    m_read_tmo = T10s;
 }
 GPIBNICom::~GPIBNICom() {
-  if(m_good){
-    lock();
-    ibclr(m_device);
-    ibonl(m_device, 0);
-    unlock();
-  }
+    if (m_good) {
+        lock();
+        ibclr(m_device);
+        ibonl(m_device, 0);
+        unlock();
+    }
 }
 void GPIBNICom::init() {
-  m_device = ibdev(m_gpib_board, m_gpib_addr, m_gpib_saddr, m_read_tmo, 1, 0x0000);
-  if (ibsta & ERR) {
-    logger(logERROR) << "ERROR initialising GPIB: ";
-    procGPIBErr();
-    throw std::runtime_error("GPIBNICom::init() returned error from ibdev");
-  } else
-    m_good = true;
-}
-void GPIBNICom::setConfiguration(const nlohmann::json& config) {
-  for (const auto &kv : config.items())  {
-    if(kv.key()=="gpib_addr") {
-      m_gpib_addr = kv.value();
-    }
-    else if(kv.key()=="gpib_saddr") {
-      m_gpib_saddr = kv.value();
-    }
-    else if(kv.key()=="gpib_board") {
-      m_gpib_board = kv.value();
+    m_device =
+        ibdev(m_gpib_board, m_gpib_addr, m_gpib_saddr, m_read_tmo, 1, 0x0000);
+    if (ibsta & ERR) {
+        logger(logERROR) << "ERROR initialising GPIB: ";
+        procGPIBErr();
+        throw std::runtime_error("GPIBNICom::init() returned error from ibdev");
+    } else {
+        m_good = true;
     }
-    else if(kv.key()=="read_tmo") {
-      m_read_tmo = kv.value();
+}
+void GPIBNICom::setConfiguration(const nlohmann::json &config) {
+    for (const auto &kv : config.items()) {
+        if (kv.key() == "gpib_addr") {
+            m_gpib_addr = kv.value();
+        } else if (kv.key() == "gpib_saddr") {
+            m_gpib_saddr = kv.value();
+        } else if (kv.key() == "gpib_board") {
+            m_gpib_board = kv.value();
+        } else if (kv.key() == "read_tmo") {
+            m_read_tmo = kv.value();
+        }
     }
-  }
 }
 void GPIBNICom::send(char *buf, size_t length) {
-  if(!m_good) throw std::runtime_error("GPIBNICom::send(char*,size_t) : device in bad state!");
+    if (!m_good)
+        throw std::runtime_error(
+            "GPIBNICom::send(char*,size_t) : device in bad state!");
 
-  lock();
-  ibwrt(m_device, buf, length);
-  unlock();
-  if (ibsta & ERR) {
-    logger(logERROR) << "ERROR from ibwrt: ";
-    procGPIBErr();
-    throw std::runtime_error("GPIBNICom::send error from ibwrt");
-  }
+    lock();
+    ibwrt(m_device, buf, length);
+    unlock();
+    if (ibsta & ERR) {
+        logger(logERROR) << "ERROR from ibwrt: ";
+        procGPIBErr();
+        throw std::runtime_error("GPIBNICom::send error from ibwrt");
+    }
 }
-void GPIBNICom::send(const std::string& buf) {
-  char *mybuf = new char[buf.length()];
-  strcpy(mybuf, buf.c_str());
-  send(mybuf, buf.length());
-  delete[] mybuf;
+void GPIBNICom::send(const std::string &buf) {
+    char *mybuf = new char[buf.length()];
+    strcpy(mybuf, buf.c_str());
+    send(mybuf, buf.length());
+    delete[] mybuf;
 }
 std::string GPIBNICom::receive() {
-  std::string retstr="";
-  int rdc=255;
-  char buf[256];
-  while(rdc==255){
-    rdc = receive(buf, 255);
-    retstr+=std::string(buf);
-  }
-  return retstr;
+    std::string retstr = "";
+    int rdc = 255;
+    char buf[256];
+    while (rdc == 255) {
+        rdc = receive(buf, 255);
+        retstr += std::string(buf);
+    }
+    return retstr;
 }
 uint32_t GPIBNICom::receive(char *buf, size_t length) {
-  if(!m_good) throw std::runtime_error("GPIBNICom::receive(char*,size_t) : device in bad state!");
+    if (!m_good)
+        throw std::runtime_error(
+            "GPIBNICom::receive(char*,size_t) : device in bad state!");
 
-  lock();
-  ibrd(m_device, buf, length);// returns error code, not no. char's
-  unlock();
-  int retval = strlen(buf);
-  // remove trailing '\n'
-  for(int i=0;i<=retval;i++){
-    if(buf[i] == '\n'){
-      buf[i] = '\0';
-      for(int k=i+1;k<=retval;k++) buf[k] = 0;
-      break;
+    lock();
+    ibrd(m_device, buf, length);  // returns error code, not no. char's
+    unlock();
+    int retval = strlen(buf);
+    // remove trailing '\n'
+    for (int i = 0; i <= retval; i++) {
+        if (buf[i] == '\n') {
+            buf[i] = '\0';
+            for (int k = i + 1; k <= retval; k++) buf[k] = 0;
+            break;
+        }
     }
-  }
-  if (ibsta & ERR) {
-    logger(logERROR) << "ERROR from ibrd: ";
-    procGPIBErr();
-    throw std::runtime_error("GPIBNICom::receive error from ibrd");
-  }
-  return retval;
+    if (ibsta & ERR) {
+        logger(logERROR) << "ERROR from ibrd: ";
+        procGPIBErr();
+        throw std::runtime_error("GPIBNICom::receive error from ibrd");
+    }
+    return retval;
 }
-std::string GPIBNICom::sendreceive(const std::string& cmd) {
-  lock();
-  send(cmd);
-  std::string retstr = receive();
-  unlock();
-  return retstr;
+std::string GPIBNICom::sendreceive(const std::string &cmd) {
+    lock();
+    send(cmd);
+    std::string retstr = receive();
+    unlock();
+    return retstr;
 }
-void GPIBNICom::sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength) {
-  lock();
-  send(wbuf, wlength);
-  receive (rbuf, rlength);
-  unlock();
+void GPIBNICom::sendreceive(char *wbuf, size_t wlength, char *rbuf,
+                            size_t rlength) {
+    lock();
+    send(wbuf, wlength);
+    receive(rbuf, rlength);
+    unlock();
+}
+void GPIBNICom::procGPIBErr() {
+    if (iberr == EDVR) logger(logERROR) << " EDVR <Driver Error>";
+    if (iberr == ECIC) logger(logERROR) << " ECIC <Not Controller-In-Charge>";
+    if (iberr == ENOL) logger(logERROR) << " ENOL <No Listener>";
+    if (iberr == EADR) logger(logERROR) << " EADR <Address error>";
+    if (iberr == EARG) logger(logERROR) << " EARG <Invalid argument>";
+    if (iberr == ESAC) logger(logERROR) << " ESAC <Not System Controller>";
+    if (iberr == EABO) logger(logERROR) << " EABO <Operation aborted>";
+    if (iberr == ENEB) logger(logERROR) << " ENEB <No GPIB board>";
+    if (iberr == EDMA) logger(logERROR) << " EDMA <DMA Error>";
+    if (iberr == EOIP) logger(logERROR) << " EOIP <Async I/O in progress>";
+    if (iberr == ECAP) logger(logERROR) << " ECAP <No capability>";
+    if (iberr == EFSO) logger(logERROR) << " EFSO <File system error>";
+    if (iberr == EBUS) logger(logERROR) << " EBUS <Command error>";
+    if (iberr == ESRQ) logger(logERROR) << " ESRQ <SRQ stuck on>";
+    if (iberr == ETAB) logger(logERROR) << " ETAB <Table Overflow>";
 }
-void GPIBNICom::procGPIBErr(){
-    if (iberr == EDVR) logger(logERROR) << " EDVR <Driver Error>" ;
-    if (iberr == ECIC) logger(logERROR) << " ECIC <Not Controller-In-Charge>" ;
-    if (iberr == ENOL) logger(logERROR) << " ENOL <No Listener>" ;
-    if (iberr == EADR) logger(logERROR) << " EADR <Address error>" ;
-    if (iberr == EARG) logger(logERROR) << " EARG <Invalid argument>" ;
-    if (iberr == ESAC) logger(logERROR) << " ESAC <Not System Controller>" ;
-    if (iberr == EABO) logger(logERROR) << " EABO <Operation aborted>" ;
-    if (iberr == ENEB) logger(logERROR) << " ENEB <No GPIB board>" ;
-    if (iberr == EDMA) logger(logERROR) << " EDMA <DMA Error>" ;   
-    if (iberr == EOIP) logger(logERROR) << " EOIP <Async I/O in progress>" ;
-    if (iberr == ECAP) logger(logERROR) << " ECAP <No capability>" ;
-    if (iberr == EFSO) logger(logERROR) << " EFSO <File system error>" ;
-    if (iberr == EBUS) logger(logERROR) << " EBUS <Command error>" ;
-    if (iberr == ESRQ) logger(logERROR) << " ESRQ <SRQ stuck on>" ;
-    if (iberr == ETAB) logger(logERROR) << " ETAB <Table Overflow>" ;
+void GPIBNICom::lock() {
+    flock(m_device, LOCK_EX);
+    m_lock_counter++;
 }
-void GPIBNICom::lock()
-{
-  flock(m_device, LOCK_EX);
-  m_lock_counter++;
-} 
 
-void GPIBNICom::unlock()
-{
-  if(m_lock_counter==0) return; // No lock exists
+void GPIBNICom::unlock() {
+    if (m_lock_counter == 0) return;  // No lock exists
 
-  m_lock_counter--;
-  if(m_lock_counter==0)
-    flock(m_device, LOCK_UN);
-} 
+    m_lock_counter--;
+    if (m_lock_counter == 0) flock(m_device, LOCK_UN);
+}
diff --git a/src/libCom/GPIBNICom.h b/src/libCom/GPIBNICom.h
index 0d41d089..fdfec9db 100644
--- a/src/libCom/GPIBNICom.h
+++ b/src/libCom/GPIBNICom.h
@@ -3,7 +3,7 @@
 
 #include "ICom.h"
 
-/** 
+/**
  * Implementation of block serial communication with
  * read/write calls that uses ASCII strings for data
  * transmission in the presence of a GPIB bus.
@@ -14,139 +14,141 @@
  * see https://linux-gpib.sourceforge.io/ for driver
  * Code was tested with NI's GPIB-USB-HS controllers:
  * https://www.ni.com/en-us/support/model.gpib-usb-hs.html
- * 
+ *
  */
-class GPIBNICom : public ICom
-{
-public:
-  /** \brief Create serial communication object and set settings
-   * @param board_id ID of GPIB dongle or PCIe board (i.e. 0 if on /dev/gpib0)
-   * @param gpib_addr Primary address (gpib_saddr: secondary addr.) of device on GPIB bus
-   */
-  GPIBNICom(uint16_t board_id, uint16_t gpib_addr, uint16_t gpib_saddr);
-  GPIBNICom();
-
-  ~GPIBNICom();
-
-  /** \brief Initialize communication.
-   *
-   * initialise GPIB divice via linux-gpib
-   *
-   * On success, the implementation should set `m_good=true`.
-   *
-   * Throw `std::runtime_error` on error.
-   */
-  void init();
-
-  /** \brief Set communication settings from JSON object
-   *
-   * Valid keys:
-   *  - `gpib_addr` : Primary address (PAD) of device on GPIB bus
-   *  - `gpib_saddr`: Secondary address (SAD) of device on GPIB bus (default: 0)
-   *  - `gpib_board`: Board ID of GPIB interface, i.e. 0 if on /dev/gpib0 (default: 0)
-   *  - `read_tmo`: Timeout (s) to wait for new data (default: T10s)
-   *
-   * \param config JSON configuration
-   */
-  void setConfiguration(const nlohmann::json& config);
-
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   * \param length Number of characters in `buf` that should be sent
-   */  
-  void send(char *buf, size_t length);
-
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   */
-  void send(const std::string& buf);
-
-  /** Read data from device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \return Received data
-   */  
-  std::string receive();
-
-  /** Receive data from device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Buffer where to store results 
-   * \param length Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  uint32_t receive(char *buf, size_t length);
-
-  /** Send data to device and receive reply
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param cmd Data to be sent
-   *
-   * \return Returned data
-   */
-  std::string sendreceive(const std::string& cmd);
-
-  /** Send data to device and receive reply
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param wbuf Data to be sent
-   * \param wlength Number of characters in `wbuf` that should be sent
-   * \param rbuf Buffer where to store results 
-   * \param rlength Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  void sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength);  
-
-protected:
-  /** Request exlusive access to device.
-   *
-   * If a single hardware bus is used to connect multiple devices,
-   * the access to all of them should be locked to remove changes
-   * of cross-talk.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   */  
-  void lock();
-
-  /** Release exlusive access to device.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   */  
-  void unlock();
-
-private:
-  //! verbous translation of linux-GPIB error codes
-  void procGPIBErr();
-
-  //! device id returned from opening
-  uint16_t m_device;
-
-  //! ID of GPIB interface
-  uint16_t m_gpib_board = 0;
-
-  //! Addresses of device on GPIB bus
-  uint16_t m_gpib_addr = 0;
-  uint16_t m_gpib_saddr = 1;
-
-  //! Timeout for waiting for new data on receive
-  uint16_t m_read_tmo = 10;
-
-  //! Count number of lock() calls on this device
-  uint32_t m_lock_counter = 0;
+class GPIBNICom : public ICom {
+ public:
+    /** \brief Create serial communication object and set settings
+     * @param board_id ID of GPIB dongle or PCIe board (i.e. 0 if on /dev/gpib0)
+     * @param gpib_addr Primary address (gpib_saddr: secondary addr.) of device
+     * on GPIB bus
+     */
+    GPIBNICom(uint16_t board_id, uint16_t gpib_addr, uint16_t gpib_saddr);
+    GPIBNICom();
+
+    ~GPIBNICom();
+
+    /** \brief Initialize communication.
+     *
+     * initialise GPIB divice via linux-gpib
+     *
+     * On success, the implementation should set `m_good=true`.
+     *
+     * Throw `std::runtime_error` on error.
+     */
+    void init();
+
+    /** \brief Set communication settings from JSON object
+     *
+     * Valid keys:
+     *  - `gpib_addr` : Primary address (PAD) of device on GPIB bus
+     *  - `gpib_saddr`: Secondary address (SAD) of device on GPIB bus (default:
+     * 0)
+     *  - `gpib_board`: Board ID of GPIB interface, i.e. 0 if on /dev/gpib0
+     * (default: 0)
+     *  - `read_tmo`: Timeout (s) to wait for new data (default: T10s)
+     *
+     * \param config JSON configuration
+     */
+    void setConfiguration(const nlohmann::json &config);
+
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     * \param length Number of characters in `buf` that should be sent
+     */
+    void send(char *buf, size_t length);
+
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     */
+    void send(const std::string &buf);
+
+    /** Read data from device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \return Received data
+     */
+    std::string receive();
+
+    /** Receive data from device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Buffer where to store results
+     * \param length Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    uint32_t receive(char *buf, size_t length);
+
+    /** Send data to device and receive reply
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param cmd Data to be sent
+     *
+     * \return Returned data
+     */
+    std::string sendreceive(const std::string &cmd);
+
+    /** Send data to device and receive reply
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param wbuf Data to be sent
+     * \param wlength Number of characters in `wbuf` that should be sent
+     * \param rbuf Buffer where to store results
+     * \param rlength Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    void sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength);
+
+ protected:
+    /** Request exlusive access to device.
+     *
+     * If a single hardware bus is used to connect multiple devices,
+     * the access to all of them should be locked to remove changes
+     * of cross-talk.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     */
+    void lock();
+
+    /** Release exlusive access to device.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     */
+    void unlock();
+
+ private:
+    //! verbous translation of linux-GPIB error codes
+    void procGPIBErr();
+
+    //! device id returned from opening
+    uint16_t m_device;
+
+    //! ID of GPIB interface
+    uint16_t m_gpib_board = 0;
+
+    //! Addresses of device on GPIB bus
+    uint16_t m_gpib_addr = 0;
+    uint16_t m_gpib_saddr = 1;
+
+    //! Timeout for waiting for new data on receive
+    uint16_t m_read_tmo = 10;
+
+    //! Count number of lock() calls on this device
+    uint32_t m_lock_counter = 0;
 };
 
 #endif
diff --git a/src/libCom/GPIBSerialCom.cpp b/src/libCom/GPIBSerialCom.cpp
old mode 100755
new mode 100644
index f5e60cd1..51bbce1e
--- a/src/libCom/GPIBSerialCom.cpp
+++ b/src/libCom/GPIBSerialCom.cpp
@@ -1,88 +1,78 @@
 #include "GPIBSerialCom.h"
-#include "Logger.h"
 
 #include <fcntl.h>
-#include <unistd.h>
 #include <termios.h>
+#include <unistd.h>
 
 #include <cerrno>
 #include <cstring>
 #include <stdexcept>
 
-//Register com
+#include "Logger.h"
+
+// Register com
 #include "ComRegistry.h"
 REGISTER_COM(GPIBSerialCom)
 
-GPIBSerialCom::GPIBSerialCom(uint16_t gpib_addr,const std::string& port, speed_t baud, bool parityBit, bool twoStopBits, bool flowControl, CharSize charsize)
-: TextSerialCom(port, baud, parityBit, twoStopBits, flowControl, charsize), m_gpib_addr(gpib_addr)
-{ }
+GPIBSerialCom::GPIBSerialCom(uint16_t gpib_addr, const std::string& port,
+                             speed_t baud, bool parityBit, bool twoStopBits,
+                             bool flowControl, CharSize charsize)
+    : TextSerialCom(port, baud, parityBit, twoStopBits, flowControl, charsize),
+      m_gpib_addr(gpib_addr) {}
 
-GPIBSerialCom::GPIBSerialCom()
-  : TextSerialCom()
-{ }
+GPIBSerialCom::GPIBSerialCom() : TextSerialCom() {}
 
-GPIBSerialCom::~GPIBSerialCom()
-{ }
+GPIBSerialCom::~GPIBSerialCom() {}
 
-void GPIBSerialCom::init()
-{
-  TextSerialCom::init();
-  TextSerialCom::send("++auto 0");
+void GPIBSerialCom::init() {
+    TextSerialCom::init();
+    TextSerialCom::send("++auto 0");
 
-  m_good = true;
+    m_good = true;
 }
 
-void GPIBSerialCom::setConfiguration(const nlohmann::json& config)
-{
-  for (const auto &kv : config.items())
-    {
-      if(kv.key()=="gpib_addr")
-	{
-	  m_gpib_addr=kv.value();
-	}
-      else if(kv.key()=="read_tmo_ms")
-	{
-	  m_read_tmo_ms=kv.value();
-	}
+void GPIBSerialCom::setConfiguration(const nlohmann::json& config) {
+    for (const auto& kv : config.items()) {
+        if (kv.key() == "gpib_addr") {
+            m_gpib_addr = kv.value();
+        } else if (kv.key() == "read_tmo_ms") {
+            m_read_tmo_ms = kv.value();
+        }
     }
-  TextSerialCom::setConfiguration(config);
+    TextSerialCom::setConfiguration(config);
 }
 
-void GPIBSerialCom::send(const std::string& buf)
-{
-  lock();
-  TextSerialCom::send("++addr " + std::to_string(m_gpib_addr));
-  TextSerialCom::send(buf);
-  unlock();
+void GPIBSerialCom::send(const std::string& buf) {
+    lock();
+    TextSerialCom::send("++addr " + std::to_string(m_gpib_addr));
+    TextSerialCom::send(buf);
+    unlock();
 }
 
-void GPIBSerialCom::send(char *buf, size_t length)
-{
-  send(std::string(buf,length));
+void GPIBSerialCom::send(char* buf, size_t length) {
+    send(std::string(buf, length));
 }
 
-std::string GPIBSerialCom::receive()
-{
-  lock();
+std::string GPIBSerialCom::receive() {
+    lock();
 
-  if(m_read_tmo_ms>0)
-    TextSerialCom::send("++read_tmo_ms "+std::to_string(m_read_tmo_ms));
+    if (m_read_tmo_ms > 0)
+        TextSerialCom::send("++read_tmo_ms " + std::to_string(m_read_tmo_ms));
 
-  TextSerialCom::send("++read eoi");
+    TextSerialCom::send("++read eoi");
 
-  std::string buf=TextSerialCom::receive();
-  unlock();
+    std::string buf = TextSerialCom::receive();
+    unlock();
 
-  // rstrip new lines from end
-  while(buf.size()>0 && (buf.back()=='\n' || buf.back()=='\r'))
-    buf.pop_back();
+    // rstrip new lines from end
+    while (buf.size() > 0 && (buf.back() == '\n' || buf.back() == '\r'))
+        buf.pop_back();
 
-  return buf;
+    return buf;
 }
 
-uint32_t GPIBSerialCom::receive(char *buf, size_t length)
-{
-  TextSerialCom::send("++read eoi");
+uint32_t GPIBSerialCom::receive(char* buf, size_t length) {
+    TextSerialCom::send("++read eoi");
 
-  return TextSerialCom::receive(buf, length);
+    return TextSerialCom::receive(buf, length);
 }
diff --git a/src/libCom/GPIBSerialCom.h b/src/libCom/GPIBSerialCom.h
old mode 100755
new mode 100644
index f42909c3..f4bbae45
--- a/src/libCom/GPIBSerialCom.h
+++ b/src/libCom/GPIBSerialCom.h
@@ -3,7 +3,7 @@
 
 #include "TextSerialCom.h"
 
-/** 
+/**
  * Implementation of block serial communication with POSIX
  * read/write calls that uses ASCII strings for data
  * transmission in the presence of a GPIB bus.
@@ -11,92 +11,96 @@
  * All data packets are deliminiated with "\n\r". This suffix
  * is stripped internally.
  *
- * The [Prologix GPIB-USB controller](http://prologix.biz/downloads/PrologixGpibUsbManual-6.0.pdf) is 
+ * The [Prologix GPIB-USB
+ * controller](http://prologix.biz/downloads/PrologixGpibUsbManual-6.0.pdf) is
  * assumed.
  */
-class GPIBSerialCom : public TextSerialCom
-{
-public:
-  /** \brief Create serial communication object and set settings
-   * @param gpib_addr Address of device on GPIB bus
-   * @param port Device corresponding to the serial port
-   * @param baud Baud rate to use
-   * @param useParityBit Use parity bit
-   * @param twoStopBits Use two stop bits instead of one
-   * @param flowControl Enable hardware flow control
-   * @param charsize Size of a character
-   */
-  GPIBSerialCom(uint16_t gpib_addr, const std::string& port, speed_t baud=B19200, bool parityBit=false, bool twoStopBits=false, bool flowControl=false, CharSize charsize=CharSize::CharSize8);
-  GPIBSerialCom();
+class GPIBSerialCom : public TextSerialCom {
+ public:
+    /** \brief Create serial communication object and set settings
+     * @param gpib_addr Address of device on GPIB bus
+     * @param port Device corresponding to the serial port
+     * @param baud Baud rate to use
+     * @param useParityBit Use parity bit
+     * @param twoStopBits Use two stop bits instead of one
+     * @param flowControl Enable hardware flow control
+     * @param charsize Size of a character
+     */
+    GPIBSerialCom(uint16_t gpib_addr, const std::string& port,
+                  speed_t baud = B19200, bool parityBit = false,
+                  bool twoStopBits = false, bool flowControl = false,
+                  CharSize charsize = CharSize::CharSize8);
+    GPIBSerialCom();
 
-  ~GPIBSerialCom();
+    ~GPIBSerialCom();
 
-  /** Open device and configure
-   */
-  virtual void init();
+    /** Open device and configure
+     */
+    virtual void init();
 
-  /** \brief Configure serial device based on JSON object
-   *
-   * Valid keys:
-   *  - `gpib_addr`: Address of device on GPIB bus
-   *  - `read_tmo_ms`: Timeout (ms) to wait for new data, 0 means don't set (default: none)
-   *
-   * \param config JSON configuration
-   */
-  virtual void setConfiguration(const nlohmann::json& config);
+    /** \brief Configure serial device based on JSON object
+     *
+     * Valid keys:
+     *  - `gpib_addr`: Address of device on GPIB bus
+     *  - `read_tmo_ms`: Timeout (ms) to wait for new data, 0 means don't set
+     * (default: none)
+     *
+     * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json& config);
 
-  /** Send data to device
-   *
-   * Sets the GPIB address before sending data.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   * \param length Number of characters in `buf` that should be sent
-   */  
-  virtual void send(char *buf, size_t length);
+    /** Send data to device
+     *
+     * Sets the GPIB address before sending data.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     * \param length Number of characters in `buf` that should be sent
+     */
+    virtual void send(char* buf, size_t length);
 
-  /** Send data to device
-   *
-   * Sets the GPIB address before sending data.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   */
-  virtual void send(const std::string& buf);
+    /** Send data to device
+     *
+     * Sets the GPIB address before sending data.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     */
+    virtual void send(const std::string& buf);
 
-  /** Read data from device
-   *
-   * Requests the Prologix box to send the currently queued
-   * data. The address is not set.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \return Received data
-   */  
-  virtual std::string receive();
+    /** Read data from device
+     *
+     * Requests the Prologix box to send the currently queued
+     * data. The address is not set.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \return Received data
+     */
+    virtual std::string receive();
 
-  /** Read data from device
-   *
-   * Requests the Prologix box to send the currently queued
-   * data. The address is not set.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Buffer where to store results 
-   * \param length Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  virtual uint32_t receive(char *buf, size_t length);
+    /** Read data from device
+     *
+     * Requests the Prologix box to send the currently queued
+     * data. The address is not set.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Buffer where to store results
+     * \param length Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    virtual uint32_t receive(char* buf, size_t length);
 
-private:
-  //! Address of device on GPIB bus
-  uint16_t m_gpib_addr = 0;
+ private:
+    //! Address of device on GPIB bus
+    uint16_t m_gpib_addr = 0;
 
-  //! Timeout for waiting for new data on receive
-  uint16_t m_read_tmo_ms = 0;
+    //! Timeout for waiting for new data on receive
+    uint16_t m_read_tmo_ms = 0;
 };
 
 #endif
diff --git a/src/libCom/ICom.h b/src/libCom/ICom.h
old mode 100755
new mode 100644
index d7050753..f036d61c
--- a/src/libCom/ICom.h
+++ b/src/libCom/ICom.h
@@ -1,10 +1,10 @@
 #ifndef ICOM_H
 #define ICOM_H
 
-#include <string>
 #include <nlohmann/json.hpp>
+#include <string>
 
-/** 
+/**
  * Interface for generic communication with a hardware device.
  *
  * Each instance is responsible for communicating with a single device. The
@@ -22,8 +22,8 @@
  *
  * ## Locking mechanism
  *
- * All communication functions (`receive`/`send`/`sendreceive`) are required to be 
- * multi-process safe and reentrant. That is, no other communication with the
+ * All communication functions (`receive`/`send`/`sendreceive`) are required to
+ * be multi-process safe and reentrant. That is, no other communication with the
  * device from a different process is allowed until the function completes.
  *
  * To help this, the following interface functions are required:
@@ -31,119 +31,120 @@
  * `lock`: Request a lock on the communication hardware
  * `unlock`: Release a lock on the communication hardware
  *
- * The `lock`/`unlock` functions are declared as public to allow for applications to
- * obtain an exclusive lock across multiple consecutive commands.
+ * The `lock`/`unlock` functions are declared as public to allow for
+ * applications to obtain an exclusive lock across multiple consecutive
+ * commands.
  */
-class ICom
-{
-public:
-  ICom();
-  ~ICom() =default;
+class ICom {
+ public:
+    ICom();
+    ~ICom() = default;
 
-  /** \brief Initialize communication.
-   *
-   * Implementations should check `is_open` to see if communication
-   * has already been initialized. If already called, the function
-   * should return without an error.
-   *
-   * On success, the implementation should set `m_good=true`.
-   *
-   * Throw `std::runtime_error` on error.
-   */
-  virtual void init() =0;
+    /** \brief Initialize communication.
+     *
+     * Implementations should check `is_open` to see if communication
+     * has already been initialized. If already called, the function
+     * should return without an error.
+     *
+     * On success, the implementation should set `m_good=true`.
+     *
+     * Throw `std::runtime_error` on error.
+     */
+    virtual void init() = 0;
 
-  /** \brief Check if the object is correctly initialized
-   *
-   * \return true if initialization succeeded, false otherwise
-   */
-  bool is_open();
+    /** \brief Check if the object is correctly initialized
+     *
+     * \return true if initialization succeeded, false otherwise
+     */
+    bool is_open();
 
-  /** \brief Set communication settings from JSON object
-   *
-   * \param config JSON configuration
-   */
-  virtual void setConfiguration(const nlohmann::json& config) =0;
+    /** \brief Set communication settings from JSON object
+     *
+     * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json &config) = 0;
 
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   * \param length Number of characters in `buf` that should be sent
-   */  
-  virtual void send(char *buf, size_t length) =0;
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     * \param length Number of characters in `buf` that should be sent
+     */
+    virtual void send(char *buf, size_t length) = 0;
 
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   */
-  virtual void send(const std::string& buf) =0;
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     */
+    virtual void send(const std::string &buf) = 0;
 
-  /** Read data from device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \return Received data
-   */  
-  virtual std::string receive() =0;
+    /** Read data from device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \return Received data
+     */
+    virtual std::string receive() = 0;
 
-  /** Receive data from device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Buffer where to store results 
-   * \param length Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  virtual uint32_t receive(char *buf, size_t length) =0;
+    /** Receive data from device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Buffer where to store results
+     * \param length Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    virtual uint32_t receive(char *buf, size_t length) = 0;
 
-  /** Send data to device and receive reply
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param cmd Data to be sent
-   *
-   * \return Returned data
-   */
-  virtual std::string sendreceive(const std::string& cmd) =0;
+    /** Send data to device and receive reply
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param cmd Data to be sent
+     *
+     * \return Returned data
+     */
+    virtual std::string sendreceive(const std::string &cmd) = 0;
 
-  /** Send data to device and receive reply
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param wbuf Data to be sent
-   * \param wlength Number of characters in `wbuf` that should be sent
-   * \param rbuf Buffer where to store results 
-   * \param rlength Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  virtual void sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength) =0;  
+    /** Send data to device and receive reply
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param wbuf Data to be sent
+     * \param wlength Number of characters in `wbuf` that should be sent
+     * \param rbuf Buffer where to store results
+     * \param rlength Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    virtual void sendreceive(char *wbuf, size_t wlength, char *rbuf,
+                             size_t rlength) = 0;
 
-  /** Request exlusive access to device.
-   *
-   * If a single hardware bus is used to connect multiple devices,
-   * the access to all of them should be locked to remove changes
-   * of cross-talk.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   */  
-  virtual void lock() =0;
+    /** Request exlusive access to device.
+     *
+     * If a single hardware bus is used to connect multiple devices,
+     * the access to all of them should be locked to remove changes
+     * of cross-talk.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     */
+    virtual void lock() = 0;
 
-  /** Release exlusive access to device.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   */  
-  virtual void unlock() =0;
+    /** Release exlusive access to device.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     */
+    virtual void unlock() = 0;
 
-protected:
-  //! Good if communication is opened and configured correctly
-  bool m_good =false;
+ protected:
+    //! Good if communication is opened and configured correctly
+    bool m_good = false;
 };
 
 #endif
diff --git a/src/libCom/SerialCom.cpp b/src/libCom/SerialCom.cpp
old mode 100755
new mode 100644
index 7f34010e..f252396b
--- a/src/libCom/SerialCom.cpp
+++ b/src/libCom/SerialCom.cpp
@@ -1,299 +1,269 @@
 #include "SerialCom.h"
-#include "Logger.h"
 
 #include <fcntl.h>
-#include <unistd.h>
-#include <termios.h>
-#include <sys/ioctl.h>
 #include <sys/file.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <unistd.h>
 
 #include <cerrno>
 #include <cstring>
 #include <stdexcept>
 
-//Register com
+#include "Logger.h"
+
+// Register com
 #include "ComRegistry.h"
 REGISTER_COM(SerialCom)
 
 const std::unordered_map<std::string, speed_t> SerialCom::mapBAUDRATE = {
-									 {"B0"    , B0    },
-									 {"B50"   , B50   },
-									 {"B75"   , B75   },
-									 {"B110"  , B110  },
-									 {"B134"  , B134  },
-									 {"B150"  , B150  },
-									 {"B200"  , B200  },
-									 {"B300"  , B300  },
-									 {"B600"  , B600  },
-									 {"B1200" , B1200 },
-									 {"B1800" , B1800 },
-									 {"B2400" , B2400 },
-									 {"B4800" , B4800 },
-									 {"B9600" , B9600 },
-									 {"B19200", B19200},
-									 {"B38400", B38400}
-};
-
-const std::unordered_map<std::string, SerialCom::CharSize> SerialCom::mapCHARSIZE = {
-										     {"CS5" , CharSize5 },
-										     {"CS6" , CharSize6 },
-										     {"CS7" , CharSize7 },
-										     {"CS8" , CharSize8 }
-};
-
-SerialCom::SerialCom(const std::string& port, speed_t baud, bool parityBit, bool twoStopBits, bool flowControl, CharSize charsize)
-  : m_port(port), m_baudrate(baud), m_parityBit(parityBit), m_twoStopBits(twoStopBits), m_flowControl(flowControl), m_charsize(charsize)
-{ }
-
-SerialCom::SerialCom()
-{ }
-
-SerialCom::~SerialCom()
-{ if(m_dev!=0) close(m_dev); }
-
-void SerialCom::setTimeout(float timeout)
-{
-  m_timeout=timeout;
-
-  //
-  // Also update the device
-  if(m_dev!=0)
-    {
-      lock();
-
-      if (tcgetattr(m_dev, &m_tty))
-	std::runtime_error("SerialCom::config -> Could not get tty attributes!");
-
-      m_tty.c_cc[VMIN ] = 0;
-      m_tty.c_cc[VTIME] = static_cast<uint32_t>(m_timeout/10+0.5);
-
-      if (tcsetattr(m_dev, TCSANOW, &m_tty))
-	std::runtime_error("SerialCom::config -> Could not set tty attributes!");
-
-      unlock();
-    }
+    {"B0", B0},       {"B50", B50},     {"B75", B75},       {"B110", B110},
+    {"B134", B134},   {"B150", B150},   {"B200", B200},     {"B300", B300},
+    {"B600", B600},   {"B1200", B1200}, {"B1800", B1800},   {"B2400", B2400},
+    {"B4800", B4800}, {"B9600", B9600}, {"B19200", B19200}, {"B38400", B38400}};
+
+const std::unordered_map<std::string, SerialCom::CharSize>
+    SerialCom::mapCHARSIZE = {{"CS5", CharSize5},
+                              {"CS6", CharSize6},
+                              {"CS7", CharSize7},
+                              {"CS8", CharSize8}};
+
+SerialCom::SerialCom(const std::string &port, speed_t baud, bool parityBit,
+                     bool twoStopBits, bool flowControl, CharSize charsize)
+    : m_port(port),
+      m_baudrate(baud),
+      m_parityBit(parityBit),
+      m_twoStopBits(twoStopBits),
+      m_flowControl(flowControl),
+      m_charsize(charsize) {}
+
+SerialCom::SerialCom() {}
+
+SerialCom::~SerialCom() {
+    if (m_dev != 0) close(m_dev);
 }
 
-float SerialCom::getTimeout()
-{
-  if(m_dev==0)
-    {
-      return m_timeout;
-    }
-  else
-    {
-      lock();
+void SerialCom::setTimeout(float timeout) {
+    m_timeout = timeout;
 
-      if (tcgetattr(m_dev, &m_tty))
-	std::runtime_error("SerialCom::config -> Could not get tty attributes!");
+    //
+    // Also update the device
+    if (m_dev != 0) {
+        lock();
 
-      unlock();
+        if (tcgetattr(m_dev, &m_tty))
+            std::runtime_error(
+                "SerialCom::config -> Could not get tty attributes!");
 
-      return m_tty.c_cc[VTIME]*10;
+        m_tty.c_cc[VMIN] = 0;
+        m_tty.c_cc[VTIME] = static_cast<uint32_t>(m_timeout / 10 + 0.5);
+
+        if (tcsetattr(m_dev, TCSANOW, &m_tty))
+            std::runtime_error(
+                "SerialCom::config -> Could not set tty attributes!");
+
+        unlock();
     }
 }
 
+float SerialCom::getTimeout() {
+    if (m_dev == 0) {
+        return m_timeout;
+    } else {
+        lock();
+
+        if (tcgetattr(m_dev, &m_tty))
+            std::runtime_error(
+                "SerialCom::config -> Could not get tty attributes!");
 
-void SerialCom::init()
-{
-  if(is_open()) return;
+        unlock();
+
+        return m_tty.c_cc[VTIME] * 10;
+    }
+}
 
-  if(m_port.empty())
-    throw std::runtime_error("SerialCom::init requires a device name");
+void SerialCom::init() {
+    if (is_open()) return;
 
-  m_dev = open(m_port.c_str(), O_RDWR | O_NOCTTY);
-  if(m_dev<0)
-    throw std::runtime_error("Error opening "+m_port+": "+std::strerror(errno));
+    if (m_port.empty())
+        throw std::runtime_error("SerialCom::init requires a device name");
 
-  config();
-  m_good = true;
+    m_dev = open(m_port.c_str(), O_RDWR | O_NOCTTY);
+    if (m_dev < 0)
+        throw std::runtime_error("Error opening " + m_port + ": " +
+                                 std::strerror(errno));
+
+    config();
+    m_good = true;
 }
 
-void SerialCom::config()
-{
-  logger(logDEBUG3) << __PRETTY_FUNCTION__;
+void SerialCom::config() {
+    logger(logDEBUG3) << __PRETTY_FUNCTION__;
 
-  logger(logDEBUG3) << "Configuring serial device " << m_port;
-  logger(logDEBUG3) << "  Baud Rate: " << m_baudrate;
-  logger(logDEBUG3) << "  Enable parity bit: " << m_parityBit;
-  logger(logDEBUG3) << "  Use two stop bits: " << m_twoStopBits;
-  logger(logDEBUG3) << "  Enable hardware flow control: " << m_flowControl;
-  logger(logDEBUG3) << "  Character size: " << m_charsize;
+    logger(logDEBUG3) << "Configuring serial device " << m_port;
+    logger(logDEBUG3) << "  Baud Rate: " << m_baudrate;
+    logger(logDEBUG3) << "  Enable parity bit: " << m_parityBit;
+    logger(logDEBUG3) << "  Use two stop bits: " << m_twoStopBits;
+    logger(logDEBUG3) << "  Enable hardware flow control: " << m_flowControl;
+    logger(logDEBUG3) << "  Character size: " << m_charsize;
 
-  lock();
-  if (tcgetattr(m_dev, &m_tty))
-    std::runtime_error("SerialCom::config -> Could not get tty attributes!");
+    lock();
+    if (tcgetattr(m_dev, &m_tty))
+        std::runtime_error(
+            "SerialCom::config -> Could not get tty attributes!");
 
-  m_tty_old = m_tty;
+    m_tty_old = m_tty;
 
-  cfsetospeed(&m_tty, m_baudrate);
-  cfsetispeed(&m_tty, m_baudrate);
+    cfsetospeed(&m_tty, m_baudrate);
+    cfsetispeed(&m_tty, m_baudrate);
 
-  if(m_parityBit)
-    m_tty.c_cflag &=  PARENB;
-  else
-    m_tty.c_cflag &= ~PARENB;
+    if (m_parityBit)
+        m_tty.c_cflag &= PARENB;
+    else
+        m_tty.c_cflag &= ~PARENB;
 
-  if(m_twoStopBits)
-    m_tty.c_cflag &=  CSTOPB;
-  else
-    m_tty.c_cflag &= ~CSTOPB;
+    if (m_twoStopBits)
+        m_tty.c_cflag &= CSTOPB;
+    else
+        m_tty.c_cflag &= ~CSTOPB;
 
-  if(m_flowControl)
-    m_tty.c_cflag &=  CRTSCTS;
-  else
-    m_tty.c_cflag &= ~CRTSCTS;
+    if (m_flowControl)
+        m_tty.c_cflag &= CRTSCTS;
+    else
+        m_tty.c_cflag &= ~CRTSCTS;
 
-  m_tty.c_cflag &= ~CSIZE;
-  m_tty.c_cflag |= m_charsize;
-  m_tty.c_cflag |= CREAD | CLOCAL;	// turn on READ & ignore ctrl lines
+    m_tty.c_cflag &= ~CSIZE;
+    m_tty.c_cflag |= m_charsize;
+    m_tty.c_cflag |= CREAD | CLOCAL;  // turn on READ & ignore ctrl lines
 
-  cfmakeraw(&m_tty);
-  m_tty.c_lflag &= ~(ICANON|ECHO);	// Non-canonical mode, no echo
+    cfmakeraw(&m_tty);
+    m_tty.c_lflag &= ~(ICANON | ECHO);  // Non-canonical mode, no echo
 
-  // Timeout
-  m_tty.c_cc[VMIN ] = 0;
-  m_tty.c_cc[VTIME] = static_cast<uint32_t>(m_timeout*10+0.5);
+    // Timeout
+    m_tty.c_cc[VMIN] = 0;
+    m_tty.c_cc[VTIME] = static_cast<uint32_t>(m_timeout * 10 + 0.5);
 
-  tcflush(m_dev, TCIFLUSH);		// Empty buffers
+    tcflush(m_dev, TCIFLUSH);  // Empty buffers
 
-  if (tcsetattr(m_dev, TCSANOW, &m_tty))
-    std::runtime_error("SerialCom::config -> Could not set tty attributes!");
+    if (tcsetattr(m_dev, TCSANOW, &m_tty))
+        std::runtime_error(
+            "SerialCom::config -> Could not set tty attributes!");
 
-  unlock();
+    unlock();
 }
 
-void SerialCom::flush()
-{
-  if(tcflush(m_dev, TCIFLUSH)<0)
-    throw std::runtime_error("Error flushing for "+m_port+": "+std::strerror(errno));
+void SerialCom::flush() {
+    if (tcflush(m_dev, TCIFLUSH) < 0)
+        throw std::runtime_error("Error flushing for " + m_port + ": " +
+                                 std::strerror(errno));
 }
 
-void SerialCom::setDTR(bool on)
-{
-  int controlbits = TIOCM_DTR;
-  if(ioctl(m_dev, (on ? TIOCMBIS : TIOCMBIC), &controlbits)<0)
-    throw std::runtime_error("Error setting control bits for "+m_port+": "+std::strerror(errno));
+void SerialCom::setDTR(bool on) {
+    int controlbits = TIOCM_DTR;
+    if (ioctl(m_dev, (on ? TIOCMBIS : TIOCMBIC), &controlbits) < 0)
+        throw std::runtime_error("Error setting control bits for " + m_port +
+                                 ": " + std::strerror(errno));
 }
 
-void SerialCom::send(const std::string& buf)
-{
-  lock();
-  int n_write = ::write(m_dev, buf.c_str(), buf.size());
-  unlock();
+void SerialCom::send(const std::string &buf) {
+    lock();
+    int n_write = ::write(m_dev, buf.c_str(), buf.size());
+    unlock();
 
-  if(n_write<0)
-    throw std::runtime_error("Error writing to "+m_port+": "+std::strerror(errno));
+    if (n_write < 0)
+        throw std::runtime_error("Error writing to " + m_port + ": " +
+                                 std::strerror(errno));
 }
 
-void SerialCom::send(char *buf, size_t length)
-{
-  lock();
-  int n_write = ::write(m_dev, buf, length);
-  unlock();
+void SerialCom::send(char *buf, size_t length) {
+    lock();
+    int n_write = ::write(m_dev, buf, length);
+    unlock();
 
-  if(n_write<0)
-    throw std::runtime_error("Error writing to "+m_port+": "+std::strerror(errno));
+    if (n_write < 0)
+        throw std::runtime_error("Error writing to " + m_port + ": " +
+                                 std::strerror(errno));
 }
 
-std::string SerialCom::receive()
-{
-  lock();
-  int n_read = ::read(m_dev, m_tmpbuf, MAX_READ);
-  unlock();
+std::string SerialCom::receive() {
+    lock();
+    int n_read = ::read(m_dev, m_tmpbuf, MAX_READ);
+    unlock();
 
-  if(n_read>=0)
-    return std::string(m_tmpbuf, n_read);
-  else
-    throw std::runtime_error("Error reading from "+m_port+": "+std::strerror(errno));
+    if (n_read >= 0)
+        return std::string(m_tmpbuf, n_read);
+    else
+        throw std::runtime_error("Error reading from " + m_port + ": " +
+                                 std::strerror(errno));
 }
 
-uint32_t SerialCom::receive(char *buf, size_t length)
-{
-  lock();
-  int n_read = ::read(m_dev, buf, length);
-  unlock();
+uint32_t SerialCom::receive(char *buf, size_t length) {
+    lock();
+    int n_read = ::read(m_dev, buf, length);
+    unlock();
 
-  if(n_read<0)
-    throw std::runtime_error("Error reading from "+m_port+": "+std::strerror(errno));
+    if (n_read < 0)
+        throw std::runtime_error("Error reading from " + m_port + ": " +
+                                 std::strerror(errno));
 
-  return n_read;
+    return n_read;
 }
 
-std::string SerialCom::sendreceive(const std::string& cmd)
-{
-  lock();
-  send(cmd);
-  std::string ret=receive();
-  unlock();
+std::string SerialCom::sendreceive(const std::string &cmd) {
+    lock();
+    send(cmd);
+    std::string ret = receive();
+    unlock();
 
-  return ret;
+    return ret;
 }
 
-void SerialCom::sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength)
-{
-  lock();
-  send(wbuf, wlength);
-  receive (rbuf, rlength);
-  unlock();
+void SerialCom::sendreceive(char *wbuf, size_t wlength, char *rbuf,
+                            size_t rlength) {
+    lock();
+    send(wbuf, wlength);
+    receive(rbuf, rlength);
+    unlock();
 }
 
-void SerialCom::lock()
-{
-  flock(m_dev, LOCK_EX);
-  m_lock_counter++;
-} 
-
-void SerialCom::unlock()
-{
-  if(m_lock_counter==0) return; // No lock exists
-
-  m_lock_counter--;
-  if(m_lock_counter==0)
-    flock(m_dev, LOCK_UN);
-} 
-
-void SerialCom::setConfiguration(const nlohmann::json& config)
-{
-  for (const auto &kv : config.items())
-    {
-      if(kv.key()=="port")
-	{
-	  m_port=kv.value();
-	}
-      else if(kv.key()=="baudrate")
-	{
-	  if(mapBAUDRATE.count(kv.value())==1)
-	    m_baudrate=mapBAUDRATE.at(kv.value());
-	  else
-	    throw std::runtime_error("SerialCom::setConfiguration saw invalid baudrate value "+kv.value().get<std::string>());
-	}
-      else if(kv.key()=="parityBit")
-	{
-	  m_parityBit=kv.value();
-	}
-      else if(kv.key()=="twoStopBits")
-	{
-	  m_twoStopBits=kv.value();
-	}
-      else if(kv.key()=="flowControl")
-	{
-	  m_flowControl=kv.value();
-	}
-      else if(kv.key()=="charsize")
-	{
-	  if(mapCHARSIZE.count(kv.value())==1)
-	    m_charsize=mapCHARSIZE.at(kv.value());
-	  else
-	    throw std::runtime_error("SerialCom::setConfiguration saw invalid charsize value "+kv.value().get<std::string>());
-	}      
-      else if(kv.key()=="timeout")
-	{
-	  m_timeout=kv.value();
-	}
-    }
+void SerialCom::lock() {
+    flock(m_dev, LOCK_EX);
+    m_lock_counter++;
 }
 
-  
+void SerialCom::unlock() {
+    if (m_lock_counter == 0) return;  // No lock exists
 
+    m_lock_counter--;
+    if (m_lock_counter == 0) flock(m_dev, LOCK_UN);
+}
 
+void SerialCom::setConfiguration(const nlohmann::json &config) {
+    for (const auto &kv : config.items()) {
+        if (kv.key() == "port") {
+            m_port = kv.value();
+        } else if (kv.key() == "baudrate") {
+            if (mapBAUDRATE.count(kv.value()) == 1)
+                m_baudrate = mapBAUDRATE.at(kv.value());
+            else
+                throw std::runtime_error(
+                    "SerialCom::setConfiguration saw invalid baudrate value " +
+                    kv.value().get<std::string>());
+        } else if (kv.key() == "parityBit") {
+            m_parityBit = kv.value();
+        } else if (kv.key() == "twoStopBits") {
+            m_twoStopBits = kv.value();
+        } else if (kv.key() == "flowControl") {
+            m_flowControl = kv.value();
+        } else if (kv.key() == "charsize") {
+            if (mapCHARSIZE.count(kv.value()) == 1)
+                m_charsize = mapCHARSIZE.at(kv.value());
+            else
+                throw std::runtime_error(
+                    "SerialCom::setConfiguration saw invalid charsize value " +
+                    kv.value().get<std::string>());
+        } else if (kv.key() == "timeout") {
+            m_timeout = kv.value();
+        }
+    }
+}
diff --git a/src/libCom/SerialCom.h b/src/libCom/SerialCom.h
old mode 100755
new mode 100644
index c11aa739..1e434434
--- a/src/libCom/SerialCom.h
+++ b/src/libCom/SerialCom.h
@@ -1,13 +1,14 @@
 #ifndef SERIALCOM_H
 #define SERIALCOM_H
 
-#include <unordered_map>
-#include <string>
 #include <termios.h>
 
+#include <string>
+#include <unordered_map>
+
 #include "ICom.h"
 
-/** 
+/**
  * Implementation of block serial communication with POSIX
  * receive/send calls.
  *
@@ -21,210 +22,218 @@
  * On Linux, this is done using the VMIN/VTIME parameters. This means
  * that the timeout setting is rounded to the nearest tenth of a second.
  */
-class SerialCom : public ICom
-{
-public:
-  /** Available character sizes */
-  enum CharSize {CharSize5=CS5,CharSize6=CS6,CharSize7=CS7,CharSize8=CS8};
-  
-public:
-  /** \brief Create serial communication object and set settings
-   * @param port Device corresponding to the serial port
-   * @param baud Baud rate to use
-   * @param useParityBit Use parity bit
-   * @param twoStopBits Use two stop bits instead of one
-   * @param flowControl Enable hardware flow control
-   * @param charsize Size of a character
-   */
-  SerialCom(const std::string& port, speed_t baud=B19200, bool parityBit=false, bool twoStopBits=false, bool flowControl=false, CharSize charsize=CharSize::CharSize8);
-  SerialCom();
-
-  ~SerialCom();
-
-  /** Open device and configure
-   */
-  virtual void init();
-
-  /** \brief Configure serial device based on JSON object
-   *
-   * Valid keys:
-   *  - `device`: Path to serial device
-   *  - `baudrate`: Baud rate (default: `"B19200"`)
-   *  - `parityBit`: Enable parity bit (default: `false`)
-   *  - `twoStopBits`: Use two stop bits instead of one (default: `false`)
-   *  - `flowControl`: Enable hardware flow control (default: `false`)
-   *  - `charsize`: Size of a character (default: `"C8"`)
-   *  - `timeout`: Timeout in seconds (default: `1` second)
-   *
-   * \param config JSON configuration
-   */
-  virtual void setConfiguration(const nlohmann::json& config);
-
-  /** \brief Set timeout
-   *
-   * If serial port is open, the timeout is updated.
-   *
-   * \param timeout Timeout in seconds
-   */
-  void setTimeout(float timeout);
-
-  /** \brief Retrieve current timeout
-   *
-   * \return Timeout in seconds
-   */
-  float getTimeout();
-
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   * \param length Number of characters in `buf` that should be sent
-   */  
-  virtual void send(char *buf, size_t length);
-
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   */
-  virtual void send(const std::string& buf);
-
-  /** Read data from device
-   *
-   * Returns any characters available in the buffer, waiting up
-   * to `timeout` if no data is available.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \return Received data
-   */  
-  virtual std::string receive();
-
-  /** Read data from device
-   *
-   * Returns any characters available in the buffer, waiting up
-   * to `timeout` if no data is available.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Buffer where to store results 
-   * \param length Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  virtual uint32_t receive(char *buf, size_t length);
-
-  /** Write data to device and receive reply
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param cmd Data to be sent
-   *
-   * \return Returned data
-   */
-  virtual std::string sendreceive(const std::string& cmd);
-
-  /** Write data to device and receive reply
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param wbuf Data to be sent
-   * \param wlength Number of characters in `wbuf` that should be sent
-   * \param rbuf Buffer where to store results 
-   * \param rlength Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  virtual void sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength);
-  
-  /** Flush any data in the device buffers
-   */
-  void flush();
-
-  /** Toggle the Data Terminal Ready pin
-   *
-   * \param on New DTR value
-   */
-  void setDTR(bool on);
-
-  /** Request exlusive access to device.
-   *
-   * If a single hardware bus is used to connect multiple devices,
-   * the access to all of them should be locked to remove changes
-   * of cross-talk.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   */  
-  virtual void lock();
-
-  /** Release exlusive access to device.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   */  
-  virtual void unlock();
-
-private:
-
-  /** \brief Configure device for serial communication
-   */
-  void config();
-
-  /** Configuration @{ */
-
-  /// Name of device
-  std::string m_port;
-
-  /// Baud rate to use
-  speed_t m_baudrate = B19200;
-
-  /// Use parity bit
-  bool m_parityBit=false;
-
-  // Use two stop bits intead of one
-  bool m_twoStopBits=false;
-
-  // Enable hardware flow control
-  bool m_flowControl=false;
-
-  // Size of a character
-  CharSize m_charsize=CharSize::CharSize8;
-
-  // Timeout
-  float m_timeout=1;
-
-  /** @} */
-
-  /** Run-time variables @{ */
-
-  //! File handle for communication
-  int m_dev =0;
-
-  //! Current settings
-  struct termios m_tty;
-
-  //! Settings frm before config
-  struct termios m_tty_old;
-
-  //! Count number of lock() calls on this device
-  uint32_t m_lock_counter = 0;
-
-  /** @} */
-
-  //! Maximum number of characters to read using string buffers
-  static const unsigned MAX_READ = 4096;
-
-  //! Temporary buffer for ::read()
-  char m_tmpbuf[MAX_READ];
-
-  //! Maps valid baud rate settings to `speed_t` type
-  static const std::unordered_map<std::string, speed_t> mapBAUDRATE;
-
-  //! Maps valid char size settings to `CharSize` type
-  static const std::unordered_map<std::string, SerialCom::CharSize> mapCHARSIZE;
+class SerialCom : public ICom {
+ public:
+    /** Available character sizes */
+    enum CharSize {
+        CharSize5 = CS5,
+        CharSize6 = CS6,
+        CharSize7 = CS7,
+        CharSize8 = CS8
+    };
+
+ public:
+    /** \brief Create serial communication object and set settings
+     * @param port Device corresponding to the serial port
+     * @param baud Baud rate to use
+     * @param useParityBit Use parity bit
+     * @param twoStopBits Use two stop bits instead of one
+     * @param flowControl Enable hardware flow control
+     * @param charsize Size of a character
+     */
+    SerialCom(const std::string& port, speed_t baud = B19200,
+              bool parityBit = false, bool twoStopBits = false,
+              bool flowControl = false,
+              CharSize charsize = CharSize::CharSize8);
+    SerialCom();
+
+    ~SerialCom();
+
+    /** Open device and configure
+     */
+    virtual void init();
+
+    /** \brief Configure serial device based on JSON object
+     *
+     * Valid keys:
+     *  - `device`: Path to serial device
+     *  - `baudrate`: Baud rate (default: `"B19200"`)
+     *  - `parityBit`: Enable parity bit (default: `false`)
+     *  - `twoStopBits`: Use two stop bits instead of one (default: `false`)
+     *  - `flowControl`: Enable hardware flow control (default: `false`)
+     *  - `charsize`: Size of a character (default: `"C8"`)
+     *  - `timeout`: Timeout in seconds (default: `1` second)
+     *
+     * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json& config);
+
+    /** \brief Set timeout
+     *
+     * If serial port is open, the timeout is updated.
+     *
+     * \param timeout Timeout in seconds
+     */
+    void setTimeout(float timeout);
+
+    /** \brief Retrieve current timeout
+     *
+     * \return Timeout in seconds
+     */
+    float getTimeout();
+
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     * \param length Number of characters in `buf` that should be sent
+     */
+    virtual void send(char* buf, size_t length);
+
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     */
+    virtual void send(const std::string& buf);
+
+    /** Read data from device
+     *
+     * Returns any characters available in the buffer, waiting up
+     * to `timeout` if no data is available.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \return Received data
+     */
+    virtual std::string receive();
+
+    /** Read data from device
+     *
+     * Returns any characters available in the buffer, waiting up
+     * to `timeout` if no data is available.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Buffer where to store results
+     * \param length Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    virtual uint32_t receive(char* buf, size_t length);
+
+    /** Write data to device and receive reply
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param cmd Data to be sent
+     *
+     * \return Returned data
+     */
+    virtual std::string sendreceive(const std::string& cmd);
+
+    /** Write data to device and receive reply
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param wbuf Data to be sent
+     * \param wlength Number of characters in `wbuf` that should be sent
+     * \param rbuf Buffer where to store results
+     * \param rlength Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    virtual void sendreceive(char* wbuf, size_t wlength, char* rbuf,
+                             size_t rlength);
+
+    /** Flush any data in the device buffers
+     */
+    void flush();
+
+    /** Toggle the Data Terminal Ready pin
+     *
+     * \param on New DTR value
+     */
+    void setDTR(bool on);
+
+    /** Request exlusive access to device.
+     *
+     * If a single hardware bus is used to connect multiple devices,
+     * the access to all of them should be locked to remove changes
+     * of cross-talk.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     */
+    virtual void lock();
+
+    /** Release exlusive access to device.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     */
+    virtual void unlock();
+
+ private:
+    /** \brief Configure device for serial communication
+     */
+    void config();
+
+    /** Configuration @{ */
+
+    /// Name of device
+    std::string m_port;
+
+    /// Baud rate to use
+    speed_t m_baudrate = B19200;
+
+    /// Use parity bit
+    bool m_parityBit = false;
+
+    // Use two stop bits intead of one
+    bool m_twoStopBits = false;
+
+    // Enable hardware flow control
+    bool m_flowControl = false;
+
+    // Size of a character
+    CharSize m_charsize = CharSize::CharSize8;
+
+    // Timeout
+    float m_timeout = 1;
+
+    /** @} */
+
+    /** Run-time variables @{ */
+
+    //! File handle for communication
+    int m_dev = 0;
+
+    //! Current settings
+    struct termios m_tty;
+
+    //! Settings frm before config
+    struct termios m_tty_old;
+
+    //! Count number of lock() calls on this device
+    uint32_t m_lock_counter = 0;
+
+    /** @} */
+
+    //! Maximum number of characters to read using string buffers
+    static const unsigned MAX_READ = 4096;
+
+    //! Temporary buffer for ::read()
+    char m_tmpbuf[MAX_READ];
+
+    //! Maps valid baud rate settings to `speed_t` type
+    static const std::unordered_map<std::string, speed_t> mapBAUDRATE;
+
+    //! Maps valid char size settings to `CharSize` type
+    static const std::unordered_map<std::string, SerialCom::CharSize>
+        mapCHARSIZE;
 };
 
 #endif
diff --git a/src/libCom/TextSerialCom.cpp b/src/libCom/TextSerialCom.cpp
old mode 100755
new mode 100644
index ab84bbd5..3fe63fef
--- a/src/libCom/TextSerialCom.cpp
+++ b/src/libCom/TextSerialCom.cpp
@@ -1,96 +1,92 @@
 #include "TextSerialCom.h"
-#include "Logger.h"
 
 #include <fcntl.h>
-#include <unistd.h>
 #include <termios.h>
+#include <unistd.h>
 
 #include <cerrno>
 #include <cstring>
 #include <stdexcept>
 
-//Register com
+#include "Logger.h"
+
+// Register com
 #include "ComRegistry.h"
 REGISTER_COM(TextSerialCom)
 
-TextSerialCom::TextSerialCom(const std::string& port, speed_t baud, bool parityBit, bool twoStopBits, bool flowControl, CharSize charsize)
-  : SerialCom(port, baud, parityBit, twoStopBits, flowControl, charsize)
-{ }
+TextSerialCom::TextSerialCom(const std::string& port, speed_t baud,
+                             bool parityBit, bool twoStopBits, bool flowControl,
+                             CharSize charsize)
+    : SerialCom(port, baud, parityBit, twoStopBits, flowControl, charsize) {}
 
-TextSerialCom::TextSerialCom()
-  : SerialCom()
-{ }
+TextSerialCom::TextSerialCom() : SerialCom() {}
 
-void TextSerialCom::setTermination(const std::string& termination)
-{ m_termination=termination; }
+void TextSerialCom::setTermination(const std::string& termination) {
+    m_termination = termination;
+}
 
-std::string TextSerialCom::termination() const
-{ return m_termination; }
+std::string TextSerialCom::termination() const { return m_termination; }
 
-void TextSerialCom::setConfiguration(const nlohmann::json& config)
-{
-  SerialCom::setConfiguration(config);
+void TextSerialCom::setConfiguration(const nlohmann::json& config) {
+    SerialCom::setConfiguration(config);
 
-  for (const auto &kv : config.items())
-    {
-      if(kv.key()=="termination")
-	{
-	  m_termination=kv.value();
-	}
+    for (const auto& kv : config.items()) {
+        if (kv.key() == "termination") {
+            m_termination = kv.value();
+        }
     }
 }
 
-void TextSerialCom::send(const std::string& buf)
-{
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << buf;
-  SerialCom::send(buf+m_termination);
+void TextSerialCom::send(const std::string& buf) {
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << buf;
+    SerialCom::send(buf + m_termination);
 }
 
-void TextSerialCom::send(char *buf, size_t length)
-{
-  send(std::string(buf,length));
+void TextSerialCom::send(char* buf, size_t length) {
+    send(std::string(buf, length));
 }
 
-std::string TextSerialCom::receive()
-{
-  lock();
-  std::string buf;
-  std::string newbuf;
-  do
-    {
-      newbuf=SerialCom::receive();
-      if(newbuf.size()==0)
-	throw std::runtime_error("TextSerialCom: Read timeout reached without seeing termination.");
-      buf+=newbuf;
-    }
-  while(buf.size()<m_termination.size() || buf.substr(buf.size()-m_termination.size())!=m_termination);
-  unlock();
-
-  // rstrip termination
-  buf=buf.substr(0,buf.size()-m_termination.size());
-
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
-
-  return buf;
+std::string TextSerialCom::receive() {
+    lock();
+    std::string buf;
+    std::string newbuf;
+    do {
+        newbuf = SerialCom::receive();
+        if (newbuf.size() == 0)
+            throw std::runtime_error(
+                "TextSerialCom: Read timeout reached without seeing "
+                "termination.");
+        buf += newbuf;
+    } while (buf.size() < m_termination.size() ||
+             buf.substr(buf.size() - m_termination.size()) != m_termination);
+    unlock();
+
+    // rstrip termination
+    buf = buf.substr(0, buf.size() - m_termination.size());
+
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
+
+    return buf;
 }
 
-uint32_t TextSerialCom::receive(char *buf, size_t length)
-{
-  lock();
-  uint32_t n_read=0;
-  uint32_t tmp_n_read=0;
-  do
-    {
-      tmp_n_read=SerialCom::receive(buf+n_read, length-n_read);
-      if(tmp_n_read==0)
-	throw std::runtime_error("TextSerialCom: Read timeout reached without seeing termination.");
-      n_read+=tmp_n_read;
-    }
-  while(n_read<m_termination.size() || strncmp(buf+n_read-m_termination.size(), m_termination.c_str(), m_termination.size())!=0);
-  unlock();
-
-  // rstrip new lines from end
-  n_read-=m_termination.size();
-
-  return n_read;
+uint32_t TextSerialCom::receive(char* buf, size_t length) {
+    lock();
+    uint32_t n_read = 0;
+    uint32_t tmp_n_read = 0;
+    do {
+        tmp_n_read = SerialCom::receive(buf + n_read, length - n_read);
+        if (tmp_n_read == 0)
+            throw std::runtime_error(
+                "TextSerialCom: Read timeout reached without seeing "
+                "termination.");
+        n_read += tmp_n_read;
+    } while (n_read < m_termination.size() ||
+             strncmp(buf + n_read - m_termination.size(), m_termination.c_str(),
+                     m_termination.size()) != 0);
+    unlock();
+
+    // rstrip new lines from end
+    n_read -= m_termination.size();
+
+    return n_read;
 }
diff --git a/src/libCom/TextSerialCom.h b/src/libCom/TextSerialCom.h
old mode 100755
new mode 100644
index 2ff3dd2d..986203ec
--- a/src/libCom/TextSerialCom.h
+++ b/src/libCom/TextSerialCom.h
@@ -3,7 +3,7 @@
 
 #include "SerialCom.h"
 
-/** 
+/**
  * Implementation of block serial communication with POSIX
  * receive/send calls that uses ASCII strings for data
  * transmission.
@@ -12,84 +12,86 @@
  * string that is stripped internally. The termination is configurable
  * via the `termination` JSON paramater. By default, it is a single `\n`.
  */
-class TextSerialCom : public SerialCom
-{
-public:
-  /** \brief Create serial communication object and set settings
-   * @param port Device corresponding to the serial port
-   * @param baud Baud rate to use
-   * @param useParityBit Use parity bit
-   * @param twoStopBits Use two stop bits instead of one
-   * @param flowControl Enable hardware flow control
-   * @param charsize Size of a character
-   */
-  TextSerialCom(const std::string& port, speed_t baud=B19200, bool parityBit=false, bool twoStopBits=false, bool flowControl=false, CharSize charsize=CharSize::CharSize8);
-  TextSerialCom();
+class TextSerialCom : public SerialCom {
+ public:
+    /** \brief Create serial communication object and set settings
+     * @param port Device corresponding to the serial port
+     * @param baud Baud rate to use
+     * @param useParityBit Use parity bit
+     * @param twoStopBits Use two stop bits instead of one
+     * @param flowControl Enable hardware flow control
+     * @param charsize Size of a character
+     */
+    TextSerialCom(const std::string& port, speed_t baud = B19200,
+                  bool parityBit = false, bool twoStopBits = false,
+                  bool flowControl = false,
+                  CharSize charsize = CharSize::CharSize8);
+    TextSerialCom();
 
-  ~TextSerialCom() =default;
+    ~TextSerialCom() = default;
 
-  /** \brief Set termination string
-   * \param termination New termination string
-   */
-  void setTermination(const std::string& termination);
+    /** \brief Set termination string
+     * \param termination New termination string
+     */
+    void setTermination(const std::string& termination);
 
-  /**
-   * \return Current termination string
-   */
-  std::string termination() const;
+    /**
+     * \return Current termination string
+     */
+    std::string termination() const;
 
-  /** \brief Configure serial device based on JSON object
-   *
-   * Valid keys:
-   *  - `termination`: terminating string for data packets
-   *
-   * \param config JSON configuration
-   */
-  virtual void setConfiguration(const nlohmann::json& config);
-  
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   * \param length Number of characters in `buf` that should be sent
-   */  
-  virtual void send(char *buf, size_t length);
+    /** \brief Configure serial device based on JSON object
+     *
+     * Valid keys:
+     *  - `termination`: terminating string for data packets
+     *
+     * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json& config);
 
-  /** Send data to device
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Data to be sent
-   */
-  virtual void send(const std::string& buf);
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     * \param length Number of characters in `buf` that should be sent
+     */
+    virtual void send(char* buf, size_t length);
 
-  /** Read data from device
-   *
-   * The serial port is read until the termination is detected.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \return Received data
-   */  
-  virtual std::string receive();
+    /** Send data to device
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Data to be sent
+     */
+    virtual void send(const std::string& buf);
 
-  /** Read data from device
-   *
-   * The serial port is read until the termination is detected.
-   *
-   * Throw `std::runtime_error` on error.
-   *
-   * \param buf Buffer where to store results 
-   * \param length Number of characters to receive.
-   *
-   * \return Number of characters received
-   */
-  virtual uint32_t receive(char *buf, size_t length);
+    /** Read data from device
+     *
+     * The serial port is read until the termination is detected.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \return Received data
+     */
+    virtual std::string receive();
 
-private:
-  //! Termination string for data packets
-  std::string m_termination ="\n";
+    /** Read data from device
+     *
+     * The serial port is read until the termination is detected.
+     *
+     * Throw `std::runtime_error` on error.
+     *
+     * \param buf Buffer where to store results
+     * \param length Number of characters to receive.
+     *
+     * \return Number of characters received
+     */
+    virtual uint32_t receive(char* buf, size_t length);
+
+ private:
+    //! Termination string for data packets
+    std::string m_termination = "\n";
 };
 
 #endif
diff --git a/src/libCom/python.cpp b/src/libCom/python.cpp
old mode 100755
new mode 100644
index cf71f99a..b720220a
--- a/src/libCom/python.cpp
+++ b/src/libCom/python.cpp
@@ -1,351 +1,186 @@
-#include "pybind11_json/pybind11_json.hpp"
-#include "nlohmann/json.hpp"
 #include <pybind11/pybind11.h>
 #include <pybind11/stl.h>
 
+#include "CharDeviceCom.h"
+#include "GPIBSerialCom.h"
 #include "ICom.h"
 #include "SerialCom.h"
 #include "TextSerialCom.h"
-#include "GPIBSerialCom.h"
-#include "CharDeviceCom.h"
+#include "nlohmann/json.hpp"
+#include "pybind11_json/pybind11_json.hpp"
 
 namespace py = pybind11;
 
 class PyICom : public ICom {
-public:
+ public:
     /* Inherit the constructors */
     using ICom::ICom;
 
-    void init() override {
-      PYBIND11_OVERLOAD_PURE(
-          void,
-          ICom,
-          init,
-      );
-    }
-    void setConfiguration(const nl::json& config) override {
-      PYBIND11_OVERLOAD_PURE(
-          void,
-          ICom,
-          setConfiguration,
-          config
-      );
+    void init() override { PYBIND11_OVERLOAD_PURE(void, ICom, init, ); }
+    void setConfiguration(const nl::json &config) override {
+        PYBIND11_OVERLOAD_PURE(void, ICom, setConfiguration, config);
     }
     void send(char *buf, size_t length) override {
-      PYBIND11_OVERLOAD_PURE(
-        void,
-        ICom,
-        send,
-        buf,
-        length
-      );
+        PYBIND11_OVERLOAD_PURE(void, ICom, send, buf, length);
     }
-    void send(const std::string& buf) override {
-      PYBIND11_OVERLOAD_PURE(
-        void,
-        ICom,
-        send,
-        buf
-      );
+    void send(const std::string &buf) override {
+        PYBIND11_OVERLOAD_PURE(void, ICom, send, buf);
     }
     std::string receive() override {
-      PYBIND11_OVERLOAD_PURE(
-          std::string,
-          ICom,
-          receive,
-      );
+        PYBIND11_OVERLOAD_PURE(std::string, ICom, receive, );
     }
     uint32_t receive(char *buf, size_t length) override {
-      PYBIND11_OVERLOAD_PURE(
-          uint32_t,
-          ICom,
-          receive,
-          buf,
-          length
-      );
-    }
-    std::string sendreceive(const std::string& cmd) override {
-      PYBIND11_OVERLOAD_PURE(
-          std::string,
-          ICom,
-          sendreceive,
-          cmd
-      );
+        PYBIND11_OVERLOAD_PURE(uint32_t, ICom, receive, buf, length);
     }
-    void sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength) override {
-      PYBIND11_OVERLOAD_PURE(
-          void,
-          ICom,
-          sendreceive,
-          wbuf,
-          wlength,
-          rbuf,
-          rlength
-      );
+    std::string sendreceive(const std::string &cmd) override {
+        PYBIND11_OVERLOAD_PURE(std::string, ICom, sendreceive, cmd);
     }
-    void lock() override {
-      PYBIND11_OVERLOAD_PURE(
-          void,
-          ICom,
-          lock,
-      );
-    }
-    void unlock() override {
-      PYBIND11_OVERLOAD_PURE(
-          void,
-          ICom,
-          unlock,
-      );
+    void sendreceive(char *wbuf, size_t wlength, char *rbuf,
+                     size_t rlength) override {
+        PYBIND11_OVERLOAD_PURE(void, ICom, sendreceive, wbuf, wlength, rbuf,
+                               rlength);
     }
+    void lock() override { PYBIND11_OVERLOAD_PURE(void, ICom, lock, ); }
+    void unlock() override { PYBIND11_OVERLOAD_PURE(void, ICom, unlock, ); }
 };
 
 // template trampoline to reduce code duplication
-template <class ComBase = SerialCom> class PyCom: public ComBase {
-public:
+template <class ComBase = SerialCom>
+class PyCom : public ComBase {
+ public:
     /* Inherit the constructors */
     using ComBase::ComBase;
 
-    void init() override {
-      PYBIND11_OVERLOAD(
-          void,
-          ComBase,
-          init,
-      );
-    }
-    void setConfiguration(const nl::json& config) override {
-      PYBIND11_OVERLOAD(
-          void,
-          ComBase,
-          setConfiguration,
-          config
-      );
+    void init() override { PYBIND11_OVERLOAD(void, ComBase, init, ); }
+    void setConfiguration(const nl::json &config) override {
+        PYBIND11_OVERLOAD(void, ComBase, setConfiguration, config);
     }
     void send(char *buf, size_t length) override {
-      PYBIND11_OVERLOAD(
-        void,
-        ComBase,
-        send,
-        buf,
-        length
-      );
+        PYBIND11_OVERLOAD(void, ComBase, send, buf, length);
     }
-    void send(const std::string& buf) override {
-      PYBIND11_OVERLOAD(
-        void,
-        ComBase,
-        send,
-        buf
-      );
+    void send(const std::string &buf) override {
+        PYBIND11_OVERLOAD(void, ComBase, send, buf);
     }
     std::string receive() override {
-      PYBIND11_OVERLOAD(
-          std::string,
-          ComBase,
-          receive,
-      );
+        PYBIND11_OVERLOAD(std::string, ComBase, receive, );
     }
     uint32_t receive(char *buf, size_t length) override {
-      PYBIND11_OVERLOAD(
-          uint32_t,
-          ComBase,
-          receive,
-          buf,
-          length
-      );
-    }
-    std::string sendreceive(const std::string& cmd) override {
-      PYBIND11_OVERLOAD(
-          std::string,
-          ComBase,
-          sendreceive,
-          cmd
-      );
+        PYBIND11_OVERLOAD(uint32_t, ComBase, receive, buf, length);
     }
-    void sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength) override {
-      PYBIND11_OVERLOAD(
-          void,
-          ComBase,
-          sendreceive,
-          wbuf,
-          wlength,
-          rbuf,
-          rlength
-      );
+    std::string sendreceive(const std::string &cmd) override {
+        PYBIND11_OVERLOAD(std::string, ComBase, sendreceive, cmd);
     }
-    void lock() override {
-      PYBIND11_OVERLOAD(
-          void,
-          ComBase,
-          lock,
-      );
-    }
-    void unlock() override {
-      PYBIND11_OVERLOAD(
-          void,
-          ComBase,
-          unlock,
-      );
+    void sendreceive(char *wbuf, size_t wlength, char *rbuf,
+                     size_t rlength) override {
+        PYBIND11_OVERLOAD(void, ComBase, sendreceive, wbuf, wlength, rbuf,
+                          rlength);
     }
+    void lock() override { PYBIND11_OVERLOAD(void, ComBase, lock, ); }
+    void unlock() override { PYBIND11_OVERLOAD(void, ComBase, unlock, ); }
 };
 
 class PyTextSerialCom : public TextSerialCom {
-public:
+ public:
     /* Inherit the constructors */
     using TextSerialCom::TextSerialCom;
 
-    void setConfiguration(const nl::json& config) override {
-      PYBIND11_OVERLOAD(
-          void,
-          TextSerialCom,
-          setConfiguration,
-          config
-      );
+    void setConfiguration(const nl::json &config) override {
+        PYBIND11_OVERLOAD(void, TextSerialCom, setConfiguration, config);
     }
     void send(char *buf, size_t length) override {
-      PYBIND11_OVERLOAD(
-        void,
-        TextSerialCom,
-        send,
-        buf,
-        length
-      );
+        PYBIND11_OVERLOAD(void, TextSerialCom, send, buf, length);
     }
-    void send(const std::string& buf) override {
-      PYBIND11_OVERLOAD(
-        void,
-        TextSerialCom,
-        send,
-        buf
-      );
+    void send(const std::string &buf) override {
+        PYBIND11_OVERLOAD(void, TextSerialCom, send, buf);
     }
     std::string receive() override {
-      PYBIND11_OVERLOAD(
-          std::string,
-          TextSerialCom,
-          receive,
-      );
+        PYBIND11_OVERLOAD(std::string, TextSerialCom, receive, );
     }
     uint32_t receive(char *buf, size_t length) override {
-      PYBIND11_OVERLOAD(
-          uint32_t,
-          TextSerialCom,
-          receive,
-          buf,
-          length
-      );
+        PYBIND11_OVERLOAD(uint32_t, TextSerialCom, receive, buf, length);
     }
 };
 
 class PyGPIBSerialCom : public GPIBSerialCom {
-public:
+ public:
     /* Inherit the constructors */
     using GPIBSerialCom::GPIBSerialCom;
 
-    void init() override {
-      PYBIND11_OVERLOAD(
-          void,
-          PyGPIBSerialCom,
-          init,
-      );
-    }
-    void setConfiguration(const nl::json& config) override {
-      PYBIND11_OVERLOAD(
-          void,
-          GPIBSerialCom,
-          setConfiguration,
-          config
-      );
+    void init() override { PYBIND11_OVERLOAD(void, PyGPIBSerialCom, init, ); }
+    void setConfiguration(const nl::json &config) override {
+        PYBIND11_OVERLOAD(void, GPIBSerialCom, setConfiguration, config);
     }
     void send(char *buf, size_t length) override {
-      PYBIND11_OVERLOAD(
-        void,
-        GPIBSerialCom,
-        send,
-        buf,
-        length
-      );
+        PYBIND11_OVERLOAD(void, GPIBSerialCom, send, buf, length);
     }
-    void send(const std::string& buf) override {
-      PYBIND11_OVERLOAD(
-        void,
-        GPIBSerialCom,
-        send,
-        buf
-      );
+    void send(const std::string &buf) override {
+        PYBIND11_OVERLOAD(void, GPIBSerialCom, send, buf);
     }
     std::string receive() override {
-      PYBIND11_OVERLOAD(
-          std::string,
-          GPIBSerialCom,
-          receive,
-      );
+        PYBIND11_OVERLOAD(std::string, GPIBSerialCom, receive, );
     }
     uint32_t receive(char *buf, size_t length) override {
-      PYBIND11_OVERLOAD(
-          uint32_t,
-          GPIBSerialCom,
-          receive,
-          buf,
-          length
-      );
+        PYBIND11_OVERLOAD(uint32_t, GPIBSerialCom, receive, buf, length);
     }
 };
 
-void register_com(py::module& m){
-  py::class_<ICom, PyICom, std::shared_ptr<ICom>>(m, "ICom")
-    .def(py::init())
-    .def("init", &ICom::init)
-    .def("is_open", &ICom::is_open)
-    .def("setConfiguration", &ICom::setConfiguration)
-    .def("send", (void (ICom::*)(char *, size_t)) &ICom::send)
-    .def("send", (void (ICom::*)(const std::string&)) &ICom::send)
-    .def("receive", (std::string (ICom::*)()) &ICom::receive)
-    .def("receive", (uint32_t (ICom::*)(char *, size_t)) &ICom::receive)
-    .def("sendreceive", (std::string (ICom::*)(const std::string&)) &ICom::sendreceive)
-    .def("sendreceive", (void (ICom::*)(char *, size_t, char *, size_t)) &ICom::sendreceive)
-    .def("lock", &ICom::lock)
-    .def("unlock", &ICom::unlock);
-
-  py::class_<CharDeviceCom, PyCom<CharDeviceCom>, ICom, std::shared_ptr<CharDeviceCom>>(m, "CharDeviceCom")
-    .def(py::init<const std::string &>());
-
-  py::class_<SerialCom, PyCom<SerialCom>, ICom, std::shared_ptr<SerialCom>> py_serialcom(m, "SerialCom");
-  // nb: enum defined first because it is used in py_serialcom init() default
-  py::enum_<SerialCom::CharSize>(py_serialcom, "CharSize")
-    .value("CharSize5", SerialCom::CharSize::CharSize5)
-    .value("CharSize6", SerialCom::CharSize::CharSize6)
-    .value("CharSize7", SerialCom::CharSize::CharSize7)
-    .value("CharSize8", SerialCom::CharSize::CharSize8);
-
-  py_serialcom
-    .def(py::init<const std::string&, speed_t, bool, bool, bool, SerialCom::CharSize>(),
-        py::arg("port"),
-        py::arg("baud") = B19200,
-        py::arg("parityBit") = false,
-        py::arg("twoStopBits") = false,
-        py::arg("flowControl") = false,
-        py::arg("charsize") = SerialCom::CharSize::CharSize8)
-    .def("flush", &SerialCom::flush)
-    .def("setTimeout", &SerialCom::setTimeout);
-
-  py::class_<TextSerialCom, PyTextSerialCom, SerialCom, std::shared_ptr<TextSerialCom>>(m, "TextSerialCom")
-    .def(py::init<const std::string&, speed_t, bool, bool, bool, SerialCom::CharSize>(),
-        py::arg("port"),
-        py::arg("baud") = B19200,
-        py::arg("parityBit") = false,
-        py::arg("twoStopBits") = false,
-        py::arg("flowControl") = false,
-        py::arg("charsize") = SerialCom::CharSize::CharSize8)
-    .def("setTermination", &TextSerialCom::setTermination)
-    .def("termination", &TextSerialCom::termination);
-
-  py::class_<GPIBSerialCom, PyGPIBSerialCom, TextSerialCom, std::shared_ptr<GPIBSerialCom>>(m, "GPIBSerialCom")
-    .def(py::init<uint16_t, const std::string&, speed_t, bool, bool, bool, SerialCom::CharSize>(),
-        py::arg("gpib_addr"),
-        py::arg("port"),
-        py::arg("baud") = B19200,
-        py::arg("parityBit") = false,
-        py::arg("twoStopBits") = false,
-        py::arg("flowControl") = false,
-        py::arg("charsize") = SerialCom::CharSize::CharSize8);
+void register_com(py::module &m) {
+    py::class_<ICom, PyICom, std::shared_ptr<ICom>>(m, "ICom")
+        .def(py::init())
+        .def("init", &ICom::init)
+        .def("is_open", &ICom::is_open)
+        .def("setConfiguration", &ICom::setConfiguration)
+        .def("send", (void (ICom::*)(char *, size_t)) & ICom::send)
+        .def("send", (void (ICom::*)(const std::string &)) & ICom::send)
+        .def("receive", (std::string(ICom::*)()) & ICom::receive)
+        .def("receive", (uint32_t(ICom::*)(char *, size_t)) & ICom::receive)
+        .def("sendreceive",
+             (std::string(ICom::*)(const std::string &)) & ICom::sendreceive)
+        .def("sendreceive", (void (ICom::*)(char *, size_t, char *, size_t)) &
+                                ICom::sendreceive)
+        .def("lock", &ICom::lock)
+        .def("unlock", &ICom::unlock);
+
+    py::class_<CharDeviceCom, PyCom<CharDeviceCom>, ICom,
+               std::shared_ptr<CharDeviceCom>>(m, "CharDeviceCom")
+        .def(py::init<const std::string &>());
+
+    py::class_<SerialCom, PyCom<SerialCom>, ICom, std::shared_ptr<SerialCom>>
+        py_serialcom(m, "SerialCom");
+    // nb: enum defined first because it is used in py_serialcom init() default
+    py::enum_<SerialCom::CharSize>(py_serialcom, "CharSize")
+        .value("CharSize5", SerialCom::CharSize::CharSize5)
+        .value("CharSize6", SerialCom::CharSize::CharSize6)
+        .value("CharSize7", SerialCom::CharSize::CharSize7)
+        .value("CharSize8", SerialCom::CharSize::CharSize8);
+
+    py_serialcom
+        .def(py::init<const std::string &, speed_t, bool, bool, bool,
+                      SerialCom::CharSize>(),
+             py::arg("port"), py::arg("baud") = B19200,
+             py::arg("parityBit") = false, py::arg("twoStopBits") = false,
+             py::arg("flowControl") = false,
+             py::arg("charsize") = SerialCom::CharSize::CharSize8)
+        .def("flush", &SerialCom::flush)
+        .def("setTimeout", &SerialCom::setTimeout);
+
+    py::class_<TextSerialCom, PyTextSerialCom, SerialCom,
+               std::shared_ptr<TextSerialCom>>(m, "TextSerialCom")
+        .def(py::init<const std::string &, speed_t, bool, bool, bool,
+                      SerialCom::CharSize>(),
+             py::arg("port"), py::arg("baud") = B19200,
+             py::arg("parityBit") = false, py::arg("twoStopBits") = false,
+             py::arg("flowControl") = false,
+             py::arg("charsize") = SerialCom::CharSize::CharSize8)
+        .def("setTermination", &TextSerialCom::setTermination)
+        .def("termination", &TextSerialCom::termination);
+
+    py::class_<GPIBSerialCom, PyGPIBSerialCom, TextSerialCom,
+               std::shared_ptr<GPIBSerialCom>>(m, "GPIBSerialCom")
+        .def(py::init<uint16_t, const std::string &, speed_t, bool, bool, bool,
+                      SerialCom::CharSize>(),
+             py::arg("gpib_addr"), py::arg("port"), py::arg("baud") = B19200,
+             py::arg("parityBit") = false, py::arg("twoStopBits") = false,
+             py::arg("flowControl") = false,
+             py::arg("charsize") = SerialCom::CharSize::CharSize8);
 }
diff --git a/src/libDataSink/CSVSink.cpp b/src/libDataSink/CSVSink.cpp
index cc11113b..43188456 100644
--- a/src/libDataSink/CSVSink.cpp
+++ b/src/libDataSink/CSVSink.cpp
@@ -1,310 +1,274 @@
 #include "CSVSink.h"
-#include "Logger.h"
 
 #include <algorithm>
 #include <iostream>
 #include <sstream>
 
+#include "Logger.h"
 
-#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
 #include <sys/stat.h>
 #endif
 
 #include "DataSinkRegistry.h"
 REGISTER_DATASINK(CSVSink)
 
-CSVSink::CSVSink(const std::string& name)
-  : IDataSink(name)
-{ }
-
-void CSVSink::setConfiguration(const nlohmann::json& config)
-{
-  // check if directory is specified 
-  auto iter = config.find("directory");
-  if (iter == config.end())
-    {
-      throw std::runtime_error("Need to specify directory for CSV sink");
-    }
+CSVSink::CSVSink(const std::string& name) : IDataSink(name) {}
 
-  for (const auto &kv : config.items())
-    {
+void CSVSink::setConfiguration(const nlohmann::json& config) {
+    // check if directory is specified
+    auto iter = config.find("directory");
+    if (iter == config.end()) {
+        throw std::runtime_error("Need to specify directory for CSV sink");
+    }
 
-      if(kv.key()=="directory")
-        {
-          m_directory=kv.value();
+    for (const auto& kv : config.items()) {
+        if (kv.key() == "directory") {
+            m_directory = kv.value();
         }
     }
 }
 
-void CSVSink::init()
-{
-  //
-  // Create the output directory
-#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
-  std::stringstream ss(m_directory);
-  std::string basename;
-  std::string path;
-
-  struct stat sb;
-  while(std::getline(ss, basename, '/'))
-    {
-      path+=(basename+"/");
-
-      if(stat(path.c_str(), &sb) == 0)
-	continue; // Already exists!
-
-      if(mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)
-	throw std::runtime_error("Unable to create directory "+path+": "+std::strerror(errno));
+void CSVSink::init() {
+    //
+    // Create the output directory
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+    std::stringstream ss(m_directory);
+    std::string basename;
+    std::string path;
+
+    struct stat sb;
+    while (std::getline(ss, basename, '/')) {
+        path += (basename + "/");
+
+        if (stat(path.c_str(), &sb) == 0) continue;  // Already exists!
+
+        if (mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)
+            throw std::runtime_error("Unable to create directory " + path +
+                                     ": " + std::strerror(errno));
     }
 #else
-  logger(logWARNING) << "Check that " << m_directory << " exists!";
+    logger(logWARNING) << "Check that " << m_directory << " exists!";
 #endif
-
 }
 
-void CSVSink::setTag(const std::string& name, const std::string& value)
-{
-  std::string newTag = checkCSVEncoding(name);
-  checkTag(newTag);
-  m_tagsString[newTag]=checkCSVEncoding(value);
+void CSVSink::setTag(const std::string& name, const std::string& value) {
+    std::string newTag = checkCSVEncoding(name);
+    checkTag(newTag);
+    m_tagsString[newTag] = checkCSVEncoding(value);
 }
 
-void CSVSink::setTag(const std::string& name, int8_t value)
-{
-  std::string newTag = checkCSVEncoding(name);
-  checkTag(newTag);
-  m_tagsInt8[newTag]=value;
+void CSVSink::setTag(const std::string& name, int8_t value) {
+    std::string newTag = checkCSVEncoding(name);
+    checkTag(newTag);
+    m_tagsInt8[newTag] = value;
 }
 
-void CSVSink::setTag(const std::string& name, int32_t value)
-{
-  std::string newTag = checkCSVEncoding(name);
-  checkTag(newTag);
-  m_tagsInt32[newTag]=value;
+void CSVSink::setTag(const std::string& name, int32_t value) {
+    std::string newTag = checkCSVEncoding(name);
+    checkTag(newTag);
+    m_tagsInt32[newTag] = value;
 }
 
-void CSVSink::setTag(const std::string& name, int64_t value)
-{
-  std::string newTag = checkCSVEncoding(name);
-  checkTag(newTag);
-  m_tagsInt64[newTag]=value;
+void CSVSink::setTag(const std::string& name, int64_t value) {
+    std::string newTag = checkCSVEncoding(name);
+    checkTag(newTag);
+    m_tagsInt64[newTag] = value;
 }
 
-void CSVSink::setTag(const std::string& name, double value)
-{
-  std::string newTag = checkCSVEncoding(name);
-  checkTag(newTag);
-  m_tagsDouble[newTag]=value;
+void CSVSink::setTag(const std::string& name, double value) {
+    std::string newTag = checkCSVEncoding(name);
+    checkTag(newTag);
+    m_tagsDouble[newTag] = value;
 }
 
-void CSVSink::startMeasurement(const std::string& measurement, std::chrono::time_point<std::chrono::system_clock> time)
-{
-  // Clean-up last measurement
-  m_fields.clear();
-  m_fieldsString.clear();
-  m_fieldsInt8  .clear();
-  m_fieldsInt32 .clear();
-  m_fieldsInt64 .clear();
-  m_fieldsDouble.clear();
-
-  // State
-  m_finalSchema=false;
-  m_inMeasurement=true;
-
-  m_measurement=measurement;
-
-  // Convert the timestamp to ms
-  m_timestamp = std::chrono::duration_cast<std::chrono::milliseconds>(time.time_since_epoch()).count();
-
-  std::string fileName = m_directory+"/"+m_measurement+".csv";
-
-  // Check if this file already exists, as we are appending to it and we
-  // want to know (later) if we need to writ the CSV format header (since
-  // we assume that the already existing data format (the column fields) are the same (!!!!)
-  std::ifstream tmp_file(fileName, std::ios_base::out); // open for read will not be good if the file does not exist
-  bool file_already_exists = tmp_file.good();
-  m_header_written = file_already_exists; // here is our assumption on the data format and appending to file
-  tmp_file.close();
-
-  // Open CSV file, appending to it
-  m_ofile.open (fileName, std::ios_base::app);
-  if (!(m_ofile.is_open()))
-    throw std::runtime_error("Could not open file: "+fileName);
+void CSVSink::startMeasurement(
+    const std::string& measurement,
+    std::chrono::time_point<std::chrono::system_clock> time) {
+    // Clean-up last measurement
+    m_fields.clear();
+    m_fieldsString.clear();
+    m_fieldsInt8.clear();
+    m_fieldsInt32.clear();
+    m_fieldsInt64.clear();
+    m_fieldsDouble.clear();
+
+    // State
+    m_finalSchema = false;
+    m_inMeasurement = true;
+
+    m_measurement = measurement;
+
+    // Convert the timestamp to ms
+    m_timestamp = std::chrono::duration_cast<std::chrono::milliseconds>(
+                      time.time_since_epoch())
+                      .count();
+
+    std::string fileName = m_directory + "/" + m_measurement + ".csv";
+
+    // Check if this file already exists, as we are appending to it and we
+    // want to know (later) if we need to writ the CSV format header (since
+    // we assume that the already existing data format (the column fields) are
+    // the same (!!!!)
+    std::ifstream tmp_file(
+        fileName, std::ios_base::out);  // open for read will not be good if the
+                                        // file does not exist
+    bool file_already_exists = tmp_file.good();
+    m_header_written =
+        file_already_exists;  // here is our assumption on the data format and
+                              // appending to file
+    tmp_file.close();
+
+    // Open CSV file, appending to it
+    m_ofile.open(fileName, std::ios_base::app);
+    if (!(m_ofile.is_open()))
+        throw std::runtime_error("Could not open file: " + fileName);
 }
 
-void CSVSink::setField(const std::string& name, const std::string& value)
-{
-  std::string newField = checkCSVEncoding(name);
-  addField(newField);
-  m_fieldsString[newField]=checkCSVEncoding(value);
+void CSVSink::setField(const std::string& name, const std::string& value) {
+    std::string newField = checkCSVEncoding(name);
+    addField(newField);
+    m_fieldsString[newField] = checkCSVEncoding(value);
 }
 
-void CSVSink::setField(const std::string& name, int8_t value)
-{
-  std::string newField = checkCSVEncoding(name);
-  addField(newField);
-  m_fieldsInt8[newField]=value;
+void CSVSink::setField(const std::string& name, int8_t value) {
+    std::string newField = checkCSVEncoding(name);
+    addField(newField);
+    m_fieldsInt8[newField] = value;
 }
 
-void CSVSink::setField(const std::string& name, int32_t value)
-{
-  std::string newField = checkCSVEncoding(name);
-  addField(newField);
-  m_fieldsInt32[newField]=value;
+void CSVSink::setField(const std::string& name, int32_t value) {
+    std::string newField = checkCSVEncoding(name);
+    addField(newField);
+    m_fieldsInt32[newField] = value;
 }
 
-void CSVSink::setField(const std::string& name, int64_t value)
-{
-  std::string newField = checkCSVEncoding(name);
-  addField(newField);
-  m_fieldsInt64[newField]=value;
+void CSVSink::setField(const std::string& name, int64_t value) {
+    std::string newField = checkCSVEncoding(name);
+    addField(newField);
+    m_fieldsInt64[newField] = value;
 }
 
-void CSVSink::setField(const std::string& name, double value)
-{
-  std::string newField = checkCSVEncoding(name);
-  addField(newField);
-  m_fieldsDouble[newField]=value;
+void CSVSink::setField(const std::string& name, double value) {
+    std::string newField = checkCSVEncoding(name);
+    addField(newField);
+    m_fieldsDouble[newField] = value;
 }
 
-void CSVSink::recordPoint()
-{
-  // Print the header
-  if(!m_header_written)
-  {
-    printHeader(m_ofile);
-  }
+void CSVSink::recordPoint() {
+    // Print the header
+    if (!m_header_written) {
+        printHeader(m_ofile);
+    }
 
-  // Print timestamp
-  m_ofile << m_timestamp;
+    // Print timestamp
+    m_ofile << m_timestamp;
 
-  //
-  // Print the tags
-  for(const std::string& tag : m_tags)
-    { 
-      m_ofile << ",";
+    //
+    // Print the tags
+    for (const std::string& tag : m_tags) {
+        m_ofile << ",";
 
-      if(m_tagsString.count(tag)>0)
-	m_ofile << m_tagsString[tag];
+        if (m_tagsString.count(tag) > 0) m_ofile << m_tagsString[tag];
 
-      if(m_tagsInt8.count(tag)>0)
-	m_ofile << m_tagsInt8  [tag];
+        if (m_tagsInt8.count(tag) > 0) m_ofile << m_tagsInt8[tag];
 
-      if(m_tagsInt32.count(tag)>0)
-	m_ofile << m_tagsInt32 [tag];
+        if (m_tagsInt32.count(tag) > 0) m_ofile << m_tagsInt32[tag];
 
-      if(m_tagsInt64.count(tag)>0)
-        m_ofile << m_tagsInt64 [tag];
+        if (m_tagsInt64.count(tag) > 0) m_ofile << m_tagsInt64[tag];
 
-      if(m_tagsDouble.count(tag)>0)
-	m_ofile << m_tagsDouble[tag];
-      
+        if (m_tagsDouble.count(tag) > 0) m_ofile << m_tagsDouble[tag];
     }
 
-  //
-  // Print the fields
-  for(const std::string& field : m_fields)
-    {
-      m_ofile << ","; 
+    //
+    // Print the fields
+    for (const std::string& field : m_fields) {
+        m_ofile << ",";
+
+        if (m_fieldsString.count(field) > 0) m_ofile << m_fieldsString[field];
 
-      if(m_fieldsString.count(field)>0)
-	m_ofile << m_fieldsString[field];
+        if (m_fieldsInt8.count(field) > 0) m_ofile << m_fieldsInt8[field];
 
-      if(m_fieldsInt8.count(field)>0)
-	m_ofile << m_fieldsInt8[field];
+        if (m_fieldsInt32.count(field) > 0) m_ofile << m_fieldsInt32[field];
 
-      if(m_fieldsInt32.count(field)>0)
-        m_ofile << m_fieldsInt32[field];
+        if (m_fieldsInt64.count(field) > 0) m_ofile << m_fieldsInt64[field];
 
-      if(m_fieldsInt64.count(field)>0)
-        m_ofile << m_fieldsInt64[field];
-      
-      if(m_fieldsDouble.count(field)>0)
-	m_ofile << m_fieldsDouble[field];
+        if (m_fieldsDouble.count(field) > 0) m_ofile << m_fieldsDouble[field];
     }
-  m_ofile << std::endl;
+    m_ofile << std::endl;
 
-  // flush the output so that it is written to disk immediately
-  m_ofile.flush();
+    // flush the output so that it is written to disk immediately
+    m_ofile.flush();
 
-  m_finalSchema=true;
+    m_finalSchema = true;
 }
 
-void CSVSink::endMeasurement()
-{
-  m_inMeasurement=false;
-  m_ofile.close();
+void CSVSink::endMeasurement() {
+    m_inMeasurement = false;
+    m_ofile.close();
 }
 
-std::string CSVSink::checkCSVEncoding(const std::string& name)
-{
-  std::string newstr = name;
-
-  // check if the name contains a comma
-  if (name.find(',') != std::string::npos)
-    {
-      size_t start_pos = 0;
-      static const std::string sold = "\"";
-      static const std::string snew = "\"\"";
-
-      // check if string has quotation mark, if so replace by double quotation marks
-      while((start_pos = newstr.find(sold, start_pos)) != std::string::npos) {
-	newstr.replace(start_pos, sold.length(), snew);
-	start_pos += snew.length();
-      }
-
-      // enclose the string in double quotes
-      newstr = "\""+newstr+"\"";
+std::string CSVSink::checkCSVEncoding(const std::string& name) {
+    std::string newstr = name;
+
+    // check if the name contains a comma
+    if (name.find(',') != std::string::npos) {
+        size_t start_pos = 0;
+        static const std::string sold = "\"";
+        static const std::string snew = "\"\"";
+
+        // check if string has quotation mark, if so replace by double quotation
+        // marks
+        while ((start_pos = newstr.find(sold, start_pos)) !=
+               std::string::npos) {
+            newstr.replace(start_pos, sold.length(), snew);
+            start_pos += snew.length();
+        }
+
+        // enclose the string in double quotes
+        newstr = "\"" + newstr + "\"";
     }
-  return newstr;      
+    return newstr;
 }
 
+void CSVSink::checkTag(const std::string& name) {
+    if (checkReserved(name))
+        throw std::runtime_error("Tag name \"" + name + "\" is reserved.");
 
-void CSVSink::checkTag(const std::string& name)
-{
-  if(checkReserved(name))
-    throw std::runtime_error("Tag name \""+name+"\" is reserved.");
+    if (std::find(m_tags.begin(), m_tags.end(), name) == m_tags.end()) {
+        if (m_inMeasurement)
+            throw std::runtime_error(
+                "CSVSink: Cannot change tag during measurement.");
 
-
-  if(std::find(m_tags.begin(), m_tags.end(), name)==m_tags.end())
-    {
-      if(m_inMeasurement)
-	throw std::runtime_error("CSVSink: Cannot change tag during measurement.");
-
-      m_tags.push_back(name);
+        m_tags.push_back(name);
     }
-
 }
 
-void CSVSink::addField(const std::string& name)
-{
-  if(checkReserved(name))
-    throw std::runtime_error("Tag name \""+name+"\" is reserved.");
+void CSVSink::addField(const std::string& name) {
+    if (checkReserved(name))
+        throw std::runtime_error("Tag name \"" + name + "\" is reserved.");
 
-  if(std::find(m_fields.begin(), m_fields.end(), name)==m_fields.end())
-    {
-      if(m_finalSchema)
-	throw std::runtime_error("CSVSink: Cannot add new fields after the first recordPoint.");
+    if (std::find(m_fields.begin(), m_fields.end(), name) == m_fields.end()) {
+        if (m_finalSchema)
+            throw std::runtime_error(
+                "CSVSink: Cannot add new fields after the first recordPoint.");
 
-      m_fields.push_back(name);
+        m_fields.push_back(name);
     }
 }
 
-void CSVSink::printHeader(std::ofstream& ofile)
-{
-  ofile << "time";
+void CSVSink::printHeader(std::ofstream& ofile) {
+    ofile << "time";
 
-  // Print out the tags
-  for(const std::string& tag : m_tags)
-    {
-      ofile << "," << tag ;
+    // Print out the tags
+    for (const std::string& tag : m_tags) {
+        ofile << "," << tag;
     }
 
-  // Print field names
-  for(const std::string& field : m_fields)
-    {
-      ofile << "," << field;
+    // Print field names
+    for (const std::string& field : m_fields) {
+        ofile << "," << field;
     }
-  ofile << std::endl;
-  m_header_written = true;
+    ofile << std::endl;
+    m_header_written = true;
 }
diff --git a/src/libDataSink/CSVSink.h b/src/libDataSink/CSVSink.h
index a1fd9b7d..fe118825 100644
--- a/src/libDataSink/CSVSink.h
+++ b/src/libDataSink/CSVSink.h
@@ -1,152 +1,155 @@
 #ifndef CSVSINK_H
 #define CSVSINK_H
 
-#include <vector>
-#include <unordered_map>
 #include <fstream>
+#include <unordered_map>
+#include <vector>
 
 #include "IDataSink.h"
 
 //! \brief Data sink that saves to CSV files with comma delimiter
 /**
- * When a data point is recorded, the following are saved in this order, separated by a comma:
+ * When a data point is recorded, the following are saved in this order,
+ * separated by a comma:
  * - timestamp (under column heading time)
- * - tags 
+ * - tags
  * - fields
  *
- * The header (time, tag names, and field names) are written to a file when a file is first created.
+ * The header (time, tag names, and field names) are written to a file when a
+ * file is first created.
  */
-class CSVSink : public IDataSink
-{
-public:
-  CSVSink(const std::string& name);
-
-  //! \brief Configure file sink based on JSON object
-  /**
-   * Valid keys:
-   *  - directory: output directory where files are saved (required)
-   *
-   * \param config JSON configuration
-   */
-  virtual void setConfiguration(const nlohmann::json& config);
-
-  //! Initialize sink
-  /**
-   * Attemps to create `directory`, if it does not already exist.
-   */
-  virtual void init();
-
-  virtual void setTag(const std::string& name, const std::string& value);
-  virtual void setTag(const std::string& name, int8_t  value);
-  virtual void setTag(const std::string& name, int32_t value);
-  virtual void setTag(const std::string& name, int64_t value);
-  virtual void setTag(const std::string& name, double value);
-
-  virtual void startMeasurement(const std::string& measurement, std::chrono::time_point<std::chrono::system_clock> time);
-  virtual void setField(const std::string& name, const std::string& value);
-  virtual void setField(const std::string& name, int8_t  value);
-  virtual void setField(const std::string& name, int32_t value);
-  virtual void setField(const std::string& name, int64_t value);
-  virtual void setField(const std::string& name, double value);
-
-  //! \brief Save data point to CSV
-  /**
-   * Saves the fields in the current data points in csv file. If the header
-   * needs to be written to file, it is also done here.
-   * The timestamp will be uploaded with milliseconds precision.
-   */
-  virtual void recordPoint();
-  virtual void endMeasurement();
-
-private:
-  //! \brief Check if string contains CSV character
-  /** 
-   * Check if the string contains a comma or double quote.
-   * 
-   * If the string contains a comma, return the string in double-quotes. 
-   * If the string contains quotes and a comma, the quotation mark will be escaped.
-   *
-   * \param name string to be check.
-   *
-   * return encoded string if string contains a comma.
-   * else return original name.
-   */
-  std::string checkCSVEncoding(const std::string& name);
-
-  //! \brief Checks whether a tag can be added
-  /**
-   * If tag is not defined, then it is added to the list.
-   *
-   * Marks tags as dirty.
-   *
-   * Error checking is performed. An exception is thrown if
-   *  - Currently performing a measurement
-   *
-   * \param name Field name
-   */
-  void checkTag(const std::string& name);
-
-  //! \brief Adds a new field column if it already does not exists. 
-  /**
-   * If field is already defined, nothing is done.
-   *
-   * Error checking is performed. An exception is thrown if
-   *  - called after the first `recordPoint` in a measurement
-   *
-   * \param name Field name
-   */
-  void addField(const std::string& name);
-
-  //! \brief write the header
-  /**
-   * write the header in the format.
-   *  Tag1 Tag 2 FIELD1 FIELD2 FIELD3
-   *
-   * \param ofile file to save the measurement
-   */
-  void printHeader(std::ofstream& ofile);
-
-  //
-  // Directory where files are saved
-  std::string m_directory;
-
-  //
-  // State
-
-  // timestamp
-  unsigned long long m_timestamp;
-
-  // Output CSV file
-  std::ofstream m_ofile;
-
-  // Name of the current measurement (valid onyl if performing one)
-  std::string m_measurement;
-
-  // Currently performing a measurement
-  bool m_inMeasurement=false;
-
-  // Whether or not the field header has been written
-  bool m_header_written;
-
-  //
-  // Data store for fields
-  bool m_finalSchema=false;  // The measurement schema is locked
-  std::vector<std::string> m_fields;
-  std::unordered_map<std::string, std::string> m_fieldsString;
-  std::unordered_map<std::string, int8_t     > m_fieldsInt8 ;
-  std::unordered_map<std::string, int32_t    > m_fieldsInt32;
-  std::unordered_map<std::string, int64_t    > m_fieldsInt64;
-  std::unordered_map<std::string, double     > m_fieldsDouble;
-
-  //
-  // Data store for tags
-  std::vector<std::string> m_tags;
-  std::unordered_map<std::string, std::string> m_tagsString;
-  std::unordered_map<std::string, int8_t     > m_tagsInt8 ;
-  std::unordered_map<std::string, int32_t    > m_tagsInt32;
-  std::unordered_map<std::string, int64_t    > m_tagsInt64;
-  std::unordered_map<std::string, double     > m_tagsDouble;
-
+class CSVSink : public IDataSink {
+ public:
+    CSVSink(const std::string& name);
+
+    //! \brief Configure file sink based on JSON object
+    /**
+     * Valid keys:
+     *  - directory: output directory where files are saved (required)
+     *
+     * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json& config);
+
+    //! Initialize sink
+    /**
+     * Attemps to create `directory`, if it does not already exist.
+     */
+    virtual void init();
+
+    virtual void setTag(const std::string& name, const std::string& value);
+    virtual void setTag(const std::string& name, int8_t value);
+    virtual void setTag(const std::string& name, int32_t value);
+    virtual void setTag(const std::string& name, int64_t value);
+    virtual void setTag(const std::string& name, double value);
+
+    virtual void startMeasurement(
+        const std::string& measurement,
+        std::chrono::time_point<std::chrono::system_clock> time);
+    virtual void setField(const std::string& name, const std::string& value);
+    virtual void setField(const std::string& name, int8_t value);
+    virtual void setField(const std::string& name, int32_t value);
+    virtual void setField(const std::string& name, int64_t value);
+    virtual void setField(const std::string& name, double value);
+
+    //! \brief Save data point to CSV
+    /**
+     * Saves the fields in the current data points in csv file. If the header
+     * needs to be written to file, it is also done here.
+     * The timestamp will be uploaded with milliseconds precision.
+     */
+    virtual void recordPoint();
+    virtual void endMeasurement();
+
+ private:
+    //! \brief Check if string contains CSV character
+    /**
+     * Check if the string contains a comma or double quote.
+     *
+     * If the string contains a comma, return the string in double-quotes.
+     * If the string contains quotes and a comma, the quotation mark will be
+     * escaped.
+     *
+     * \param name string to be check.
+     *
+     * return encoded string if string contains a comma.
+     * else return original name.
+     */
+    std::string checkCSVEncoding(const std::string& name);
+
+    //! \brief Checks whether a tag can be added
+    /**
+     * If tag is not defined, then it is added to the list.
+     *
+     * Marks tags as dirty.
+     *
+     * Error checking is performed. An exception is thrown if
+     *  - Currently performing a measurement
+     *
+     * \param name Field name
+     */
+    void checkTag(const std::string& name);
+
+    //! \brief Adds a new field column if it already does not exists.
+    /**
+     * If field is already defined, nothing is done.
+     *
+     * Error checking is performed. An exception is thrown if
+     *  - called after the first `recordPoint` in a measurement
+     *
+     * \param name Field name
+     */
+    void addField(const std::string& name);
+
+    //! \brief write the header
+    /**
+     * write the header in the format.
+     *  Tag1 Tag 2 FIELD1 FIELD2 FIELD3
+     *
+     * \param ofile file to save the measurement
+     */
+    void printHeader(std::ofstream& ofile);
+
+    //
+    // Directory where files are saved
+    std::string m_directory;
+
+    //
+    // State
+
+    // timestamp
+    unsigned long long m_timestamp;
+
+    // Output CSV file
+    std::ofstream m_ofile;
+
+    // Name of the current measurement (valid onyl if performing one)
+    std::string m_measurement;
+
+    // Currently performing a measurement
+    bool m_inMeasurement = false;
+
+    // Whether or not the field header has been written
+    bool m_header_written;
+
+    //
+    // Data store for fields
+    bool m_finalSchema = false;  // The measurement schema is locked
+    std::vector<std::string> m_fields;
+    std::unordered_map<std::string, std::string> m_fieldsString;
+    std::unordered_map<std::string, int8_t> m_fieldsInt8;
+    std::unordered_map<std::string, int32_t> m_fieldsInt32;
+    std::unordered_map<std::string, int64_t> m_fieldsInt64;
+    std::unordered_map<std::string, double> m_fieldsDouble;
+
+    //
+    // Data store for tags
+    std::vector<std::string> m_tags;
+    std::unordered_map<std::string, std::string> m_tagsString;
+    std::unordered_map<std::string, int8_t> m_tagsInt8;
+    std::unordered_map<std::string, int32_t> m_tagsInt32;
+    std::unordered_map<std::string, int64_t> m_tagsInt64;
+    std::unordered_map<std::string, double> m_tagsDouble;
 };
 
-#endif // CSVSINK_H
+#endif  // CSVSINK_H
diff --git a/src/libDataSink/CombinedSink.cpp b/src/libDataSink/CombinedSink.cpp
index ad2239a2..3bcead30 100644
--- a/src/libDataSink/CombinedSink.cpp
+++ b/src/libDataSink/CombinedSink.cpp
@@ -3,93 +3,102 @@
 #include "DataSinkRegistry.h"
 REGISTER_DATASINK(CombinedSink)
 
-CombinedSink::CombinedSink(const std::string& name)
-  : IDataSink(name)
-{ }
+CombinedSink::CombinedSink(const std::string& name) : IDataSink(name) {}
 
-void CombinedSink::setConfiguration(const nlohmann::json& config)
-{ }
+void CombinedSink::setConfiguration(const nlohmann::json& config) {}
 
-void CombinedSink::addSink(std::shared_ptr<IDataSink> sink)
-{ m_sinks.push_back(sink); }
+void CombinedSink::addSink(std::shared_ptr<IDataSink> sink) {
+    m_sinks.push_back(sink);
+}
 
-void CombinedSink::init()
-{ }
+void CombinedSink::init() {}
 
-void CombinedSink::setTag(const std::string& name, const std::string& value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setTag(name, value); });
+void CombinedSink::setTag(const std::string& name, const std::string& value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setTag(name, value);
+                  });
 }
 
-void CombinedSink::setTag(const std::string& name, int8_t value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setTag(name, value); });
+void CombinedSink::setTag(const std::string& name, int8_t value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setTag(name, value);
+                  });
 }
 
-void CombinedSink::setTag(const std::string& name, int32_t value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setTag(name, value); });
+void CombinedSink::setTag(const std::string& name, int32_t value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setTag(name, value);
+                  });
 }
 
-void CombinedSink::setTag(const std::string& name, int64_t value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setTag(name, value); });
+void CombinedSink::setTag(const std::string& name, int64_t value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setTag(name, value);
+                  });
 }
 
-void CombinedSink::setTag(const std::string& name, double value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setTag(name, value); });
+void CombinedSink::setTag(const std::string& name, double value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setTag(name, value);
+                  });
 }
 
-void CombinedSink::startMeasurement(const std::string& measurement, std::chrono::time_point<std::chrono::system_clock> time)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&measurement, &time](std::shared_ptr<IDataSink> sink){ sink->startMeasurement(measurement, time); });
+void CombinedSink::startMeasurement(
+    const std::string& measurement,
+    std::chrono::time_point<std::chrono::system_clock> time) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&measurement, &time](std::shared_ptr<IDataSink> sink) {
+                      sink->startMeasurement(measurement, time);
+                  });
 }
 
-void CombinedSink::setField(const std::string& name, const std::string& value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setField(name, value); });
+void CombinedSink::setField(const std::string& name, const std::string& value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setField(name, value);
+                  });
 }
 
-void CombinedSink::setField(const std::string& name, int8_t value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setField(name, value); });
+void CombinedSink::setField(const std::string& name, int8_t value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setField(name, value);
+                  });
 }
 
-void CombinedSink::setField(const std::string& name, int32_t value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setField(name, value); });
+void CombinedSink::setField(const std::string& name, int32_t value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setField(name, value);
+                  });
 }
 
-void CombinedSink::setField(const std::string& name, int64_t value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setField(name, value); });
+void CombinedSink::setField(const std::string& name, int64_t value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setField(name, value);
+                  });
 }
 
-void CombinedSink::setField(const std::string& name, double value)
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[&name, &value](std::shared_ptr<IDataSink> sink){ sink->setField(name, value); });
+void CombinedSink::setField(const std::string& name, double value) {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [&name, &value](std::shared_ptr<IDataSink> sink) {
+                      sink->setField(name, value);
+                  });
 }
 
-void CombinedSink::recordPoint()
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[](std::shared_ptr<IDataSink> sink){ sink->recordPoint(); });
+void CombinedSink::recordPoint() {
+    std::for_each(m_sinks.begin(), m_sinks.end(),
+                  [](std::shared_ptr<IDataSink> sink) { sink->recordPoint(); });
 }
 
-void CombinedSink::endMeasurement()
-{
-  std::for_each(m_sinks.begin(), m_sinks.end(),
-		[](std::shared_ptr<IDataSink> sink){ sink->endMeasurement(); });
+void CombinedSink::endMeasurement() {
+    std::for_each(
+        m_sinks.begin(), m_sinks.end(),
+        [](std::shared_ptr<IDataSink> sink) { sink->endMeasurement(); });
 }
diff --git a/src/libDataSink/CombinedSink.h b/src/libDataSink/CombinedSink.h
index 68a4b6a2..022473ac 100644
--- a/src/libDataSink/CombinedSink.h
+++ b/src/libDataSink/CombinedSink.h
@@ -7,58 +7,61 @@
 
 //! \brief Data sink that handles saving data to multiple sinks.
 /**
- * All requests are directly forwarded to all sub-sinks registered with the `addSink` command.
+ * All requests are directly forwarded to all sub-sinks registered with the
+ * `addSink` command.
  *
- * The data streams used by DataSinkConf::getDataStream are instances of CombinedSink. See 
- * the DataSinkConf documentation on how to define data streams in JSON files.
+ * The data streams used by DataSinkConf::getDataStream are instances of
+ * CombinedSink. See the DataSinkConf documentation on how to define data
+ * streams in JSON files.
  */
-class CombinedSink : public IDataSink
-{
-public:
-  CombinedSink(const std::string& name);
+class CombinedSink : public IDataSink {
+ public:
+    CombinedSink(const std::string& name);
 
-  //! \brief Configure sink based on JSON object
-  /**
-   * Valid keys:
-   *  - no configuration
-   *
-   * \param config JSON configuration
-   */
-  virtual void setConfiguration(const nlohmann::json& config);
+    //! \brief Configure sink based on JSON object
+    /**
+     * Valid keys:
+     *  - no configuration
+     *
+     * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json& config);
 
-  //! \brief Does nothing
-  /**
-   * Sub-sinks should be initialized during their creation
-   */
-  virtual void init();
+    //! \brief Does nothing
+    /**
+     * Sub-sinks should be initialized during their creation
+     */
+    virtual void init();
 
-  //! \brief Add a sub-sink
-  /**
-   * Adds a sub-sink to the list of sinks for forwarding of all
-   * commands.
-   *
-   * \param sink Sub-sink to add.
-   */
-  void addSink(std::shared_ptr<IDataSink> sink);
+    //! \brief Add a sub-sink
+    /**
+     * Adds a sub-sink to the list of sinks for forwarding of all
+     * commands.
+     *
+     * \param sink Sub-sink to add.
+     */
+    void addSink(std::shared_ptr<IDataSink> sink);
 
-  virtual void setTag(const std::string& name, const std::string& value);
-  virtual void setTag(const std::string& name, int8_t  value);
-  virtual void setTag(const std::string& name, int32_t value);
-  virtual void setTag(const std::string& name, int64_t value);
-  virtual void setTag(const std::string& name, double value);
+    virtual void setTag(const std::string& name, const std::string& value);
+    virtual void setTag(const std::string& name, int8_t value);
+    virtual void setTag(const std::string& name, int32_t value);
+    virtual void setTag(const std::string& name, int64_t value);
+    virtual void setTag(const std::string& name, double value);
 
-  virtual void startMeasurement(const std::string& measurement, std::chrono::time_point<std::chrono::system_clock> time);
-  virtual void setField(const std::string& name, const std::string& value);
-  virtual void setField(const std::string& name, int8_t  value);
-  virtual void setField(const std::string& name, int32_t value);
-  virtual void setField(const std::string& name, int64_t value);
-  virtual void setField(const std::string& name, double value);
+    virtual void startMeasurement(
+        const std::string& measurement,
+        std::chrono::time_point<std::chrono::system_clock> time);
+    virtual void setField(const std::string& name, const std::string& value);
+    virtual void setField(const std::string& name, int8_t value);
+    virtual void setField(const std::string& name, int32_t value);
+    virtual void setField(const std::string& name, int64_t value);
+    virtual void setField(const std::string& name, double value);
 
-  virtual void recordPoint();
-  virtual void endMeasurement();
+    virtual void recordPoint();
+    virtual void endMeasurement();
 
-private:
-  std::vector<std::shared_ptr<IDataSink>> m_sinks;
+ private:
+    std::vector<std::shared_ptr<IDataSink>> m_sinks;
 };
 
-#endif // COMBINEDSINK_H
+#endif  // COMBINEDSINK_H
diff --git a/src/libDataSink/ConsoleSink.cpp b/src/libDataSink/ConsoleSink.cpp
index 1cb5b753..aa84cbe9 100644
--- a/src/libDataSink/ConsoleSink.cpp
+++ b/src/libDataSink/ConsoleSink.cpp
@@ -1,221 +1,188 @@
 #include "ConsoleSink.h"
 
 #include <algorithm>
-#include <iostream>
 #include <iomanip>
+#include <iostream>
 
 #include "DataSinkRegistry.h"
 REGISTER_DATASINK(ConsoleSink)
 
-ConsoleSink::ConsoleSink(const std::string& name)
-  : IDataSink(name)
-{ }
+ConsoleSink::ConsoleSink(const std::string& name) : IDataSink(name) {}
 
-void ConsoleSink::setConfiguration(const nlohmann::json& config)
-{
+void ConsoleSink::setConfiguration(const nlohmann::json& config) {
     // iterate over configuration items
-    for(const auto & item : config.items())
-    {
-        if(item.key() == "column_width")
-        {
+    for (const auto& item : config.items()) {
+        if (item.key() == "column_width") {
             m_col_width = static_cast<int>(item.value());
         }
-    } // item
+    }  // item
 }
 
-void ConsoleSink::init()
-{ }
+void ConsoleSink::init() {}
 
-void ConsoleSink::setTag(const std::string& name, const std::string& value)
-{
-  checkTag(name);
-  m_tagsString[name]=value;
+void ConsoleSink::setTag(const std::string& name, const std::string& value) {
+    checkTag(name);
+    m_tagsString[name] = value;
 }
 
-void ConsoleSink::setTag(const std::string& name, int8_t  value)
-{
-  checkTag(name);
-  m_tagsInt8 [name]=value;
+void ConsoleSink::setTag(const std::string& name, int8_t value) {
+    checkTag(name);
+    m_tagsInt8[name] = value;
 }
 
-void ConsoleSink::setTag(const std::string& name, int32_t value)
-{
-  checkTag(name);
-  m_tagsInt32[name]=value;
+void ConsoleSink::setTag(const std::string& name, int32_t value) {
+    checkTag(name);
+    m_tagsInt32[name] = value;
 }
 
-void ConsoleSink::setTag(const std::string& name, int64_t value)
-{
-  checkTag(name);
-  m_tagsInt64[name]=value;
+void ConsoleSink::setTag(const std::string& name, int64_t value) {
+    checkTag(name);
+    m_tagsInt64[name] = value;
 }
 
-void ConsoleSink::setTag(const std::string& name, double value)
-{
-  checkTag(name);
-  m_tagsDouble[name]=value;
+void ConsoleSink::setTag(const std::string& name, double value) {
+    checkTag(name);
+    m_tagsDouble[name] = value;
 }
 
-void ConsoleSink::startMeasurement(const std::string& measurement, std::chrono::time_point<std::chrono::system_clock> time)
-{
-  // Clean-up last measurement
-  m_fields.clear();
-  m_fieldsString.clear();
-  m_fieldsInt8  .clear();
-  m_fieldsInt32 .clear();
-  m_fieldsInt64 .clear();
-  m_fieldsDouble.clear();
+void ConsoleSink::startMeasurement(
+    const std::string& measurement,
+    std::chrono::time_point<std::chrono::system_clock> time) {
+    // Clean-up last measurement
+    m_fields.clear();
+    m_fieldsString.clear();
+    m_fieldsInt8.clear();
+    m_fieldsInt32.clear();
+    m_fieldsInt64.clear();
+    m_fieldsDouble.clear();
 
-  // State
-  m_finalSchema=false;
-  m_inMeasurement=true;
+    // State
+    m_finalSchema = false;
+    m_inMeasurement = true;
 
-  m_currMeasurement=measurement;
+    m_currMeasurement = measurement;
 }
 
-void ConsoleSink::setField(const std::string& name, const std::string& value)
-{
-  addField(name);
-  m_fieldsString[name]=value;
+void ConsoleSink::setField(const std::string& name, const std::string& value) {
+    addField(name);
+    m_fieldsString[name] = value;
 }
 
-void ConsoleSink::setField(const std::string& name, int8_t  value)
-{
-  addField(name);
-  m_fieldsInt8 [name]=value;
+void ConsoleSink::setField(const std::string& name, int8_t value) {
+    addField(name);
+    m_fieldsInt8[name] = value;
 }
 
-void ConsoleSink::setField(const std::string& name, int32_t value)
-{
-  addField(name);
-  m_fieldsInt32[name]=value;
+void ConsoleSink::setField(const std::string& name, int32_t value) {
+    addField(name);
+    m_fieldsInt32[name] = value;
 }
 
-void ConsoleSink::setField(const std::string& name, int64_t value)
-{
-  addField(name);
-  m_fieldsInt64[name]=value;
+void ConsoleSink::setField(const std::string& name, int64_t value) {
+    addField(name);
+    m_fieldsInt64[name] = value;
 }
 
-void ConsoleSink::setField(const std::string& name, double value)
-{
-  addField(name);
-  m_fieldsDouble[name]=value;
+void ConsoleSink::setField(const std::string& name, double value) {
+    addField(name);
+    m_fieldsDouble[name] = value;
 }
 
-void ConsoleSink::recordPoint()
-{
-  bool same=(m_currMeasurement==m_lastMeasurement)&&(m_fields==m_lastFields)&&(!m_dirty);
+void ConsoleSink::recordPoint() {
+    bool same = (m_currMeasurement == m_lastMeasurement) &&
+                (m_fields == m_lastFields) && (!m_dirty);
 
-  //
-  // Print the header
-  if(!same)
-    { // First time recording point for measurement, print header
-      printHeader();
-      m_dirty=false;
+    //
+    // Print the header
+    if (!same) {  // First time recording point for measurement, print header
+        printHeader();
+        m_dirty = false;
     }
 
-  //
-  // Print the fields
-  for(const std::string& field : m_fields)
-    {
-      if(m_fieldsString.count(field)>0)
-      {
-    	std::cout << std::setw(m_col_width)
-                  << m_fieldsString[field].substr(0, m_col_width-1);
-      }
-
-      if(m_fieldsInt8 .count(field)>0)
-      {
-        std::cout << std::setw(m_col_width) << m_fieldsInt8[field];
-      }
-
-      if(m_fieldsInt32.count(field)>0)
-      {
-        std::cout << std::setw(m_col_width) << m_fieldsInt32[field];
-      }
-
-      if(m_fieldsInt64.count(field)>0)
-      {
-        std::cout << std::setw(m_col_width) << m_fieldsInt64[field];
-      }
-      if(m_fieldsDouble.count(field)>0)
-      {
-        std::cout << std::setw(m_col_width) << std::setprecision(5) << m_fieldsDouble[field];
-      }
+    //
+    // Print the fields
+    for (const std::string& field : m_fields) {
+        if (m_fieldsString.count(field) > 0) {
+            std::cout << std::setw(m_col_width)
+                      << m_fieldsString[field].substr(0, m_col_width - 1);
+        }
+
+        if (m_fieldsInt8.count(field) > 0) {
+            std::cout << std::setw(m_col_width) << m_fieldsInt8[field];
+        }
+
+        if (m_fieldsInt32.count(field) > 0) {
+            std::cout << std::setw(m_col_width) << m_fieldsInt32[field];
+        }
+
+        if (m_fieldsInt64.count(field) > 0) {
+            std::cout << std::setw(m_col_width) << m_fieldsInt64[field];
+        }
+        if (m_fieldsDouble.count(field) > 0) {
+            std::cout << std::setw(m_col_width) << std::setprecision(5)
+                      << m_fieldsDouble[field];
+        }
     }
-  std::cout << std::endl;
+    std::cout << std::endl;
 
-  // Update last configuration
-  m_lastMeasurement=m_currMeasurement;
-  m_lastFields=m_fields;
+    // Update last configuration
+    m_lastMeasurement = m_currMeasurement;
+    m_lastFields = m_fields;
 
-  m_finalSchema=true;
+    m_finalSchema = true;
 }
 
-void ConsoleSink::endMeasurement()
-{
-  m_inMeasurement=false;
-}
+void ConsoleSink::endMeasurement() { m_inMeasurement = false; }
 
-void ConsoleSink::checkTag(const std::string& name)
-{
-  if(checkReserved(name))
-    throw std::runtime_error("Tag name \""+name+"\" is reserved.");
+void ConsoleSink::checkTag(const std::string& name) {
+    if (checkReserved(name))
+        throw std::runtime_error("Tag name \"" + name + "\" is reserved.");
 
-  if(std::find(m_tags.begin(), m_tags.end(), name)==m_tags.end())
-    {
-      if(m_inMeasurement)
-	throw std::runtime_error("ConsoleSink: Cannot change tag during measurement.");
+    if (std::find(m_tags.begin(), m_tags.end(), name) == m_tags.end()) {
+        if (m_inMeasurement)
+            throw std::runtime_error(
+                "ConsoleSink: Cannot change tag during measurement.");
 
-      m_tags.push_back(name);
+        m_tags.push_back(name);
     }
 
-  m_dirty=true;
+    m_dirty = true;
 }
 
-void ConsoleSink::addField(const std::string& name)
-{
-  if(checkReserved(name))
-    throw std::runtime_error("Field name \""+name+"\" is reserved.");
+void ConsoleSink::addField(const std::string& name) {
+    if (checkReserved(name))
+        throw std::runtime_error("Field name \"" + name + "\" is reserved.");
 
-  if(std::find(m_fields.begin(), m_fields.end(), name)==m_fields.end())
-    {
-      if(m_finalSchema)
-	throw std::runtime_error("ConsoleSink: Cannot add new fields after the first recordPoint.");
-      m_fields.push_back(name);
+    if (std::find(m_fields.begin(), m_fields.end(), name) == m_fields.end()) {
+        if (m_finalSchema)
+            throw std::runtime_error(
+                "ConsoleSink: Cannot add new fields after the first "
+                "recordPoint.");
+        m_fields.push_back(name);
     }
 }
 
-void ConsoleSink::printHeader()
-{
-  // Print out the tags
-  for(const std::string& tag : m_tags)
-    {
-      std::cout << tag << ": ";
+void ConsoleSink::printHeader() {
+    // Print out the tags
+    for (const std::string& tag : m_tags) {
+        std::cout << tag << ": ";
 
-      if(m_tagsString.count(tag)>0)
-	std::cout << m_tagsString[tag];
+        if (m_tagsString.count(tag) > 0) std::cout << m_tagsString[tag];
 
-      if(m_tagsInt8 .count(tag)>0)
-	std::cout << m_tagsInt8  [tag];
+        if (m_tagsInt8.count(tag) > 0) std::cout << m_tagsInt8[tag];
 
-      if(m_tagsInt32.count(tag)>0)
-	std::cout << m_tagsInt32 [tag];
+        if (m_tagsInt32.count(tag) > 0) std::cout << m_tagsInt32[tag];
 
-      if(m_tagsInt64.count(tag)>0)
-	std::cout << m_tagsInt64 [tag];
+        if (m_tagsInt64.count(tag) > 0) std::cout << m_tagsInt64[tag];
 
-      if(m_tagsDouble.count(tag)>0)
-	std::cout << m_tagsDouble[tag];
+        if (m_tagsDouble.count(tag) > 0) std::cout << m_tagsDouble[tag];
 
-      std::cout << std::endl;
+        std::cout << std::endl;
     }
 
-  // Print field names
-  for(const std::string& field : m_fields)
-    {
-      std::cout << std::setw(m_col_width) << field;
+    // Print field names
+    for (const std::string& field : m_fields) {
+        std::cout << std::setw(m_col_width) << field;
     }
-  std::cout << std::endl;
+    std::cout << std::endl;
 }
diff --git a/src/libDataSink/ConsoleSink.h b/src/libDataSink/ConsoleSink.h
index 205eb669..912e57b8 100644
--- a/src/libDataSink/ConsoleSink.h
+++ b/src/libDataSink/ConsoleSink.h
@@ -1,14 +1,14 @@
 #ifndef CONSOLESINK_H
 #define CONSOLESINK_H
 
-#include <vector>
 #include <unordered_map>
+#include <vector>
 
 #include "IDataSink.h"
 
 //! \brief Data sink that prints to the console
 /**
- * When a data point is recorded, all fields are printed to the 
+ * When a data point is recorded, all fields are printed to the
  * standard output as a pretty table. The format is as follows:
  *
  * ```
@@ -21,127 +21,130 @@
  *
  * For fields, the columns are taken to have 10 characters by default.
  *
- * The header (tags and the column names) are printed when any of the following happens:
+ * The header (tags and the column names) are printed when any of the following
+ * happens:
  *  - The name of the measurement changes.
  *  - A tag value changes.
  *  - The set of fields changes.
  *
- * The header is not printed just because a previous measurement has been stopped. If
- * the field definitions and tags are the same, the previous header still applies.
+ * The header is not printed just because a previous measurement has been
+ * stopped. If the field definitions and tags are the same, the previous header
+ * still applies.
  */
-class ConsoleSink : public IDataSink
-{
-public:
-  ConsoleSink(const std::string& name);
-
-  //! \brief Reads the output configuration from a JSON object.
-  /**
-   * See an example in `src/configs/input-hw.json`.
-   *
-   * Valid keys:
-   *  - `column_witdth`: Width of each column in characters
-   *
-   * * \param config JSON configuration
-   */
-  virtual void setConfiguration(const nlohmann::json& config);
-  virtual void init();
-
-  virtual void setTag(const std::string& name, const std::string& value);
-  virtual void setTag(const std::string& name, int8_t  value);
-  virtual void setTag(const std::string& name, int32_t value);
-  virtual void setTag(const std::string& name, int64_t value);
-  virtual void setTag(const std::string& name, double value);
-
-  virtual void startMeasurement(const std::string& measurement, std::chrono::time_point<std::chrono::system_clock> time);
-  virtual void setField(const std::string& name, const std::string& value);
-  virtual void setField(const std::string& name, int8_t  value);
-  virtual void setField(const std::string& name, int32_t value);
-  virtual void setField(const std::string& name, int64_t value);
-  virtual void setField(const std::string& name, double value);
-
-  //! \brief Print data point
-  /**
-   * Prints the fields in the current data points. If the header
-   * needs to be reprinted, it is also done here.
-   */
-  virtual void recordPoint();
-  virtual void endMeasurement();
-
-private:
-  //! \brief Checks whether a tag can be added
-  /**
-   * If tag is not defined, then it is added to the list.
-   *
-   * Marks tags as dirty.
-   *
-   * Error checking is performed. An exception is thrown if
-   *  - Currently performing a measurement
-   *
-   * \param name Field name
-   */
-  void checkTag(const std::string& name);
-
-  //! \brief Adds a new field column if it already does not exists. 
-  /**
-   * If field is already defined, nothing is done.
-   *
-   * Error checking is performed. An exception is thrown if
-   *  - called after the first `recordPoint` in a measurement
-   *
-   * \param name Field name
-   */
-  void addField(const std::string& name);
-
-  //! \brief Print the header
-  /**
-   * Prints the header in the format.
-   *  Tag1: value
-   *  ...
-   *  Tagn: value
-   *  FIELD1 FIELD2 FIELD3
-   */
-  void printHeader();
-
-  //
-  // The last state (before endMeasurement)
-
-  // Name of the last measurement
-  std::string m_lastMeasurement;
-
-  // The last columns
-  std::vector<std::string> m_lastFields;
-
-  //
-  // State
-
-  // Name of the current measurement (valid onyl if performing one)
-  std::string m_currMeasurement;
-
-  // Currently performing a measurement
-  bool m_inMeasurement=false;
-
-  // Field width (number of characters allocated for each column entry)
-  int m_col_width=10;
-
-  //
-  // Data store for fields
-  bool m_finalSchema=false;  // The measurement schema is locked
-  std::vector<std::string> m_fields;
-  std::unordered_map<std::string, std::string> m_fieldsString;
-  std::unordered_map<std::string, int8_t     > m_fieldsInt8 ;
-  std::unordered_map<std::string, int32_t    > m_fieldsInt32;
-  std::unordered_map<std::string, int64_t    > m_fieldsInt64;
-  std::unordered_map<std::string, double     > m_fieldsDouble;
-
-  //
-  // Data store for tags
-  bool m_dirty=true; // Tag values have changed, reprint
-  std::vector<std::string> m_tags;
-  std::unordered_map<std::string, std::string> m_tagsString;
-  std::unordered_map<std::string, int8_t     > m_tagsInt8 ;
-  std::unordered_map<std::string, int32_t    > m_tagsInt32;
-  std::unordered_map<std::string, int64_t    > m_tagsInt64;
-  std::unordered_map<std::string, double     > m_tagsDouble;
+class ConsoleSink : public IDataSink {
+ public:
+    ConsoleSink(const std::string& name);
+
+    //! \brief Reads the output configuration from a JSON object.
+    /**
+     * See an example in `src/configs/input-hw.json`.
+     *
+     * Valid keys:
+     *  - `column_witdth`: Width of each column in characters
+     *
+     * * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json& config);
+    virtual void init();
+
+    virtual void setTag(const std::string& name, const std::string& value);
+    virtual void setTag(const std::string& name, int8_t value);
+    virtual void setTag(const std::string& name, int32_t value);
+    virtual void setTag(const std::string& name, int64_t value);
+    virtual void setTag(const std::string& name, double value);
+
+    virtual void startMeasurement(
+        const std::string& measurement,
+        std::chrono::time_point<std::chrono::system_clock> time);
+    virtual void setField(const std::string& name, const std::string& value);
+    virtual void setField(const std::string& name, int8_t value);
+    virtual void setField(const std::string& name, int32_t value);
+    virtual void setField(const std::string& name, int64_t value);
+    virtual void setField(const std::string& name, double value);
+
+    //! \brief Print data point
+    /**
+     * Prints the fields in the current data points. If the header
+     * needs to be reprinted, it is also done here.
+     */
+    virtual void recordPoint();
+    virtual void endMeasurement();
+
+ private:
+    //! \brief Checks whether a tag can be added
+    /**
+     * If tag is not defined, then it is added to the list.
+     *
+     * Marks tags as dirty.
+     *
+     * Error checking is performed. An exception is thrown if
+     *  - Currently performing a measurement
+     *
+     * \param name Field name
+     */
+    void checkTag(const std::string& name);
+
+    //! \brief Adds a new field column if it already does not exists.
+    /**
+     * If field is already defined, nothing is done.
+     *
+     * Error checking is performed. An exception is thrown if
+     *  - called after the first `recordPoint` in a measurement
+     *
+     * \param name Field name
+     */
+    void addField(const std::string& name);
+
+    //! \brief Print the header
+    /**
+     * Prints the header in the format.
+     *  Tag1: value
+     *  ...
+     *  Tagn: value
+     *  FIELD1 FIELD2 FIELD3
+     */
+    void printHeader();
+
+    //
+    // The last state (before endMeasurement)
+
+    // Name of the last measurement
+    std::string m_lastMeasurement;
+
+    // The last columns
+    std::vector<std::string> m_lastFields;
+
+    //
+    // State
+
+    // Name of the current measurement (valid onyl if performing one)
+    std::string m_currMeasurement;
+
+    // Currently performing a measurement
+    bool m_inMeasurement = false;
+
+    // Field width (number of characters allocated for each column entry)
+    int m_col_width = 10;
+
+    //
+    // Data store for fields
+    bool m_finalSchema = false;  // The measurement schema is locked
+    std::vector<std::string> m_fields;
+    std::unordered_map<std::string, std::string> m_fieldsString;
+    std::unordered_map<std::string, int8_t> m_fieldsInt8;
+    std::unordered_map<std::string, int32_t> m_fieldsInt32;
+    std::unordered_map<std::string, int64_t> m_fieldsInt64;
+    std::unordered_map<std::string, double> m_fieldsDouble;
+
+    //
+    // Data store for tags
+    bool m_dirty = true;  // Tag values have changed, reprint
+    std::vector<std::string> m_tags;
+    std::unordered_map<std::string, std::string> m_tagsString;
+    std::unordered_map<std::string, int8_t> m_tagsInt8;
+    std::unordered_map<std::string, int32_t> m_tagsInt32;
+    std::unordered_map<std::string, int64_t> m_tagsInt64;
+    std::unordered_map<std::string, double> m_tagsDouble;
 };
 
-#endif // CONSOLESINK_H
+#endif  // CONSOLESINK_H
diff --git a/src/libDataSink/DataSinkRegistry.cpp b/src/libDataSink/DataSinkRegistry.cpp
index 4ddc98dd..1ff1218d 100644
--- a/src/libDataSink/DataSinkRegistry.cpp
+++ b/src/libDataSink/DataSinkRegistry.cpp
@@ -2,35 +2,31 @@
 
 #include <iostream>
 
-namespace EquipRegistry
-{
+namespace EquipRegistry {
 
-  typedef ClassRegistry<IDataSink, std::string> RegistryDataSink;
+typedef ClassRegistry<IDataSink, std::string> RegistryDataSink;
 
-  static RegistryDataSink &registry()
-  {
+static RegistryDataSink& registry() {
     static RegistryDataSink instance;
     return instance;
-  }
+}
 
-  bool registerDataSink(const std::string& type, std::function<std::shared_ptr<IDataSink>(const std::string&)> f)
-  {
+bool registerDataSink(
+    const std::string& type,
+    std::function<std::shared_ptr<IDataSink>(const std::string&)> f) {
     return registry().registerClass(type, f);
-  }
-  
-  std::shared_ptr<IDataSink> createDataSink(const std::string& type, const std::string& name)
-  {
+}
+
+std::shared_ptr<IDataSink> createDataSink(const std::string& type,
+                                          const std::string& name) {
     auto result = registry().makeClass(type, name);
-    if(result == nullptr)
-      std::cout << "No data formats (IDataSink) of type " << type << " found\n";
+    if (result == nullptr)
+        std::cout << "No data formats (IDataSink) of type " << type
+                  << " found\n";
 
     return result;
-  }
-  
-  std::vector<std::string> listDataSink()
-  {
-    return registry().listClasses();
-  }
-
 }
 
+std::vector<std::string> listDataSink() { return registry().listClasses(); }
+
+}  // namespace EquipRegistry
diff --git a/src/libDataSink/DataSinkRegistry.h b/src/libDataSink/DataSinkRegistry.h
index bfba9c05..ee09e225 100644
--- a/src/libDataSink/DataSinkRegistry.h
+++ b/src/libDataSink/DataSinkRegistry.h
@@ -1,27 +1,29 @@
-#include "ClassRegistry.h"
-#include "IDataSink.h"
-
+#include <functional>
+#include <memory>
 #include <string>
 #include <vector>
-#include <memory>
-#include <functional>
 
-// Configuration helpers and registry for specific sink implementations
-namespace EquipRegistry
-{
-  /** Register new data sink type into registry */
-  bool registerDataSink(const std::string& model,
-			std::function<std::shared_ptr<IDataSink>(const std::string&)> f);
+#include "ClassRegistry.h"
+#include "IDataSink.h"
 
-  /** Get new instance of given sink type */
-  std::shared_ptr<IDataSink> createDataSink(const std::string& model,  const std::string& name);
+// Configuration helpers and registry for specific sink implementations
+namespace EquipRegistry {
+/** Register new data sink type into registry */
+bool registerDataSink(
+    const std::string& model,
+    std::function<std::shared_ptr<IDataSink>(const std::string&)> f);
 
-  /** List available sink types */
-  std::vector<std::string> listDataSink();  
-}
+/** Get new instance of given sink type */
+std::shared_ptr<IDataSink> createDataSink(const std::string& model,
+                                          const std::string& name);
 
-#define REGISTER_DATASINK(model)						\
-  static bool _registered_##model = \
-    EquipRegistry::registerDataSink(#model, \
-    std::function<std::shared_ptr<IDataSink>(const std::string&)>([](const std::string& name) { return std::shared_ptr<IDataSink>(new model(name)); }));
+/** List available sink types */
+std::vector<std::string> listDataSink();
+}  // namespace EquipRegistry
 
+#define REGISTER_DATASINK(model)                                               \
+    static bool _registered_##model = EquipRegistry::registerDataSink(         \
+        #model, std::function<std::shared_ptr<IDataSink>(const std::string&)>( \
+                    [](const std::string& name) {                              \
+                        return std::shared_ptr<IDataSink>(new model(name));    \
+                    }));
diff --git a/src/libDataSink/IDataSink.cpp b/src/libDataSink/IDataSink.cpp
index 64c7be0f..6f640289 100644
--- a/src/libDataSink/IDataSink.cpp
+++ b/src/libDataSink/IDataSink.cpp
@@ -1,10 +1,7 @@
 #include "IDataSink.h"
 
-IDataSink::IDataSink(const std::string& name)
-  : m_name(name)
-{ }
+IDataSink::IDataSink(const std::string& name) : m_name(name) {}
 
-bool IDataSink::checkReserved(const std::string& name)
-{
-  return m_reserved.count(name)>0;
+bool IDataSink::checkReserved(const std::string& name) {
+    return m_reserved.count(name) > 0;
 }
diff --git a/src/libDataSink/IDataSink.h b/src/libDataSink/IDataSink.h
index 1094bdc3..5d06548c 100644
--- a/src/libDataSink/IDataSink.h
+++ b/src/libDataSink/IDataSink.h
@@ -2,72 +2,72 @@
 #define IDATASINK_H
 
 #include <chrono>
+#include <nlohmann/json.hpp>
 #include <set>
 #include <string>
 
-#include <nlohmann/json.hpp>
-
 /**
  * A generic data sink for saving tabular data.
  *
  * A series of data points, grouped by time into measurements,
  * can be streamed into a data sink.
- * 
+ *
  * All classes that inherit from this class have Python bindings
  *
  * # Data Points and Measurements
  * ## Data Points
- * A data point is a collection of basic types (string, double, int) corresponding
- * to different variables. It can be thought of as a row.
+ * A data point is a collection of basic types (string, double, int)
+ * corresponding to different variables. It can be thought of as a row.
  *
  * The end of a data point is indicated using the `recordPoint`.
  *
  * ## Measurement
  *
- * A measurement is a collection of data points grouped by a timestamp. All data points
- * in a measurement must have the same set of variables. The timestamp shared by all data
- * points in a given measurement is defined at the beginning of the said measurement. It
- * is up to the implementation on how to deal with the timestamp.
+ * A measurement is a collection of data points grouped by a timestamp. All data
+ * points in a measurement must have the same set of variables. The timestamp
+ * shared by all data points in a given measurement is defined at the beginning
+ * of the said measurement. It is up to the implementation on how to deal with
+ * the timestamp.
  *
- * A set of measurements can be thought of a large table with the timestamp as a column. The
- * rows with the same time value belong to the same measurement.
+ * A set of measurements can be thought of a large table with the timestamp as a
+ * column. The rows with the same time value belong to the same measurement.
  *
- * The start of a new measurement is indicated using `startMeasurement` and the end
- * with `endMeasurement`. At the start, the name of the measurement and the 
+ * The start of a new measurement is indicated using `startMeasurement` and the
+ * end with `endMeasurement`. At the start, the name of the measurement and the
  * corresponding time needs to be specified.
  *
  * Specific sink implementations can require that measurements sharing the same
- * name use the same set of variables. It is up to the implementation to enforce such
- * a requirement.
+ * name use the same set of variables. It is up to the implementation to enforce
+ * such a requirement.
  *
  * # Variables
  *
  * There are two types of variables and are treated differently; fields and tag.
  *
  * *Tags* correspond to meta-data and are constant for a measurement. They also
- * remain set for the reminded of the data-taking, although values can be changed
- * at any time (outside of a measurement).
+ * remain set for the reminded of the data-taking, although values can be
+ * changed at any time (outside of a measurement).
  *
- * *Fields* correspond to data and are only valid for the duration of a 
+ * *Fields* correspond to data and are only valid for the duration of a
  * measurement. Once set, a field exists until the end of a measurement. A field
  * is not removed by `recordPoint`. Thus data that is constant during
  * a measurement only needs to be set once.
  *
  * The following variable names are reserved and cannot be be used: `time`.
  *
- * Implemetations can use the `checkReserved` function to check whether a 
+ * Implemetations can use the `checkReserved` function to check whether a
  * variable name is reserved.
  *
  * # Saving Data
  *
  * It is up to a specific sink implementation to decide when to save data. For
  * example, the `ConsoleSink` prints out data as soon as a data point completes.
- * But the `JSONSink`, due to the more complex structure, writes data to disk once
- * a measurement ends.
+ * But the `JSONSink`, due to the more complex structure, writes data to disk
+ * once a measurement ends.
  *
- * The `recordPoint` and `endMeasurement` are used to indicate to the implementation
- * at which point a data point or measurement ends. However there is no requirement
- * in which function the actual data saving needs to happen.
+ * The `recordPoint` and `endMeasurement` are used to indicate to the
+ * implementation at which point a data point or measurement ends. However there
+ * is no requirement in which function the actual data saving needs to happen.
  *
  * # Example
  *
@@ -78,10 +78,11 @@
  * while(forever)
  *  {
  *    // Run IV scan
- *    datasink->setTag("module", "myFirstModule"); // present for all data points in ivscan
- *    datasink->startMeasurement("ivscan", std::chrono::system_clock::now());
- *    datasink->setField("Ilimit", ps->getCurrentProtect()); // present for all data points in ivscan
- *    for(double V=0; V<1000; V+=100)
+ *    datasink->setTag("module", "myFirstModule"); // present for all data
+ * points in ivscan datasink->startMeasurement("ivscan",
+ * std::chrono::system_clock::now()); datasink->setField("Ilimit",
+ * ps->getCurrentProtect()); // present for all data points in ivscan for(double
+ * V=0; V<1000; V+=100)
  *      {
  *        ps->setVoltageLevel(V);
  *        datasink->setField("I", ps->measureCurrent());
@@ -89,170 +90,172 @@
  *        datasink->recordPoint();
  *      }
  *    datasink->endMeasurement();
- * 
+ *
  *    // Monitor climate for the next minute
  *    for(every second for minute)
  *      {
  *        // Record a data point
- *        datasink->startMeasurement("climate", std::chrono::system_clock::now());
- *        datasink->setField("temperature", measureTemperature());
- *        datasink->setField("humidity", measureHumidity());
+ *        datasink->startMeasurement("climate",
+ * std::chrono::system_clock::now()); datasink->setField("temperature",
+ * measureTemperature()); datasink->setField("humidity", measureHumidity());
  *        datasink->recordPoint();
  *        datasink->endMeasurement();
  *      }
  *  }
  * ```
  */
-class IDataSink
-{
-public:
-  /**
-   * Create a sink with name.
-   *
-   * \param name Name of sink for identification
-   */
-  IDataSink(const std::string& name);
+class IDataSink {
+ public:
+    /**
+     * Create a sink with name.
+     *
+     * \param name Name of sink for identification
+     */
+    IDataSink(const std::string& name);
+
+    /** \brief Set communication settings from JSON object
+     *
+     * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json& config) = 0;
+
+    /** \brief Initialize data sink
+     *
+     * Should be called after all settings are set and before any
+     * data is saved.
+     */
+    virtual void init() = 0;
+
+    /** \name Tags
+     * @{
+     */
+
+    /**
+     * Set tag of type string.
+     *
+     * \param name Tag name
+     * \param value Tag value
+     */
+    virtual void setTag(const std::string& name, const std::string& value) = 0;
+
+    /**
+     * Set tag of type int8_t
+     *
+     * \param name Tag name
+     * \param value Tag value
+     */
+    virtual void setTag(const std::string& name, int8_t value) = 0;
 
-  /** \brief Set communication settings from JSON object                        
-   *                                                                            
-   * \param config JSON configuration                                           
-   */
-  virtual void setConfiguration(const nlohmann::json& config) =0;
+    /**
+     * Set tag of type int32_t
+     *
+     * \param name Tag name
+     * \param value Tag value
+     */
+    virtual void setTag(const std::string& name, int32_t value) = 0;
 
-  /** \brief Initialize data sink
-   *
-   * Should be called after all settings are set and before any
-   * data is saved.
-   */
-  virtual void init() =0;
-  
-  /** \name Tags
-   * @{
-   */
+    /**
+     * Set tag of type int64_t
+     *
+     * \param name Tag name
+     * \param value Tag value
+     */
+    virtual void setTag(const std::string& name, int64_t value) = 0;
 
-  /**
-   * Set tag of type string.
-   *
-   * \param name Tag name
-   * \param value Tag value
-   */
-  virtual void setTag(const std::string& name, const std::string& value) =0;
+    /**
+     * Set tag of type double
+     *
+     * \param name Tag name
+     * \param value Tag value
+     */
+    virtual void setTag(const std::string& name, double value) = 0;
 
-  /**
-   * Set tag of type int8_t
-   *
-   * \param name Tag name
-   * \param value Tag value
-   */
-  virtual void setTag(const std::string& name, int8_t  value) =0;
+    /** @} */
 
-  /**
-   * Set tag of type int32_t
-   *
-   * \param name Tag name
-   * \param value Tag value
-   */
-  virtual void setTag(const std::string& name, int32_t value) =0;
-  
-  /**
-   * Set tag of type int64_t
-   *
-   * \param name Tag name
-   * \param value Tag value
-   */
-  virtual void setTag(const std::string& name, int64_t value) =0;
-  
-  /**
-   * Set tag of type double
-   *
-   * \param name Tag name
-   * \param value Tag value
-   */
-  virtual void setTag(const std::string& name, double value) =0;
+    /** \name Measurement
+     * @{
+     */
 
-  /** @} */
+    /**
+     * Indicates the start of a measurement.
+     *
+     * All field variables should be reset at this point.
+     *
+     * \param measurement Name of the measurement
+     * \param time Timestamp corresponding to the data in the measurement.
+     */
+    virtual void startMeasurement(
+        const std::string& measurement,
+        std::chrono::time_point<std::chrono::system_clock> time) = 0;
 
-  /** \name Measurement
-   * @{
-   */
+    /**
+     * Set field of type string
+     *
+     * \param name Field name
+     * \param value Field value
+     */
+    virtual void setField(const std::string& name,
+                          const std::string& value) = 0;
 
-  /**
-   * Indicates the start of a measurement.
-   *
-   * All field variables should be reset at this point.
-   *
-   * \param measurement Name of the measurement
-   * \param time Timestamp corresponding to the data in the measurement.
-   */
-  virtual void startMeasurement(const std::string& measurement, std::chrono::time_point<std::chrono::system_clock> time) =0;
+    /**
+     * Set field of type int8_t
+     *
+     * \param name Field name
+     * \param value Field value
+     */
+    virtual void setField(const std::string& name, int8_t value) = 0;
 
-  /**
-   * Set field of type string
-   *
-   * \param name Field name
-   * \param value Field value
-   */
-  virtual void setField(const std::string& name, const std::string& value) =0;
+    /**
+     * Set field of type int32_t
+     *
+     * \param name Field name
+     * \param value Field value
+     */
+    virtual void setField(const std::string& name, int32_t value) = 0;
 
-  /**
-   * Set field of type int8_t
-   *
-   * \param name Field name
-   * \param value Field value
-   */
-  virtual void setField(const std::string& name, int8_t  value) =0;
+    /**
+     * Set field of type int64_t
+     *
+     * \param name Field name
+     * \param value Field value
+     */
+    virtual void setField(const std::string& name, int64_t value) = 0;
 
-  /**
-   * Set field of type int32_t
-   *
-   * \param name Field name
-   * \param value Field value
-   */
-  virtual void setField(const std::string& name, int32_t value) =0;
+    /**
+     * Set field of type double
+     *
+     * \param name Field name
+     * \param value Field value
+     */
+    virtual void setField(const std::string& name, double value) = 0;
 
-  /**
-   * Set field of type int64_t
-   *
-   * \param name Field name
-   * \param value Field value
-   */
-  virtual void setField(const std::string& name, int64_t value) =0;
-  
-  /**
-   * Set field of type double
-   *
-   * \param name Field name
-   * \param value Field value
-   */
-  virtual void setField(const std::string& name, double value) =0;
+    /**
+     * Indicates the end of a data point.
+     */
+    virtual void recordPoint() = 0;
 
-  /**
-   * Indicates the end of a data point.
-   */
-  virtual void recordPoint() =0;
+    /**
+     * Indicates the end of a measurement.
+     */
+    virtual void endMeasurement() = 0;
 
-  /**
-   * Indicates the end of a measurement.
-   */
-  virtual void endMeasurement() =0;
+    /** @} */
 
-  /** @} */
+ protected:
+    /**
+     * Check if a variable name is reserved.
+     *
+     * \param name Variable name
+     *
+     * \return True if reserved, false otherwise.
+     */
+    bool checkReserved(const std::string& name);
 
-protected:
-  /**
-   * Check if a variable name is reserved.
-   *
-   * \param name Variable name
-   *
-   * \return True if reserved, false otherwise.
-   */
-  bool checkReserved(const std::string& name);
-  
-private:
-  std::string m_name;
+ private:
+    std::string m_name;
 
-  //! Reserved variable names
-  std::set<std::string> m_reserved={"time"};
+    //! Reserved variable names
+    std::set<std::string> m_reserved = {"time"};
 };
 
-#endif // IDATASINK_H
+#endif  // IDATASINK_H
diff --git a/src/libDataSink/InfluxDBSink.cpp b/src/libDataSink/InfluxDBSink.cpp
index 440f34d9..0c6903df 100644
--- a/src/libDataSink/InfluxDBSink.cpp
+++ b/src/libDataSink/InfluxDBSink.cpp
@@ -6,186 +6,166 @@
 #include "DataSinkRegistry.h"
 REGISTER_DATASINK(InfluxDBSink)
 
-InfluxDBSink::InfluxDBSink(const std::string& name)
-  : IDataSink(name)
-{
-
-}
-void InfluxDBSink::setConfiguration(const nlohmann::json& config){
-  
-  // Read the DB configuration (port, host and database) from 'config'
-  if (config.find("port")   == config.end() ||
-      config.find("host")   == config.end() ||
-      config.find("database") == config.end() )
-      {
+InfluxDBSink::InfluxDBSink(const std::string& name) : IDataSink(name) {}
+void InfluxDBSink::setConfiguration(const nlohmann::json& config) {
+    // Read the DB configuration (port, host and database) from 'config'
+    if (config.find("port") == config.end() ||
+        config.find("host") == config.end() ||
+        config.find("database") == config.end()) {
         throw std::runtime_error(
-        "Please specify 'port' [int], 'host' [str] and 'database' [str] in the \n" \
-        "json configuration file under the correspondent sink. See an example \n" \
-        "in 'src/configs/input-hw.json'"
-        );
-      }
-  else
-  {
-    m_port   = config["port"];
-    m_host   = config["host"];
-    m_dbName = config["database"];
-  }
-
-  // Read also the username and password, if provided
-  if (config.find("username") != config.end() &&
-      config.find("password") != config.end() )
-      {
+            "Please specify 'port' [int], 'host' [str] and 'database' [str] in "
+            "the \n"
+            "json configuration file under the correspondent sink. See an "
+            "example \n"
+            "in 'src/configs/input-hw.json'");
+    } else {
+        m_port = config["port"];
+        m_host = config["host"];
+        m_dbName = config["database"];
+    }
+
+    // Read also the username and password, if provided
+    if (config.find("username") != config.end() &&
+        config.find("password") != config.end()) {
         m_usr = config["username"];
         m_pwd = config["password"];
-      }
+    }
 
-  // Get the precision, if provided
-  if (config.find("precision") != config.end() ) m_prec = config["precision"];
+    // Get the precision, if provided
+    if (config.find("precision") != config.end()) m_prec = config["precision"];
 }
 
-void InfluxDBSink::init()
-{
+void InfluxDBSink::init() {
+    // Initialize the influxdb_cpp object
+    m_si =
+        std::make_shared<influxdb_cpp::server_info>(influxdb_cpp::server_info(
+            m_host, m_port, m_dbName, m_usr, m_pwd, "ns"));
 
-  // Initialize the influxdb_cpp object
-  m_si = std::make_shared<influxdb_cpp::server_info>(influxdb_cpp::server_info(m_host, m_port, m_dbName, m_usr, m_pwd, "ns"));
+    // Check whether the provided database exists
+    m_retval = influxdb_cpp::query(m_resp, "show databases", *m_si);
+    errorCheck(m_retval, m_resp);
 
-  // Check whether the provided database exists
-  m_retval = influxdb_cpp::query(m_resp, "show databases", *m_si);
-  errorCheck(m_retval, m_resp);
-
-  if (m_resp.find(m_dbName) == std::string::npos)
-    throw std::runtime_error("No database \"" + m_dbName + "\" found on the specified server");
+    if (m_resp.find(m_dbName) == std::string::npos)
+        throw std::runtime_error("No database \"" + m_dbName +
+                                 "\" found on the specified server");
 }
 
-void InfluxDBSink::startMeasurement(const std::string& measurement, std::chrono::time_point<std::chrono::system_clock> time)
-{
-  m_measName = measurement;
+void InfluxDBSink::startMeasurement(
+    const std::string& measurement,
+    std::chrono::time_point<std::chrono::system_clock> time) {
+    m_measName = measurement;
 
-  // Convert the timestamp to ns
-  m_timestamp = std::chrono::duration_cast<std::chrono::nanoseconds>(time.time_since_epoch()).count();
+    // Convert the timestamp to ns
+    m_timestamp = std::chrono::duration_cast<std::chrono::nanoseconds>(
+                      time.time_since_epoch())
+                      .count();
 }
 
-void InfluxDBSink::setTag(const std::string& name, const std::string& value){
-  m_tagsString[name] = value;
+void InfluxDBSink::setTag(const std::string& name, const std::string& value) {
+    m_tagsString[name] = value;
 }
-void InfluxDBSink::setTag(const std::string& name, const int8_t value){
-  setTag(name, std::to_string(value));
+void InfluxDBSink::setTag(const std::string& name, const int8_t value) {
+    setTag(name, std::to_string(value));
 }
-void InfluxDBSink::setTag(const std::string& name, const int32_t value){
-  setTag(name, std::to_string(value));
+void InfluxDBSink::setTag(const std::string& name, const int32_t value) {
+    setTag(name, std::to_string(value));
 }
-void InfluxDBSink::setTag(const std::string& name, const int64_t value){
-  setTag(name, std::to_string(value));
+void InfluxDBSink::setTag(const std::string& name, const int64_t value) {
+    setTag(name, std::to_string(value));
 }
-void InfluxDBSink::setTag(const std::string& name, const double value){
-  setTag(name, std::to_string(value));
+void InfluxDBSink::setTag(const std::string& name, const double value) {
+    setTag(name, std::to_string(value));
 }
 
-void InfluxDBSink::setField(const std::string& name, const std::string& value){
-  m_fieldsString[name] = value;
+void InfluxDBSink::setField(const std::string& name, const std::string& value) {
+    m_fieldsString[name] = value;
 }
-void InfluxDBSink::setField(const std::string& name, const int8_t value){
-  m_fieldsInt[name] = value;
+void InfluxDBSink::setField(const std::string& name, const int8_t value) {
+    m_fieldsInt[name] = value;
 }
-void InfluxDBSink::setField(const std::string& name, const int32_t value){
-  m_fieldsInt[name] = value;
+void InfluxDBSink::setField(const std::string& name, const int32_t value) {
+    m_fieldsInt[name] = value;
 }
-void InfluxDBSink::setField(const std::string& name, const int64_t value){
-  m_fieldsInt[name] = value;
+void InfluxDBSink::setField(const std::string& name, const int64_t value) {
+    m_fieldsInt[name] = value;
 }
-void InfluxDBSink::setField(const std::string& name, const double value){
-  m_fieldsDouble[name] = value;
+void InfluxDBSink::setField(const std::string& name, const double value) {
+    m_fieldsDouble[name] = value;
 }
 
-void InfluxDBSink::setPrecision(int precision)
-{
-  m_prec = precision;
-}
+void InfluxDBSink::setPrecision(int precision) { m_prec = precision; }
 
-void InfluxDBSink::recordPoint()
-{
-  // Create InfluxDB object and useful casts
-  influxdb_cpp::builder builder;
-  influxdb_cpp::detail::tag_caller  & tag_caller  =static_cast<influxdb_cpp::detail::tag_caller  &>(builder);
-  influxdb_cpp::detail::field_caller& field_caller=static_cast<influxdb_cpp::detail::field_caller&>(builder);
+void InfluxDBSink::recordPoint() {
+    // Create InfluxDB object and useful casts
+    influxdb_cpp::builder builder;
+    influxdb_cpp::detail::tag_caller& tag_caller =
+        static_cast<influxdb_cpp::detail::tag_caller&>(builder);
+    influxdb_cpp::detail::field_caller& field_caller =
+        static_cast<influxdb_cpp::detail::field_caller&>(builder);
 
-  // Set the measurement name
-  builder.meas(m_measName);
+    // Set the measurement name
+    builder.meas(m_measName);
 
-  // Add tags to the InfluxDB object
-  for (const std::pair<std::string, std::string>& x: m_tagsString)
-    tag_caller.tag(x.first, x.second);
+    // Add tags to the InfluxDB object
+    for (const std::pair<std::string, std::string>& x : m_tagsString)
+        tag_caller.tag(x.first, x.second);
 
-  bool fieldIsInitialized = false;
-  
-  // Add fields to the InfluxDB object
-  for (const std::pair<std::string, double     >& x: m_fieldsDouble)
-    {
-      if(!fieldIsInitialized)
-	{
-	  tag_caller  .field(x.first, x.second, m_prec);
-	  fieldIsInitialized = true;	  
-	}
-      else
-	{
-	  field_caller.field(x.first, x.second, m_prec);
-	}
+    bool fieldIsInitialized = false;
+
+    // Add fields to the InfluxDB object
+    for (const std::pair<std::string, double>& x : m_fieldsDouble) {
+        if (!fieldIsInitialized) {
+            tag_caller.field(x.first, x.second, m_prec);
+            fieldIsInitialized = true;
+        } else {
+            field_caller.field(x.first, x.second, m_prec);
+        }
     }
 
-  for (const std::pair<std::string, int32_t    >& x: m_fieldsInt   )
-    {
-      if(!fieldIsInitialized)
-	{
-	  tag_caller  .field(x.first, x.second);
-	  fieldIsInitialized = true;
-	}
-      else
-	{
-	  field_caller.field(x.first, x.second);
-	}
+    for (const std::pair<std::string, int32_t>& x : m_fieldsInt) {
+        if (!fieldIsInitialized) {
+            tag_caller.field(x.first, x.second);
+            fieldIsInitialized = true;
+        } else {
+            field_caller.field(x.first, x.second);
+        }
     }
 
-  for (const std::pair<std::string, std::string>& x: m_fieldsString)
-    {
-      if(!fieldIsInitialized)
-	{
-	  tag_caller  .field(x.first, x.second);
-	  fieldIsInitialized = true;
-	}
-      else
-	{
-	  field_caller.field(x.first, x.second);
-	}
+    for (const std::pair<std::string, std::string>& x : m_fieldsString) {
+        if (!fieldIsInitialized) {
+            tag_caller.field(x.first, x.second);
+            fieldIsInitialized = true;
+        } else {
+            field_caller.field(x.first, x.second);
+        }
     }
 
-  // Need fields to upload
-  if(!fieldIsInitialized)
-    throw std::runtime_error("Unable to record InfluxDB point with no fields.");
-  
-  // Add the timestamp
-  field_caller.timestamp(m_timestamp);
+    // Need fields to upload
+    if (!fieldIsInitialized)
+        throw std::runtime_error(
+            "Unable to record InfluxDB point with no fields.");
+
+    // Add the timestamp
+    field_caller.timestamp(m_timestamp);
 
-  // Upload everything and store the command result in &m_resp.
-  m_retval = field_caller.post_http(*m_si, &m_resp);
-  errorCheck(m_retval, m_resp);
+    // Upload everything and store the command result in &m_resp.
+    m_retval = field_caller.post_http(*m_si, &m_resp);
+    errorCheck(m_retval, m_resp);
 }
 
-void InfluxDBSink::endMeasurement()
-{
-  m_fieldsString.clear();
-  m_fieldsInt.clear();
-  m_fieldsDouble.clear();
+void InfluxDBSink::endMeasurement() {
+    m_fieldsString.clear();
+    m_fieldsInt.clear();
+    m_fieldsDouble.clear();
 }
 
-void InfluxDBSink::query(std::string& m_resp, const std::string& query)
-{
-  m_retval = influxdb_cpp::query(m_resp, query, *m_si);
-  errorCheck(m_retval, m_resp);
+void InfluxDBSink::query(std::string& m_resp, const std::string& query) {
+    m_retval = influxdb_cpp::query(m_resp, query, *m_si);
+    errorCheck(m_retval, m_resp);
 }
 
-void InfluxDBSink::errorCheck(int m_retval, std::string& m_resp)
-{
-  if (m_retval != 0){
-    throw std::runtime_error("Received an error from InfluxDB: " + m_resp);
-  }
+void InfluxDBSink::errorCheck(int m_retval, std::string& m_resp) {
+    if (m_retval != 0) {
+        throw std::runtime_error("Received an error from InfluxDB: " + m_resp);
+    }
 }
diff --git a/src/libDataSink/InfluxDBSink.h b/src/libDataSink/InfluxDBSink.h
index 060a5432..092ee3cc 100644
--- a/src/libDataSink/InfluxDBSink.h
+++ b/src/libDataSink/InfluxDBSink.h
@@ -1,12 +1,14 @@
 #ifndef INFLUXDBSINK_H
 #define INFLUXDBSINK_H
 
-#include "IDataSink.h"
 #include <unordered_map>
 
+#include "IDataSink.h"
+
 // Forward declarte InfluxDB handle
-namespace influxdb_cpp
-{ struct server_info; };
+namespace influxdb_cpp {
+struct server_info;
+};
 
 //! \brief Data sink that prints to the console
 /**
@@ -21,119 +23,119 @@ namespace influxdb_cpp
  * The connectivity parameters (host, port and database name) need to be
  * specified in the configuration file.
  */
-class InfluxDBSink : public IDataSink
-{
-public:
-
-  //! \brief Initializes the InfluxDB sink
-  /**
-   * Initializes an influxDB sink. The sink is identified by "name", and it can
-   * be used to upload data to different measurements inside the same database.
-   */
-  InfluxDBSink(const std::string& name);
-
-  //! \brief Reads the DB configuration from a JSON object.
-  /**
-   * See an example in `src/configs/input-hw.json`.
-   *
-   * Valid keys:
-   *  - `host`:     IP address of InfluxDB (hostname not supported)
-   *  - `port`:     Port to connect to
-   *  - `database`: Name of database to use
-   *  - `username`: [optional] Username to connect to the server
-   *  - `password`: [optional] Password to connect to the server
-   *  - `precision`: [optional] Precision of double values, default is 5
-   *
-   * * \param config JSON configuration
-   */
-  virtual void setConfiguration(const nlohmann::json& config);
-
-  //! \brief Initialize connection to the database
-  /**
-   * Initializes connection to the InfluxDB server and checks whether
-   * the specified database exists.
-   */
-  virtual void init();
-  
-  //! \brief Starts a measurement
-  /**
-   * If the measurement (data table) doesn't exist, it will be created.
-   */
-  virtual void startMeasurement(const std::string& measurement, std::chrono::time_point<std::chrono::system_clock> time);
- 
-  virtual void setTag(const std::string& name, const std::string& value);
-  virtual void setTag(const std::string& name, double value);
-  virtual void setTag(const std::string& name, int8_t  value);
-  virtual void setTag(const std::string& name, int32_t value);
-  virtual void setTag(const std::string& name, int64_t value);
-
-  virtual void setField(const std::string& name, const std::string& value);
-  virtual void setField(const std::string& name, int32_t value);
-  virtual void setField(const std::string& name, double value);
-  virtual void setField(const std::string& name, int8_t  value);
-  virtual void setField(const std::string& name, int64_t value);
-
-  //! \brief Changes the precision of `double` values
-  /**
-   * Changes the precision of `double` values
-   *
-   * \param precision Number of digits past the decimal point.
-   */
-  void setPrecision(int precision);
-
-  //! \brief Uploads a single row of data to influxDB
-  /**
-   * The timestamp will be uploaded with milliseconds precision.
-   */
-  virtual void recordPoint();
-
-  //! \brief Cleans up the local variables
-  virtual void endMeasurement();
-
-private:
-
-  // Error handling
-  int m_retval;
-  std::string m_resp;
-
-  //! \brief Checks for errors coming from InfluxDB
-  /**
-   * Checks for errors coming from InfluxDB
-   * \param retval the return value to be checked
-   * \param resp the response from InfluxDB
-   */
-  void errorCheck(int retval, std::string& resp);
-
-  // the influxdb_cpp object to be filled with data
-  std::shared_ptr<influxdb_cpp::server_info> m_si;
-  
-  // measurement configuration
-  std::string m_host;
-  int         m_port;
-  std::string m_dbName;
-  std::string m_usr = "";
-  std::string m_pwd = "";
-  std::string m_measName;
-
-  // Precision of "double" values in fields
-  int m_prec = 5;
-
-  unsigned long long m_timestamp;
-  
-  // Fields and Tags
-  std::unordered_map<std::string, std::string> m_fieldsString;
-  std::unordered_map<std::string, int64_t    > m_fieldsInt;
-  std::unordered_map<std::string, double     > m_fieldsDouble;
-
-  std::unordered_map<std::string, std::string> m_tagsString;
-
-  //! \brief Sends any command to InflxDB and gets its answer
-  /**
-   * Sends any command to be run in InfluxDB's console.
-   * \param query the command
-   * \param resp the answer
-   */
-  void query(std::string& resp, const std::string& query);
+class InfluxDBSink : public IDataSink {
+ public:
+    //! \brief Initializes the InfluxDB sink
+    /**
+     * Initializes an influxDB sink. The sink is identified by "name", and it
+     * can be used to upload data to different measurements inside the same
+     * database.
+     */
+    InfluxDBSink(const std::string& name);
+
+    //! \brief Reads the DB configuration from a JSON object.
+    /**
+     * See an example in `src/configs/input-hw.json`.
+     *
+     * Valid keys:
+     *  - `host`:     IP address of InfluxDB (hostname not supported)
+     *  - `port`:     Port to connect to
+     *  - `database`: Name of database to use
+     *  - `username`: [optional] Username to connect to the server
+     *  - `password`: [optional] Password to connect to the server
+     *  - `precision`: [optional] Precision of double values, default is 5
+     *
+     * * \param config JSON configuration
+     */
+    virtual void setConfiguration(const nlohmann::json& config);
+
+    //! \brief Initialize connection to the database
+    /**
+     * Initializes connection to the InfluxDB server and checks whether
+     * the specified database exists.
+     */
+    virtual void init();
+
+    //! \brief Starts a measurement
+    /**
+     * If the measurement (data table) doesn't exist, it will be created.
+     */
+    virtual void startMeasurement(
+        const std::string& measurement,
+        std::chrono::time_point<std::chrono::system_clock> time);
+
+    virtual void setTag(const std::string& name, const std::string& value);
+    virtual void setTag(const std::string& name, double value);
+    virtual void setTag(const std::string& name, int8_t value);
+    virtual void setTag(const std::string& name, int32_t value);
+    virtual void setTag(const std::string& name, int64_t value);
+
+    virtual void setField(const std::string& name, const std::string& value);
+    virtual void setField(const std::string& name, int32_t value);
+    virtual void setField(const std::string& name, double value);
+    virtual void setField(const std::string& name, int8_t value);
+    virtual void setField(const std::string& name, int64_t value);
+
+    //! \brief Changes the precision of `double` values
+    /**
+     * Changes the precision of `double` values
+     *
+     * \param precision Number of digits past the decimal point.
+     */
+    void setPrecision(int precision);
+
+    //! \brief Uploads a single row of data to influxDB
+    /**
+     * The timestamp will be uploaded with milliseconds precision.
+     */
+    virtual void recordPoint();
+
+    //! \brief Cleans up the local variables
+    virtual void endMeasurement();
+
+ private:
+    // Error handling
+    int m_retval;
+    std::string m_resp;
+
+    //! \brief Checks for errors coming from InfluxDB
+    /**
+     * Checks for errors coming from InfluxDB
+     * \param retval the return value to be checked
+     * \param resp the response from InfluxDB
+     */
+    void errorCheck(int retval, std::string& resp);
+
+    // the influxdb_cpp object to be filled with data
+    std::shared_ptr<influxdb_cpp::server_info> m_si;
+
+    // measurement configuration
+    std::string m_host;
+    int m_port;
+    std::string m_dbName;
+    std::string m_usr = "";
+    std::string m_pwd = "";
+    std::string m_measName;
+
+    // Precision of "double" values in fields
+    int m_prec = 5;
+
+    unsigned long long m_timestamp;
+
+    // Fields and Tags
+    std::unordered_map<std::string, std::string> m_fieldsString;
+    std::unordered_map<std::string, int64_t> m_fieldsInt;
+    std::unordered_map<std::string, double> m_fieldsDouble;
+
+    std::unordered_map<std::string, std::string> m_tagsString;
+
+    //! \brief Sends any command to InflxDB and gets its answer
+    /**
+     * Sends any command to be run in InfluxDB's console.
+     * \param query the command
+     * \param resp the answer
+     */
+    void query(std::string& resp, const std::string& query);
 };
 
-#endif // INFLUXDBSINK_H
+#endif  // INFLUXDBSINK_H
diff --git a/src/libDataSink/python.cpp b/src/libDataSink/python.cpp
index ed7df6a8..95e08399 100644
--- a/src/libDataSink/python.cpp
+++ b/src/libDataSink/python.cpp
@@ -1,344 +1,195 @@
 #include <pybind11/pybind11.h>
 #include <pybind11/stl.h>
-#include "pybind11/chrono.h"
-#include "pybind11_json/pybind11_json.hpp"
-#include "nlohmann/json.hpp"
 
-#include "IDataSink.h"
+#include "CSVSink.h"
 #include "CombinedSink.h"
 #include "ConsoleSink.h"
-#include "CSVSink.h"
+#include "IDataSink.h"
 #include "InfluxDBSink.h"
+#include "nlohmann/json.hpp"
+#include "pybind11/chrono.h"
+#include "pybind11_json/pybind11_json.hpp"
 
 namespace py = pybind11;
 namespace nl = nlohmann;
 
 class PyIDataSink : public IDataSink {
-public:
+ public:
     using IDataSink::IDataSink;
 
     void setConfiguration(const nl::json& config) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setConfiguration,
-            config
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setConfiguration, config);
     }
-   
-    void init() override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            init
-        );
-    }
-    
+
+    void init() override { PYBIND11_OVERLOAD_PURE(void, IDataSink, init); }
+
     void setTag(const std::string& name, const std::string& value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setTag,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setTag, name, value);
     }
 
-    void setTag(const std::string& name, int8_t  value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setTag,
-            name,
-            value
-        );
+    void setTag(const std::string& name, int8_t value) override {
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setTag, name, value);
     }
-    
+
     void setTag(const std::string& name, int32_t value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setTag,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setTag, name, value);
     }
-    
+
     void setTag(const std::string& name, int64_t value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setTag,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setTag, name, value);
     }
-    
+
     void setTag(const std::string& name, double value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setTag,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setTag, name, value);
     }
-    
-    void startMeasurement(const std::string& measurement, 
-      std::chrono::time_point<std::chrono::system_clock> time) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            startMeasurement,
-            measurement,
-            time
-        );
+
+    void startMeasurement(
+        const std::string& measurement,
+        std::chrono::time_point<std::chrono::system_clock> time) override {
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, startMeasurement, measurement,
+                               time);
     }
-    
+
     void setField(const std::string& name, const std::string& value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setField,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setField, name, value);
     }
-    
-    void setField(const std::string& name, int8_t  value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setField,
-            name,
-            value
-        );
+
+    void setField(const std::string& name, int8_t value) override {
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setField, name, value);
     }
-    
+
     void setField(const std::string& name, int32_t value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setField,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setField, name, value);
     }
-    
+
     void setField(const std::string& name, int64_t value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setField,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setField, name, value);
     }
-    
+
     void setField(const std::string& name, double value) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            setField,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, setField, name, value);
     }
-    
+
     void recordPoint() override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            recordPoint
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, recordPoint);
     }
-    
+
     void endMeasurement() override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            IDataSink,
-            endMeasurement
-        );
+        PYBIND11_OVERLOAD_PURE(void, IDataSink, endMeasurement);
     }
 };
 
 // template trampoline to reduce code duplication
-template <class DataSink = ConsoleSink> class PyDataSink: public DataSink {
-public:
+template <class DataSink = ConsoleSink>
+class PyDataSink : public DataSink {
+ public:
     using DataSink::DataSink;
 
     void setConfiguration(const nl::json& config) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setConfiguration,
-            config
-        );
-    }
-   
-    void init() override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            init
-        );
+        PYBIND11_OVERLOAD(void, DataSink, setConfiguration, config);
     }
-     
+
+    void init() override { PYBIND11_OVERLOAD(void, DataSink, init); }
+
     void setTag(const std::string& name, const std::string& value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setTag,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD(void, DataSink, setTag, name, value);
     }
 
-    void setTag(const std::string& name, int8_t  value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setTag,
-            name,
-            value
-        );
+    void setTag(const std::string& name, int8_t value) override {
+        PYBIND11_OVERLOAD(void, DataSink, setTag, name, value);
     }
-    
+
     void setTag(const std::string& name, int32_t value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setTag,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD(void, DataSink, setTag, name, value);
     }
-    
+
     void setTag(const std::string& name, int64_t value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setTag,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD(void, DataSink, setTag, name, value);
     }
-    
+
     void setTag(const std::string& name, double value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setTag,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD(void, DataSink, setTag, name, value);
     }
-    
-    void startMeasurement(const std::string& measurement, 
-      std::chrono::time_point<std::chrono::system_clock> time) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            startMeasurement,
-            measurement,
-            time
-        );
+
+    void startMeasurement(
+        const std::string& measurement,
+        std::chrono::time_point<std::chrono::system_clock> time) override {
+        PYBIND11_OVERLOAD(void, DataSink, startMeasurement, measurement, time);
     }
-    
+
     void setField(const std::string& name, const std::string& value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setField,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD(void, DataSink, setField, name, value);
     }
-    
-    void setField(const std::string& name, int8_t  value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setField,
-            name,
-            value
-        );
+
+    void setField(const std::string& name, int8_t value) override {
+        PYBIND11_OVERLOAD(void, DataSink, setField, name, value);
     }
-    
+
     void setField(const std::string& name, int32_t value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setField,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD(void, DataSink, setField, name, value);
     }
-    
+
     void setField(const std::string& name, int64_t value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setField,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD(void, DataSink, setField, name, value);
     }
-    
+
     void setField(const std::string& name, double value) override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            setField,
-            name,
-            value
-        );
+        PYBIND11_OVERLOAD(void, DataSink, setField, name, value);
     }
-    
+
     void recordPoint() override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            recordPoint
-        );
+        PYBIND11_OVERLOAD(void, DataSink, recordPoint);
     }
-    
+
     void endMeasurement() override {
-        PYBIND11_OVERLOAD(
-            void,
-            DataSink,
-            endMeasurement
-        );
+        PYBIND11_OVERLOAD(void, DataSink, endMeasurement);
     }
 };
 
-void register_datasink(py::module& m){
-  py::class_<IDataSink, PyIDataSink, std::shared_ptr<IDataSink>>(m, "IDataSink")
-    .def(py::init<const std::string &>())
-    .def("setConfiguration", &IDataSink::setConfiguration)
-    .def("init", &IDataSink::init)
-    .def("setTag", (void (IDataSink::*)(const std::string&, const std::string&)) &IDataSink::setTag)
-    .def("setTag", (void (IDataSink::*)(const std::string&, int8_t)) &IDataSink::setTag)
-    .def("setTag", (void (IDataSink::*)(const std::string&, int32_t)) &IDataSink::setTag)
-    .def("setTag", (void (IDataSink::*)(const std::string&, int64_t)) &IDataSink::setTag)
-    .def("setTag", (void (IDataSink::*)(const std::string&, double)) &IDataSink::setTag)
-    .def("startMeasurement", &IDataSink::startMeasurement)
-    .def("setField", (void (IDataSink::*)(const std::string&, const std::string&)) &IDataSink::setField)
-    .def("setField", (void (IDataSink::*)(const std::string&, int8_t)) &IDataSink::setField)
-    .def("setField", (void (IDataSink::*)(const std::string&, int32_t)) &IDataSink::setField)
-    .def("setField", (void (IDataSink::*)(const std::string&, int64_t)) &IDataSink::setField)
-    .def("setField", (void (IDataSink::*)(const std::string&, double)) &IDataSink::setField)
-    .def("recordPoint", &IDataSink::recordPoint)
-    .def("endMeasurement", &IDataSink::endMeasurement);
-
-  py::class_<CombinedSink, PyDataSink<CombinedSink>, IDataSink, std::shared_ptr<CombinedSink>>(m, "CombinedSink")
-    .def(py::init<const std::string &>())
-    .def("addSink", &CombinedSink::addSink);
-  py::class_<ConsoleSink, PyDataSink<ConsoleSink>, IDataSink, std::shared_ptr<ConsoleSink>>(m, "ConsoleSink")
-    .def(py::init<const std::string &>());
-  py::class_<CSVSink, PyDataSink<CSVSink>, IDataSink, std::shared_ptr<CSVSink>>(m, "CSVSink")
-    .def(py::init<const std::string &>());
-  py::class_<InfluxDBSink, PyDataSink<InfluxDBSink>, IDataSink, std::shared_ptr<InfluxDBSink>>(m, "InfluxDBSink")
-    .def(py::init<const std::string &>())
-    .def("setPrecision", &InfluxDBSink::setPrecision);
+void register_datasink(py::module& m) {
+    py::class_<IDataSink, PyIDataSink, std::shared_ptr<IDataSink>>(m,
+                                                                   "IDataSink")
+        .def(py::init<const std::string&>())
+        .def("setConfiguration", &IDataSink::setConfiguration)
+        .def("init", &IDataSink::init)
+        .def("setTag",
+             (void (IDataSink::*)(const std::string&, const std::string&)) &
+                 IDataSink::setTag)
+        .def("setTag", (void (IDataSink::*)(const std::string&, int8_t)) &
+                           IDataSink::setTag)
+        .def("setTag", (void (IDataSink::*)(const std::string&, int32_t)) &
+                           IDataSink::setTag)
+        .def("setTag", (void (IDataSink::*)(const std::string&, int64_t)) &
+                           IDataSink::setTag)
+        .def("setTag", (void (IDataSink::*)(const std::string&, double)) &
+                           IDataSink::setTag)
+        .def("startMeasurement", &IDataSink::startMeasurement)
+        .def("setField",
+             (void (IDataSink::*)(const std::string&, const std::string&)) &
+                 IDataSink::setField)
+        .def("setField", (void (IDataSink::*)(const std::string&, int8_t)) &
+                             IDataSink::setField)
+        .def("setField", (void (IDataSink::*)(const std::string&, int32_t)) &
+                             IDataSink::setField)
+        .def("setField", (void (IDataSink::*)(const std::string&, int64_t)) &
+                             IDataSink::setField)
+        .def("setField", (void (IDataSink::*)(const std::string&, double)) &
+                             IDataSink::setField)
+        .def("recordPoint", &IDataSink::recordPoint)
+        .def("endMeasurement", &IDataSink::endMeasurement);
+
+    py::class_<CombinedSink, PyDataSink<CombinedSink>, IDataSink,
+               std::shared_ptr<CombinedSink>>(m, "CombinedSink")
+        .def(py::init<const std::string&>())
+        .def("addSink", &CombinedSink::addSink);
+    py::class_<ConsoleSink, PyDataSink<ConsoleSink>, IDataSink,
+               std::shared_ptr<ConsoleSink>>(m, "ConsoleSink")
+        .def(py::init<const std::string&>());
+    py::class_<CSVSink, PyDataSink<CSVSink>, IDataSink,
+               std::shared_ptr<CSVSink>>(m, "CSVSink")
+        .def(py::init<const std::string&>());
+    py::class_<InfluxDBSink, PyDataSink<InfluxDBSink>, IDataSink,
+               std::shared_ptr<InfluxDBSink>>(m, "InfluxDBSink")
+        .def(py::init<const std::string&>())
+        .def("setPrecision", &InfluxDBSink::setPrecision);
 }
diff --git a/src/libDevCom/AD56X9.cpp b/src/libDevCom/AD56X9.cpp
index c2162720..5f880e2f 100644
--- a/src/libDevCom/AD56X9.cpp
+++ b/src/libDevCom/AD56X9.cpp
@@ -1,62 +1,54 @@
 #include "AD56X9.h"
 
 #include "LinearCalibration.h"
-
 #include "NotSupportedException.h"
 #include "OutOfRangeException.h"
 
-const std::map<AD56X9::Model, AD56X9ModelInfo> AD56X9::ModelInfo =
-  {
-   {AD56X9::Model::AD5629, AD56X9ModelInfo({.MaxValue=0xFFF }) },
-   {AD56X9::Model::AD5669, AD56X9ModelInfo({.MaxValue=0xFFFF}) }
-  };
+const std::map<AD56X9::Model, AD56X9ModelInfo> AD56X9::ModelInfo = {
+    {AD56X9::Model::AD5629, AD56X9ModelInfo({.MaxValue = 0xFFF})},
+    {AD56X9::Model::AD5669, AD56X9ModelInfo({.MaxValue = 0xFFFF})}};
 
 AD56X9::AD56X9(double reference, Model model, std::shared_ptr<I2CCom> com)
-  : DACDevice(std::make_shared<LinearCalibration>(reference, ModelInfo.at(model).MaxValue)),
-    m_model(model), m_com(com)
-{ }
-
-AD56X9::~AD56X9()
-{ }
-
-void AD56X9::setCount(int32_t counts)
-{
-  counts&=ModelInfo.at(m_model).MaxValue;
-  if(m_model==Model::AD5629)
-    counts<<=4;
-  counts&=0xFFFF;
-  m_com->write_block({0x3F,static_cast<uint8_t>((counts>>8)&0xFF),static_cast<uint8_t>((counts>>0)&0xFF)});
+    : DACDevice(std::make_shared<LinearCalibration>(
+          reference, ModelInfo.at(model).MaxValue)),
+      m_model(model),
+      m_com(com) {}
+
+AD56X9::~AD56X9() {}
+
+void AD56X9::setCount(int32_t counts) {
+    counts &= ModelInfo.at(m_model).MaxValue;
+    if (m_model == Model::AD5629) counts <<= 4;
+    counts &= 0xFFFF;
+    m_com->write_block({0x3F, static_cast<uint8_t>((counts >> 8) & 0xFF),
+                        static_cast<uint8_t>((counts >> 0) & 0xFF)});
 }
 
-void AD56X9::setCount(uint8_t ch, int32_t counts)
-{
-  if(ch>7)
-    throw OutOfRangeException(ch,0,7);
+void AD56X9::setCount(uint8_t ch, int32_t counts) {
+    if (ch > 7) throw OutOfRangeException(ch, 0, 7);
 
-  if(m_model==Model::AD5629)
-    counts<<=4;
-  counts&=0xFFFF;
+    if (m_model == Model::AD5629) counts <<= 4;
+    counts &= 0xFFFF;
 
-  m_com->write_block({static_cast<uint8_t>(0x30|(ch&0xF)),static_cast<uint8_t>((counts>>8)&0xFF),static_cast<uint8_t>((counts>>0)&0xFF)});
+    m_com->write_block({static_cast<uint8_t>(0x30 | (ch & 0xF)),
+                        static_cast<uint8_t>((counts >> 8) & 0xFF),
+                        static_cast<uint8_t>((counts >> 0) & 0xFF)});
 }
 
-void AD56X9::setCount(const std::vector<uint8_t>& chs, const std::vector<int32_t>& data)
-{
-  for(uint i=0;i<chs.size();i++)
-    setCount(chs[i],data[i]);
+void AD56X9::setCount(const std::vector<uint8_t>& chs,
+                      const std::vector<int32_t>& data) {
+    for (uint i = 0; i < chs.size(); i++) setCount(chs[i], data[i]);
 }
 
-int32_t AD56X9::readCount()
-{
-  throw NotSupportedException("AD56X9 does not support reading.");
+int32_t AD56X9::readCount() {
+    throw NotSupportedException("AD56X9 does not support reading.");
 }
 
-int32_t AD56X9::readCount(uint8_t ch)
-{
-  throw NotSupportedException("AD56X9 does not support reading.");
+int32_t AD56X9::readCount(uint8_t ch) {
+    throw NotSupportedException("AD56X9 does not support reading.");
 }
 
-void AD56X9::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& counts)
-{
-  throw NotSupportedException("AD56X9 does not support reading.");
+void AD56X9::readCount(const std::vector<uint8_t>& chs,
+                       std::vector<int32_t>& counts) {
+    throw NotSupportedException("AD56X9 does not support reading.");
 }
diff --git a/src/libDevCom/AD56X9.h b/src/libDevCom/AD56X9.h
index ee8f4c20..4dd416c3 100644
--- a/src/libDevCom/AD56X9.h
+++ b/src/libDevCom/AD56X9.h
@@ -3,41 +3,41 @@
 
 #include <stdint.h>
 
-#include <memory>
 #include <map>
+#include <memory>
 
-#include "I2CCom.h"
 #include "DACDevice.h"
+#include "I2CCom.h"
 
-struct AD56X9ModelInfo
-{
-  int32_t MaxValue;
+struct AD56X9ModelInfo {
+    int32_t MaxValue;
 };
 
-class AD56X9 : public DACDevice
-{
-public:
-  enum Model {AD5629, AD5669};
-
-  AD56X9(double reference, Model model, std::shared_ptr<I2CCom> com);
-  virtual ~AD56X9();
-
-  virtual void setCount(int32_t counts);
-  virtual void setCount(uint8_t ch, int32_t counts);
-  virtual void setCount(const std::vector<uint8_t>& chs, const std::vector<int32_t>& data);
-
-  virtual int32_t readCount();
-  virtual int32_t readCount(uint8_t ch);
-  virtual void    readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
-
-private:
-  // Model information
-  static const std::map<Model, AD56X9ModelInfo> ModelInfo;
-  
-  // Properties of device
-  Model m_model;
-  
-  std::shared_ptr<I2CCom> m_com;
+class AD56X9 : public DACDevice {
+ public:
+    enum Model { AD5629, AD5669 };
+
+    AD56X9(double reference, Model model, std::shared_ptr<I2CCom> com);
+    virtual ~AD56X9();
+
+    virtual void setCount(int32_t counts);
+    virtual void setCount(uint8_t ch, int32_t counts);
+    virtual void setCount(const std::vector<uint8_t>& chs,
+                          const std::vector<int32_t>& data);
+
+    virtual int32_t readCount();
+    virtual int32_t readCount(uint8_t ch);
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data);
+
+ private:
+    // Model information
+    static const std::map<Model, AD56X9ModelInfo> ModelInfo;
+
+    // Properties of device
+    Model m_model;
+
+    std::shared_ptr<I2CCom> m_com;
 };
 
-#endif // AD56X9_H
+#endif  // AD56X9_H
diff --git a/src/libDevCom/AD799X.cpp b/src/libDevCom/AD799X.cpp
index cd390eb8..e7af2815 100644
--- a/src/libDevCom/AD799X.cpp
+++ b/src/libDevCom/AD799X.cpp
@@ -1,97 +1,99 @@
 #include "AD799X.h"
 
 #include "LinearCalibration.h"
-
 #include "NotSupportedException.h"
 
-const std::map<AD799X::Model, AD799XModelInfo> AD799X::ModelInfo =
-  {
-   {AD799X::Model::AD7993, AD799XModelInfo({.NumChannels=4, .MaxValue=0x3FF}) },
-   {AD799X::Model::AD7994, AD799XModelInfo({.NumChannels=4, .MaxValue=0xFFF}) },
-   {AD799X::Model::AD7997, AD799XModelInfo({.NumChannels=8, .MaxValue=0x3FF}) },
-   {AD799X::Model::AD7998, AD799XModelInfo({.NumChannels=8, .MaxValue=0xFFF}) }
-  };
+const std::map<AD799X::Model, AD799XModelInfo> AD799X::ModelInfo = {
+    {AD799X::Model::AD7993,
+     AD799XModelInfo({.NumChannels = 4, .MaxValue = 0x3FF})},
+    {AD799X::Model::AD7994,
+     AD799XModelInfo({.NumChannels = 4, .MaxValue = 0xFFF})},
+    {AD799X::Model::AD7997,
+     AD799XModelInfo({.NumChannels = 8, .MaxValue = 0x3FF})},
+    {AD799X::Model::AD7998,
+     AD799XModelInfo({.NumChannels = 8, .MaxValue = 0xFFF})}};
 
 AD799X::AD799X(double reference, Model model, std::shared_ptr<I2CCom> com)
-  : ADCDevice(std::make_shared<LinearCalibration>(reference, ModelInfo.at(model).MaxValue)),
-    m_model(model), m_numChannels(ModelInfo.at(model).NumChannels), m_com(com)
-{ }
+    : ADCDevice(std::make_shared<LinearCalibration>(
+          reference, ModelInfo.at(model).MaxValue)),
+      m_model(model),
+      m_numChannels(ModelInfo.at(model).NumChannels),
+      m_com(com) {}
 
-AD799X::~AD799X()
-{ }
+AD799X::~AD799X() {}
 
-int32_t AD799X::readCount()
-{
-  std::vector<uint8_t> data(2);
-  m_com->read_block(0x0, data);
+int32_t AD799X::readCount() {
+    std::vector<uint8_t> data(2);
+    m_com->read_block(0x0, data);
 
-  uint16_t chresult=(data[0]<<8)|(data[1]<<0);
-  // TODO: Check if returned channel is the correct one
-  //uint8_t  ch      =((chresult>>12)&0x007);
-  uint32_t chcounts=(m_model==AD7993 || m_model==AD7997)?((chresult>> 2)&0x3FF):(chresult&0xFFF);
-  return chcounts;
+    uint16_t chresult = (data[0] << 8) | (data[1] << 0);
+    // TODO: Check if returned channel is the correct one
+    // uint8_t  ch      =((chresult>>12)&0x007);
+    uint32_t chcounts = (m_model == AD7993 || m_model == AD7997)
+                            ? ((chresult >> 2) & 0x3FF)
+                            : (chresult & 0xFFF);
+    return chcounts;
 }
 
-int32_t AD799X::readCount(uint8_t ch)
-{
-  uint8_t chmask=0;
+int32_t AD799X::readCount(uint8_t ch) {
+    uint8_t chmask = 0;
 
-  switch(m_model)
-    {
-    case AD7993:
-    case AD7994:
-      chmask=(1<<ch);
-      break;
-    case AD7997:
-    case AD7998:
-      chmask=0x8|ch;
-      break;
-    default:
-      throw NotSupportedException("Model not supported by AD799X");
-      break;
-    };
+    switch (m_model) {
+        case AD7993:
+        case AD7994:
+            chmask = (1 << ch);
+            break;
+        case AD7997:
+        case AD7998:
+            chmask = 0x8 | ch;
+            break;
+        default:
+            throw NotSupportedException("Model not supported by AD799X");
+            break;
+    }
 
-  std::vector<uint8_t> data(2);
-  m_com->read_block((chmask<<4)&0xFF, data);
+    std::vector<uint8_t> data(2);
+    m_com->read_block((chmask << 4) & 0xFF, data);
 
-  uint16_t chresult=(data[0]<<8)|(data[1]<<0);
-  // TODO: Check if returned channel is the correct one
-  //uint8_t  ch      =((chresult>>12)&0x007);
-  uint32_t chcounts=(m_model==AD7993 || m_model==AD7997)?((chresult>> 2)&0x3FF):(chresult&0xFFF);
-  return chcounts;
+    uint16_t chresult = (data[0] << 8) | (data[1] << 0);
+    // TODO: Check if returned channel is the correct one
+    // uint8_t  ch      =((chresult>>12)&0x007);
+    uint32_t chcounts = (m_model == AD7993 || m_model == AD7997)
+                            ? ((chresult >> 2) & 0x3FF)
+                            : (chresult & 0xFFF);
+    return chcounts;
 }
 
-void AD799X::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& counts)
-{
-  uint8_t chmask=0;
-  for(uint8_t ch : chs)
-    chmask|=(1<<ch);
+void AD799X::readCount(const std::vector<uint8_t>& chs,
+                       std::vector<int32_t>& counts) {
+    uint8_t chmask = 0;
+    for (uint8_t ch : chs) chmask |= (1 << ch);
 
-  std::vector<uint8_t> data(2*chs.size());
+    std::vector<uint8_t> data(2 * chs.size());
 
-  switch(m_model)
-    {
-    case AD7993:
-    case AD7994:
-      m_com->read_block((chmask<<4)&0xFF, data);
-      break;
-    case AD7997:
-    case AD7998:
-      m_com->write_reg16(0x2, (chmask<<4)|8);
-      m_com->read_block(0x70, data);
-      break;
-    default:
-      throw NotSupportedException("Model not supported by AD799X");
-      break;
-    };
+    switch (m_model) {
+        case AD7993:
+        case AD7994:
+            m_com->read_block((chmask << 4) & 0xFF, data);
+            break;
+        case AD7997:
+        case AD7998:
+            m_com->write_reg16(0x2, (chmask << 4) | 8);
+            m_com->read_block(0x70, data);
+            break;
+        default:
+            throw NotSupportedException("Model not supported by AD799X");
+            break;
+    }
 
-  counts.clear();
-  for(uint8_t chi=0;chi<chs.size();chi++)
-    {
-      uint16_t chresult=(data[2*chi+0]<<8)|(data[2*chi+1]<<0);
-      // TODO: Check if returned channel is the correct one
-      //uint8_t  ch      =((chresult>>12)&0x007);
-      uint32_t chcounts=(m_model==AD7993 || m_model==AD7997)?((chresult>> 2)&0x3FF):(chresult&0xFFF);
-      counts.push_back(chcounts);
+    counts.clear();
+    for (uint8_t chi = 0; chi < chs.size(); chi++) {
+        uint16_t chresult = (data[2 * chi + 0] << 8) | (data[2 * chi + 1] << 0);
+        // TODO: Check if returned channel is the correct one
+        // uint8_t  ch      =((chresult>>12)&0x007);
+        uint32_t chcounts = (m_model == AD7993 || m_model == AD7997)
+                                ? ((chresult >> 2) & 0x3FF)
+                                : (chresult & 0xFFF);
+        counts.push_back(chcounts);
     }
 }
diff --git a/src/libDevCom/AD799X.h b/src/libDevCom/AD799X.h
index 467bf16e..8bb1297a 100644
--- a/src/libDevCom/AD799X.h
+++ b/src/libDevCom/AD799X.h
@@ -3,39 +3,38 @@
 
 #include <stdint.h>
 
-#include <memory>
 #include <map>
+#include <memory>
 
-#include "I2CCom.h"
 #include "ADCDevice.h"
+#include "I2CCom.h"
 
-struct AD799XModelInfo
-{
-  int32_t NumChannels;
-  int32_t MaxValue;
+struct AD799XModelInfo {
+    int32_t NumChannels;
+    int32_t MaxValue;
 };
 
-class AD799X : public ADCDevice
-{
-public:
-  enum Model {AD7993, AD7994, AD7997, AD7998};
-
-  AD799X(double reference, Model model, std::shared_ptr<I2CCom> com);
-  virtual ~AD799X();
-
-  virtual int32_t readCount();
-  virtual int32_t readCount(uint8_t ch);
-  virtual void     readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
-
-private:
-  // Model information
-  static const std::map<Model, AD799XModelInfo> ModelInfo;
-  
-  // Properties of device
-  Model m_model;
-  uint32_t m_numChannels = 0;
-  
-  std::shared_ptr<I2CCom> m_com;
+class AD799X : public ADCDevice {
+ public:
+    enum Model { AD7993, AD7994, AD7997, AD7998 };
+
+    AD799X(double reference, Model model, std::shared_ptr<I2CCom> com);
+    virtual ~AD799X();
+
+    virtual int32_t readCount();
+    virtual int32_t readCount(uint8_t ch);
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data);
+
+ private:
+    // Model information
+    static const std::map<Model, AD799XModelInfo> ModelInfo;
+
+    // Properties of device
+    Model m_model;
+    uint32_t m_numChannels = 0;
+
+    std::shared_ptr<I2CCom> m_com;
 };
 
-#endif // AD799X_H
+#endif  // AD799X_H
diff --git a/src/libDevCom/ADCDevComuino.cpp b/src/libDevCom/ADCDevComuino.cpp
index 2d98fa54..8fb7e1d9 100644
--- a/src/libDevCom/ADCDevComuino.cpp
+++ b/src/libDevCom/ADCDevComuino.cpp
@@ -2,37 +2,34 @@
 
 #include "LinearCalibration.h"
 
-ADCDevComuino::ADCDevComuino(double reference, std::shared_ptr<TextSerialCom> com)
-  : ADCDevice(std::make_shared<LinearCalibration>(reference,1024)), m_com(com)
-{ }
+ADCDevComuino::ADCDevComuino(double reference,
+                             std::shared_ptr<TextSerialCom> com)
+    : ADCDevice(std::make_shared<LinearCalibration>(reference, 1024)),
+      m_com(com) {}
 
-ADCDevComuino::~ADCDevComuino()
-{ }
+ADCDevComuino::~ADCDevComuino() {}
 
-int32_t ADCDevComuino::readCount(uint8_t ch)
-{
-  std::stringstream cmd;
-  cmd << "ADC " << std::dec << (int)ch;
-  m_com->send(cmd.str());
-  std::stringstream ss;
-  std::string response=m_com->receive();
-  ss << std::dec << response; 
-  uint32_t count;
-  ss >> count;
-  return count;
+int32_t ADCDevComuino::readCount(uint8_t ch) {
+    std::stringstream cmd;
+    cmd << "ADC " << std::dec << static_cast<int>(ch);
+    m_com->send(cmd.str());
+    std::stringstream ss;
+    std::string response = m_com->receive();
+    ss << std::dec << response;
+    uint32_t count;
+    ss >> count;
+    return count;
 }
 
-int32_t ADCDevComuino::readCount()
-{
-  logger(logDEBUG) << "No pin number specified. Reading A0.";
-  return readCount(0);
+int32_t ADCDevComuino::readCount() {
+    logger(logDEBUG) << "No pin number specified. Reading A0.";
+    return readCount(0);
 }
 
-void ADCDevComuino::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& counts)
-{
-  counts.clear();
-  for(uint8_t chi=0; chi<chs.size(); chi++)
-    {
-      counts.push_back(readCount(chs[chi]));
+void ADCDevComuino::readCount(const std::vector<uint8_t>& chs,
+                              std::vector<int32_t>& counts) {
+    counts.clear();
+    for (uint8_t chi = 0; chi < chs.size(); chi++) {
+        counts.push_back(readCount(chs[chi]));
     }
 }
diff --git a/src/libDevCom/ADCDevComuino.h b/src/libDevCom/ADCDevComuino.h
index 73007e0b..ae140f16 100644
--- a/src/libDevCom/ADCDevComuino.h
+++ b/src/libDevCom/ADCDevComuino.h
@@ -4,13 +4,13 @@
 #include <stdint.h>
 
 #include <memory>
-#include <vector>
-#include <string>
 #include <sstream>
+#include <string>
+#include <vector>
 
+#include "ADCDevice.h"
 #include "Logger.h"
 #include "TextSerialCom.h"
-#include "ADCDevice.h"
 
 //! \brief Object to interface with Arduino's analog pins
 /**
@@ -19,43 +19,42 @@
  * arduino/devcomuino/devcomuino.ino. It implements the 'ADCDevice'
  * abstract class.
  *
- * The pin number of the desired analog pin may be passed via the 
+ * The pin number of the desired analog pin may be passed via the
  * channel argument to all functions.
  *
- * Uses a linear calibration to convert the raw pin readout to 
+ * Uses a linear calibration to convert the raw pin readout to
  * voltage.
  */
-class ADCDevComuino : public ADCDevice
-{
-public:
-  /**
-   * \param reference The reference voltage on the Arduino that 
-   *   corresponds to a readout of 1024 (either 5 or 3.3). Used 
-   *   for converting the raw readout to voltage. May be set 
-   *   to 1024 for no convertion.
-   * \param com The TextSerialCom to communicate with the Arduino
-   */
-  ADCDevComuino(double reference, std::shared_ptr<TextSerialCom> com);
-  ~ADCDevComuino();
-
-  //! Get the raw readout of the Arduino pin A0
-  int32_t readCount();
-  
-  //! Get the raw readout of an Arduino analog pin
-  /**
-   * \param ch The pin number of the desired analog pin
-   */
-  int32_t readCount(uint8_t ch);
-  
-  //! Bulk readout of multiple analog pins
-  /**
-   * \param chs List of pin numbers to read
-   * \param data Vector where readings will be stored
-   */
-  void readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
-
-private:
-  std::shared_ptr<TextSerialCom> m_com;
+class ADCDevComuino : public ADCDevice {
+ public:
+    /**
+     * \param reference The reference voltage on the Arduino that
+     *   corresponds to a readout of 1024 (either 5 or 3.3). Used
+     *   for converting the raw readout to voltage. May be set
+     *   to 1024 for no convertion.
+     * \param com The TextSerialCom to communicate with the Arduino
+     */
+    ADCDevComuino(double reference, std::shared_ptr<TextSerialCom> com);
+    ~ADCDevComuino();
+
+    //! Get the raw readout of the Arduino pin A0
+    int32_t readCount();
+
+    //! Get the raw readout of an Arduino analog pin
+    /**
+     * \param ch The pin number of the desired analog pin
+     */
+    int32_t readCount(uint8_t ch);
+
+    //! Bulk readout of multiple analog pins
+    /**
+     * \param chs List of pin numbers to read
+     * \param data Vector where readings will be stored
+     */
+    void readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
+
+ private:
+    std::shared_ptr<TextSerialCom> m_com;
 };
 
-#endif // ADCDEVCOMUINO_H
+#endif  // ADCDEVCOMUINO_H
diff --git a/src/libDevCom/ADCDevice.cpp b/src/libDevCom/ADCDevice.cpp
index a5e6f77a..d0585c59 100644
--- a/src/libDevCom/ADCDevice.cpp
+++ b/src/libDevCom/ADCDevice.cpp
@@ -3,36 +3,38 @@
 #include <iostream>
 
 ADCDevice::ADCDevice(std::shared_ptr<DeviceCalibration> calibration)
-  : m_calibration(calibration)
-{ }
+    : m_calibration(calibration) {}
 
-ADCDevice::~ADCDevice()
-{ }
+ADCDevice::~ADCDevice() {}
 
-void ADCDevice::setCalibration(std::shared_ptr<DeviceCalibration> calibration)
-{ m_calibration=calibration; }
+void ADCDevice::setCalibration(std::shared_ptr<DeviceCalibration> calibration) {
+    m_calibration = calibration;
+}
 
-void ADCDevice::setCalibration(uint8_t ch, std::shared_ptr<DeviceCalibration> calibration)
-{ m_channelCalibration[ch]=calibration; }
+void ADCDevice::setCalibration(uint8_t ch,
+                               std::shared_ptr<DeviceCalibration> calibration) {
+    m_channelCalibration[ch] = calibration;
+}
 
-std::shared_ptr<DeviceCalibration> ADCDevice::findCalibration(uint8_t ch) const
-{
-  return (m_channelCalibration.find(ch)==m_channelCalibration.end())?m_calibration:m_channelCalibration.at(ch);
+std::shared_ptr<DeviceCalibration> ADCDevice::findCalibration(
+    uint8_t ch) const {
+    return (m_channelCalibration.find(ch) == m_channelCalibration.end())
+               ? m_calibration
+               : m_channelCalibration.at(ch);
 }
 
-double ADCDevice::read()
-{ return m_calibration->calibrate(readCount()); }
+double ADCDevice::read() { return m_calibration->calibrate(readCount()); }
 
-double ADCDevice::read(uint8_t ch)
-{ return findCalibration(ch)->calibrate(readCount(ch)); }
+double ADCDevice::read(uint8_t ch) {
+    return findCalibration(ch)->calibrate(readCount(ch));
+}
 
-void ADCDevice::read(const std::vector<uint8_t>& chs, std::vector<double>& data)
-{
-  std::vector<int32_t> counts(chs.size());
-  readCount(chs, counts);
+void ADCDevice::read(const std::vector<uint8_t>& chs,
+                     std::vector<double>& data) {
+    std::vector<int32_t> counts(chs.size());
+    readCount(chs, counts);
 
-  data.clear();
-  for(uint i=0; i<chs.size(); i++)
-    data.push_back(findCalibration(chs[i])->calibrate(counts[i]));
+    data.clear();
+    for (uint i = 0; i < chs.size(); i++)
+        data.push_back(findCalibration(chs[i])->calibrate(counts[i]));
 }
-
diff --git a/src/libDevCom/ADCDevice.h b/src/libDevCom/ADCDevice.h
index cfe6ca47..b67e6fd6 100644
--- a/src/libDevCom/ADCDevice.h
+++ b/src/libDevCom/ADCDevice.h
@@ -2,9 +2,9 @@
 #define ADCDEVICE_H
 
 #include <cstdint>
-#include <vector>
-#include <memory>
 #include <map>
+#include <memory>
+#include <vector>
 
 #include "DeviceCalibration.h"
 #include "DummyCalibration.h"
@@ -15,13 +15,13 @@
  * - Defines an abstract interface for reading ACD values in counts.
  * - Conversion from counts to volts using the `DeviceCalibration` classes.
  *
- * Multi-channel ADC's are supported via an optional channel argument to 
+ * Multi-channel ADC's are supported via an optional channel argument to
  * most functions.
  *
  * ## Calibration
  *
  * Calibration handles converting the raw ADC readings (counts) to physical
- * units. The raw values can be retrieved using the `readCount` functions, 
+ * units. The raw values can be retrieved using the `readCount` functions,
  * while the calibrated values are returned by the `read` functions.
  *
  * The units themselves are not defined and don't have to corresponds to the
@@ -29,102 +29,105 @@
  * the voltage across a current sense resistor. The calibration can be defined
  * such that the `read` function returns current (ΔV/R) instead of voltage (ΔV).
  *
- * For multi-channel ADC's, a per-channel calibration can be applied using the 
+ * For multi-channel ADC's, a per-channel calibration can be applied using the
  * `setCalibration(ch,...)` function. If no per-channel calibration is set for
  * a specific channel, then the global calibration (set via constructor or
  * `setCalibration(...)`) is used.
  */
-class ADCDevice
-{
-public:
-  /**
-   * \param calibration Global calibration for all channels.
-   */
-  ADCDevice(std::shared_ptr<DeviceCalibration> calibration=std::make_shared<DummyCalibration>());
-  virtual ~ADCDevice();
+class ADCDevice {
+ public:
+    /**
+     * \param calibration Global calibration for all channels.
+     */
+    ADCDevice(std::shared_ptr<DeviceCalibration> calibration =
+                  std::make_shared<DummyCalibration>());
+    virtual ~ADCDevice();
+
+    //! Set global calibration
+    /**
+     * \param calibration Global calibration for all channels.
+     */
+    void setCalibration(std::shared_ptr<DeviceCalibration> calibration);
 
-  //! Set global calibration
-  /**
-   * \param calibration Global calibration for all channels.
-   */  
-  void setCalibration(std::shared_ptr<DeviceCalibration> calibration);
+    //! Set per-channel calibration
+    /**
+     * Override global calibration for specific channels.
+     *
+     * \param ch Channel to calibrate
+     * \param calibration Calibration for `ch`
+     */
+    void setCalibration(uint8_t ch,
+                        std::shared_ptr<DeviceCalibration> calibration);
 
-  //! Set per-channel calibration
-  /**
-   * Override global calibration for specific channels.
-   *
-   * \param ch Channel to calibrate
-   * \param calibration Calibration for `ch`
-   */ 
-  void setCalibration(uint8_t ch, std::shared_ptr<DeviceCalibration> calibration);
+    //! Read calibrated ADC value of "default" channel (volts)
+    /**
+     * \return result of `readCount`, followed by calibration.
+     */
+    double read();
 
-  //! Read calibrated ADC value of "default" channel (volts)
-  /**
-   * \return result of `readCount`, followed by calibration.
-   */
-  double read();
+    //! Read calibrated ADC value of channel `ch` (volts)
+    /**
+     * \param ch Channel to read
+     *
+     * \return result of `readCount`, followed by calibration.
+     */
+    double read(uint8_t ch);
 
-  //! Read calibrated ADC value of channel `ch` (volts)
-  /**
-   * \param ch Channel to read
-   *
-   * \return result of `readCount`, followed by calibration.
-   */  
-  double read(uint8_t ch);
+    //! Bulk read calibrated ADC values of channels `chs` (volts)
+    /**
+     * The `data` vector used to store the results does not
+     * need to be the same size as `chs`. It will be cleared
+     * and allocated to the right size by this function.
+     *
+     * \param chs List of channel numbers to read
+     * \param data Vector where readings will be stored
+     *
+     * \return result of `readCount`, followed by calibration.
+     */
+    void read(const std::vector<uint8_t>& chs, std::vector<double>& data);
 
-  //! Bulk read calibrated ADC values of channels `chs` (volts)
-  /**
-   * The `data` vector used to store the results does not 
-   * need to be the same size as `chs`. It will be cleared
-   * and allocated to the right size by this function.
-   *
-   * \param chs List of channel numbers to read
-   * \param data Vector where readings will be stored
-   *
-   * \return result of `readCount`, followed by calibration.
-   */
-  void read(const std::vector<uint8_t>& chs, std::vector<double>& data);
+    //! Read ADC value of "default" channel (counts)
+    /**
+     * Implementation of reading from the ADC goes here
+     */
+    virtual int32_t readCount() = 0;
 
-  //! Read ADC value of "default" channel (counts)
-  /**
-   * Implementation of reading from the ADC goes here
-   */
-  virtual int32_t readCount() =0;
+    //! Read ADC value of channel `ch` (counts)
+    /**
+     * Implementation of reading from the ADC goes here
+     *
+     * \param ch Channel to read
+     */
+    virtual int32_t readCount(uint8_t ch) = 0;
 
-  //! Read ADC value of channel `ch` (counts)
-  /**
-   * Implementation of reading from the ADC goes here
-   * 
-   * \param ch Channel to read
-   */
-  virtual int32_t readCount(uint8_t ch) =0;
+    //! Bulk read ADC values of channels `chs` (counts)
+    /**
+     * Implementation of reading from the ADC goes here
+     *
+     * The `data` vector used to store the results does not
+     * need to be the same size as `chs`. The implementatino
+     * of `readCount` should clear and allocated the vector
+     * to the right size.
+     *
+     * \param chs List of channel numbers to read
+     * \param data Vector where readings will be stored
+     */
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data) = 0;
 
-  //! Bulk read ADC values of channels `chs` (counts)
-  /**
-   * Implementation of reading from the ADC goes here
-   * 
-   * The `data` vector used to store the results does not 
-   * need to be the same size as `chs`. The implementatino
-   * of `readCount` should clear and allocated the vector
-   * to the right size.
-   *
-   * \param chs List of channel numbers to read
-   * \param data Vector where readings will be stored
-   */  
-  virtual void readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data) =0;
+ private:
+    //! Find `DeviceCalibration` for given channel
+    /**
+     * The global calibration is returned if `ch` does not have a per-channel
+     * calibration set.
+     *
+     * \return The calibration to be used for the given channel. (per-channel or
+     * global)
+     */
+    std::shared_ptr<DeviceCalibration> findCalibration(uint8_t ch) const;
 
-private:
-  //! Find `DeviceCalibration` for given channel
-  /**
-   * The global calibration is returned if `ch` does not have a per-channel calibration
-   * set.
-   *
-   * \return The calibration to be used for the given channel. (per-channel or global)
-   */
-  std::shared_ptr<DeviceCalibration> findCalibration(uint8_t ch) const;
-  
-  std::shared_ptr<DeviceCalibration> m_calibration;
-  std::map<uint8_t, std::shared_ptr<DeviceCalibration>> m_channelCalibration;
+    std::shared_ptr<DeviceCalibration> m_calibration;
+    std::map<uint8_t, std::shared_ptr<DeviceCalibration>> m_channelCalibration;
 };
 
-#endif // ADCDEVICE_H
+#endif  // ADCDEVICE_H
diff --git a/src/libDevCom/AMAC.cpp b/src/libDevCom/AMAC.cpp
index a4d3039d..3f750632 100644
--- a/src/libDevCom/AMAC.cpp
+++ b/src/libDevCom/AMAC.cpp
@@ -1,303 +1,505 @@
 #include "AMAC.h"
 
-AMAC::AMAC(std::shared_ptr<I2CCom> i2c)
-  : m_i2c(i2c)
-{ }
+AMAC::AMAC(std::shared_ptr<I2CCom> i2c) : m_i2c(i2c) {}
 
-AMAC::~AMAC()
-{ }
+AMAC::~AMAC() {}
 
-void AMAC::init()
-{
-  write(AMACreg::LV_ENABLE, 0x0); // ensure output is disabled
+void AMAC::init() {
+    write(AMACreg::LV_ENABLE, 0x0);  // ensure output is disabled
 
-  write(AMACreg::BANDGAP_CONTROL, 10); //1.2V LDO output
-  write(AMACreg::RT_CH3_GAIN_SEL, 0); // no attenuation
-  write(AMACreg::LT_CH3_GAIN_SEL, 0); // no attentuation
-  write(AMACreg::RT_CH0_SEL, 1); //a
-  write(AMACreg::LT_CH0_SEL, 1); //a 
-  write(AMACreg::LEFT_RAMP_GAIN, 3); // best range
-  write(AMACreg::RIGHT_RAMP_GAIN, 3); // best range
-  write(AMACreg::OPAMP_GAIN_RIGHT, 0); // highest gain
-  write(AMACreg::OPAMP_GAIN_LEFT, 0); // highest gain
-  write(AMACreg::HV_FREQ, 0x1);
+    write(AMACreg::BANDGAP_CONTROL, 10);  // 1.2V LDO output
+    write(AMACreg::RT_CH3_GAIN_SEL, 0);   // no attenuation
+    write(AMACreg::LT_CH3_GAIN_SEL, 0);   // no attentuation
+    write(AMACreg::RT_CH0_SEL, 1);        // a
+    write(AMACreg::LT_CH0_SEL, 1);        // a
+    write(AMACreg::LEFT_RAMP_GAIN, 3);    // best range
+    write(AMACreg::RIGHT_RAMP_GAIN, 3);   // best range
+    write(AMACreg::OPAMP_GAIN_RIGHT, 0);  // highest gain
+    write(AMACreg::OPAMP_GAIN_LEFT, 0);   // highest gain
+    write(AMACreg::HV_FREQ, 0x1);
 }
 
-//Reads the according bits from the according AMAC register
-int AMAC::read(AMACreg reg, unsigned &val)
-{
-  switch(reg)
-    {
-    case AMACreg::STATUS_HV_ILOCK: 	    return this->readBits(0,1,0, val);
-    case AMACreg::STATUS_LV_ILOCK: 	    return this->readBits(0,1,1, val);
-    case AMACreg::STATUS_HV_WARN: 	    return this->readBits(0,1,2, val);
-    case AMACreg::STATUS_LV_WARN: 	    return this->readBits(0,1,3, val);
-    case AMACreg::STATUS_ID:                return this->readBits(0,4,4, val);
-    case AMACreg::VALUE_LEFT_CH0: 	    return this->readBits(20,10,0, val);
-    case AMACreg::VALUE_LEFT_CH1: 	    return this->readBits(21,10,2, val);
-    case AMACreg::VALUE_LEFT_CH2: 	    return this->readBits(22,10,4, val);
-    case AMACreg::VALUE_LEFT_CH3: 	    return this->readBits(23,10,6, val);
-    case AMACreg::VALUE_LEFT_CH4: 	    return this->readBits(25,10,0, val);
-    case AMACreg::VALUE_LEFT_CH5: 	    return this->readBits(26,10,2, val);
-    case AMACreg::VALUE_LEFT_CH6: 	    return this->readBits(27,10,4, val);
-    case AMACreg::VALUE_RIGHT_CH0: 	    return this->readBits(29,10,0, val);
-    case AMACreg::VALUE_RIGHT_CH1: 	    return this->readBits(30,10,2, val);
-    case AMACreg::VALUE_RIGHT_CH2: 	    return this->readBits(31,10,4, val);
-    case AMACreg::VALUE_RIGHT_CH3: 	    return this->readBits(32,10,6, val);
-    case AMACreg::VALUE_RIGHT_CH4: 	    return this->readBits(34,10,0, val);
-    case AMACreg::VALUE_RIGHT_CH5: 	    return this->readBits(35,10,2, val);
-    case AMACreg::VALUE_RIGHT_CH6: 	    return this->readBits(36,10,4, val);
-    case AMACreg::LEFT_RAMP_GAIN: 	    return this->readBits(45,2,0, val);
-    case AMACreg::RIGHT_RAMP_GAIN: 	    return this->readBits(45,2,4, val);
-    case AMACreg::OPAMP_GAIN_RIGHT:	    return this->readBits(42,4,4, val);
-    case AMACreg::OPAMP_GAIN_LEFT:	    return this->readBits(42,4,0, val);
-    case AMACreg::BANDGAP_CONTROL: 	    return this->readBits(40,5,0, val);
-    case AMACreg::RT_CH3_GAIN_SEL: 	    return this->readBits(45,1,7, val);
-    case AMACreg::LT_CH3_GAIN_SEL: 	    return this->readBits(45,1,3, val);
-    case AMACreg::HV_ENABLE:	            return this->readBits(43,1,0, val);	
-    case AMACreg::LV_ENABLE:                return this->readBits(44,1,0, val);
-    case AMACreg::HV_FREQ:		    return this->readBits(43,2,1, val);
-    case AMACreg::ILOCK_FLAG_HV_LEFT_HI:    return this->readBits(1,7,0,val);
-    case AMACreg::ILOCK_FLAG_HV_LEFT_LO:    return this->readBits(2,7,0,val);
-    case AMACreg::ILOCK_FLAG_HV_RIGHT_HI:   return this->readBits(3,7,0,val);
-    case AMACreg::ILOCK_FLAG_HV_RIGHT_LO:   return this->readBits(4,7,0,val);
-    case AMACreg::ILOCK_FLAG_LV_LEFT_HI:    return this->readBits(5,7,0,val);
-    case AMACreg::ILOCK_FLAG_LV_LEFT_LO:    return this->readBits(6,7,0,val);
-    case AMACreg::ILOCK_FLAG_LV_RIGHT_HI:   return this->readBits(7,7,0,val);
-    case AMACreg::ILOCK_FLAG_LV_RIGHT_LO:   return this->readBits(8,7,0,val);
-    case AMACreg::WARN_FLAG_HV_LEFT_HI:	    return this->readBits(9,7,0,val);
-    case AMACreg::WARN_FLAG_HV_LEFT_LO:	    return this->readBits(10,7,0,val);
-    case AMACreg::WARN_FLAG_HV_RIGHT_HI:    return this->readBits(11,7,0,val);
-    case AMACreg::WARN_FLAG_HV_RIGHT_LO:    return this->readBits(12,7,0,val);
-    case AMACreg::WARN_FLAG_LV_LEFT_HI:	    return this->readBits(13,7,0,val);
-    case AMACreg::WARN_FLAG_LV_LEFT_LO:	    return this->readBits(14,7,0,val);
-    case AMACreg::WARN_FLAG_LV_RIGHT_HI:    return this->readBits(15,7,0,val);
-    case AMACreg::WARN_FLAG_LV_RIGHT_LO:    return this->readBits(16,7,0,val);
-    case AMACreg::ILOCK_EN_HV_LEFT_HI:	    return this->readBits(50,7,0,val);
-    case AMACreg::ILOCK_EN_HV_LEFT_LO:	    return this->readBits(51,7,0,val);
-    case AMACreg::ILOCK_EN_HV_RIGHT_HI:	    return this->readBits(52,7,0,val);
-    case AMACreg::ILOCK_EN_HV_RIGHT_LO:	    return this->readBits(53,7,0,val);
-    case AMACreg::ILOCK_EN_LV_LEFT_HI:	    return this->readBits(54,7,0,val);
-    case AMACreg::ILOCK_EN_LV_LEFT_LO:	    return this->readBits(55,7,0,val);
-    case AMACreg::ILOCK_EN_LV_RIGHT_HI:	    return this->readBits(56,7,0,val);
-    case AMACreg::ILOCK_EN_LV_RIGHT_LO:	    return this->readBits(57,7,0,val);
-    case AMACreg::WARN_EN_HV_LEFT_HI:	    return this->readBits(58,7,0,val);
-    case AMACreg::WARN_EN_HV_LEFT_LO:	    return this->readBits(59,7,0,val);
-    case AMACreg::WARN_EN_HV_RIGHT_HI:	    return this->readBits(60,7,0,val);
-    case AMACreg::WARN_EN_HV_RIGHT_LO:	    return this->readBits(61,7,0,val);
-    case AMACreg::WARN_EN_LV_LEFT_HI:	    return this->readBits(62,7,0,val);
-    case AMACreg::WARN_EN_LV_LEFT_LO:	    return this->readBits(63,7,0,val);
-    case AMACreg::WARN_EN_LV_RIGHT_HI:	    return this->readBits(64,7,0,val);
-    case AMACreg::WARN_EN_LV_RIGHT_LO:	    return this->readBits(65,7,0,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_L_CH0: return this->readBits(66,10,0,val);
-    default:
-      return -2; break;
+// Reads the according bits from the according AMAC register
+int AMAC::read(AMACreg reg, unsigned &val) {
+    switch (reg) {
+        case AMACreg::STATUS_HV_ILOCK:
+            return this->readBits(0, 1, 0, val);
+        case AMACreg::STATUS_LV_ILOCK:
+            return this->readBits(0, 1, 1, val);
+        case AMACreg::STATUS_HV_WARN:
+            return this->readBits(0, 1, 2, val);
+        case AMACreg::STATUS_LV_WARN:
+            return this->readBits(0, 1, 3, val);
+        case AMACreg::STATUS_ID:
+            return this->readBits(0, 4, 4, val);
+        case AMACreg::VALUE_LEFT_CH0:
+            return this->readBits(20, 10, 0, val);
+        case AMACreg::VALUE_LEFT_CH1:
+            return this->readBits(21, 10, 2, val);
+        case AMACreg::VALUE_LEFT_CH2:
+            return this->readBits(22, 10, 4, val);
+        case AMACreg::VALUE_LEFT_CH3:
+            return this->readBits(23, 10, 6, val);
+        case AMACreg::VALUE_LEFT_CH4:
+            return this->readBits(25, 10, 0, val);
+        case AMACreg::VALUE_LEFT_CH5:
+            return this->readBits(26, 10, 2, val);
+        case AMACreg::VALUE_LEFT_CH6:
+            return this->readBits(27, 10, 4, val);
+        case AMACreg::VALUE_RIGHT_CH0:
+            return this->readBits(29, 10, 0, val);
+        case AMACreg::VALUE_RIGHT_CH1:
+            return this->readBits(30, 10, 2, val);
+        case AMACreg::VALUE_RIGHT_CH2:
+            return this->readBits(31, 10, 4, val);
+        case AMACreg::VALUE_RIGHT_CH3:
+            return this->readBits(32, 10, 6, val);
+        case AMACreg::VALUE_RIGHT_CH4:
+            return this->readBits(34, 10, 0, val);
+        case AMACreg::VALUE_RIGHT_CH5:
+            return this->readBits(35, 10, 2, val);
+        case AMACreg::VALUE_RIGHT_CH6:
+            return this->readBits(36, 10, 4, val);
+        case AMACreg::LEFT_RAMP_GAIN:
+            return this->readBits(45, 2, 0, val);
+        case AMACreg::RIGHT_RAMP_GAIN:
+            return this->readBits(45, 2, 4, val);
+        case AMACreg::OPAMP_GAIN_RIGHT:
+            return this->readBits(42, 4, 4, val);
+        case AMACreg::OPAMP_GAIN_LEFT:
+            return this->readBits(42, 4, 0, val);
+        case AMACreg::BANDGAP_CONTROL:
+            return this->readBits(40, 5, 0, val);
+        case AMACreg::RT_CH3_GAIN_SEL:
+            return this->readBits(45, 1, 7, val);
+        case AMACreg::LT_CH3_GAIN_SEL:
+            return this->readBits(45, 1, 3, val);
+        case AMACreg::HV_ENABLE:
+            return this->readBits(43, 1, 0, val);
+        case AMACreg::LV_ENABLE:
+            return this->readBits(44, 1, 0, val);
+        case AMACreg::HV_FREQ:
+            return this->readBits(43, 2, 1, val);
+        case AMACreg::ILOCK_FLAG_HV_LEFT_HI:
+            return this->readBits(1, 7, 0, val);
+        case AMACreg::ILOCK_FLAG_HV_LEFT_LO:
+            return this->readBits(2, 7, 0, val);
+        case AMACreg::ILOCK_FLAG_HV_RIGHT_HI:
+            return this->readBits(3, 7, 0, val);
+        case AMACreg::ILOCK_FLAG_HV_RIGHT_LO:
+            return this->readBits(4, 7, 0, val);
+        case AMACreg::ILOCK_FLAG_LV_LEFT_HI:
+            return this->readBits(5, 7, 0, val);
+        case AMACreg::ILOCK_FLAG_LV_LEFT_LO:
+            return this->readBits(6, 7, 0, val);
+        case AMACreg::ILOCK_FLAG_LV_RIGHT_HI:
+            return this->readBits(7, 7, 0, val);
+        case AMACreg::ILOCK_FLAG_LV_RIGHT_LO:
+            return this->readBits(8, 7, 0, val);
+        case AMACreg::WARN_FLAG_HV_LEFT_HI:
+            return this->readBits(9, 7, 0, val);
+        case AMACreg::WARN_FLAG_HV_LEFT_LO:
+            return this->readBits(10, 7, 0, val);
+        case AMACreg::WARN_FLAG_HV_RIGHT_HI:
+            return this->readBits(11, 7, 0, val);
+        case AMACreg::WARN_FLAG_HV_RIGHT_LO:
+            return this->readBits(12, 7, 0, val);
+        case AMACreg::WARN_FLAG_LV_LEFT_HI:
+            return this->readBits(13, 7, 0, val);
+        case AMACreg::WARN_FLAG_LV_LEFT_LO:
+            return this->readBits(14, 7, 0, val);
+        case AMACreg::WARN_FLAG_LV_RIGHT_HI:
+            return this->readBits(15, 7, 0, val);
+        case AMACreg::WARN_FLAG_LV_RIGHT_LO:
+            return this->readBits(16, 7, 0, val);
+        case AMACreg::ILOCK_EN_HV_LEFT_HI:
+            return this->readBits(50, 7, 0, val);
+        case AMACreg::ILOCK_EN_HV_LEFT_LO:
+            return this->readBits(51, 7, 0, val);
+        case AMACreg::ILOCK_EN_HV_RIGHT_HI:
+            return this->readBits(52, 7, 0, val);
+        case AMACreg::ILOCK_EN_HV_RIGHT_LO:
+            return this->readBits(53, 7, 0, val);
+        case AMACreg::ILOCK_EN_LV_LEFT_HI:
+            return this->readBits(54, 7, 0, val);
+        case AMACreg::ILOCK_EN_LV_LEFT_LO:
+            return this->readBits(55, 7, 0, val);
+        case AMACreg::ILOCK_EN_LV_RIGHT_HI:
+            return this->readBits(56, 7, 0, val);
+        case AMACreg::ILOCK_EN_LV_RIGHT_LO:
+            return this->readBits(57, 7, 0, val);
+        case AMACreg::WARN_EN_HV_LEFT_HI:
+            return this->readBits(58, 7, 0, val);
+        case AMACreg::WARN_EN_HV_LEFT_LO:
+            return this->readBits(59, 7, 0, val);
+        case AMACreg::WARN_EN_HV_RIGHT_HI:
+            return this->readBits(60, 7, 0, val);
+        case AMACreg::WARN_EN_HV_RIGHT_LO:
+            return this->readBits(61, 7, 0, val);
+        case AMACreg::WARN_EN_LV_LEFT_HI:
+            return this->readBits(62, 7, 0, val);
+        case AMACreg::WARN_EN_LV_LEFT_LO:
+            return this->readBits(63, 7, 0, val);
+        case AMACreg::WARN_EN_LV_RIGHT_HI:
+            return this->readBits(64, 7, 0, val);
+        case AMACreg::WARN_EN_LV_RIGHT_LO:
+            return this->readBits(65, 7, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_L_CH0:
+            return this->readBits(66, 10, 0, val);
+        default:
+            return -2;
+            break;
     }
 }
 
-//Writes the according bits in the according AMAC register
-int AMAC::write(AMACreg reg, unsigned val)
-{
-  switch(reg)
-    {
-    case AMACreg::LEFT_RAMP_GAIN: 	    return this->writeBits(45,2,0,val);	
-    case AMACreg::RIGHT_RAMP_GAIN: 	    return this->writeBits(45,2,4,val);
-    case AMACreg::OPAMP_GAIN_RIGHT:	    return this->writeBits(42,4,4,val);
-    case AMACreg::OPAMP_GAIN_LEFT:	    return this->writeBits(42,4,0,val);
-    case AMACreg::BANDGAP_CONTROL: 	    return this->writeBits(40,5,0,val);
-    case AMACreg::RT_CH3_GAIN_SEL: 	    return this->writeBits(45,1,7,val);
-    case AMACreg::LT_CH3_GAIN_SEL: 	    return this->writeBits(45,1,3,val);
-    case AMACreg::RT_CH0_SEL: 		    return this->writeBits(45,1,6,val);
-    case AMACreg::LT_CH0_SEL: 		    return this->writeBits(45,1,2,val);	
-    case AMACreg::CLK_OUT_ENABLE : 	    return this->writeBits(41,1,0,val);	
-    case AMACreg::CLK_SELECT:		    return this->writeBits(49,1,0,val);	
-    case AMACreg::HV_FREQ:		    return this->writeBits(43,2,1,val);	
-    case AMACreg::HV_ENABLE:		    return this->writeBits(43,1,0,val);	
-    case AMACreg::LV_ENABLE:		    return this->writeBits(44,1,0,val);	
-    case AMACreg::HV_ILOCK:		    return this->writeBits(43,1,7,val);
-    case AMACreg::HV_ILOCK_LAM:		    return this->writeBits(43,1,5,val);	
-    case AMACreg::LV_ILOCK:		    return this->writeBits(44,1,7,val);
-    case AMACreg::LV_ILOCK_LAM:		    return this->writeBits(44,1,5,val);
-    case AMACreg::RESET_HV_ILOCK:	    return this->writeBits(48,1,0,val);
-    case AMACreg::RESET_HV_WARN:	    return this->writeBits(48,1,1,val);
-    case AMACreg::RESET_LV_ILOCK:	    return this->writeBits(48,1,2,val);
-    case AMACreg::RESET_LV_WARN:	    return this->writeBits(48,1,3,val);
-    case AMACreg::ILOCK_EN_HV_LEFT_HI:	    return this->writeBits(50,7,0,val);
-    case AMACreg::ILOCK_EN_HV_LEFT_LO:	    return this->writeBits(51,7,0,val);
-    case AMACreg::ILOCK_EN_HV_RIGHT_HI:	    return this->writeBits(52,7,0,val);
-    case AMACreg::ILOCK_EN_HV_RIGHT_LO:	    return this->writeBits(53,7,0,val);
-    case AMACreg::ILOCK_EN_LV_LEFT_HI:	    return this->writeBits(54,7,0,val);
-    case AMACreg::ILOCK_EN_LV_LEFT_LO:	    return this->writeBits(55,7,0,val);
-    case AMACreg::ILOCK_EN_LV_RIGHT_HI:	    return this->writeBits(56,7,0,val);
-    case AMACreg::ILOCK_EN_LV_RIGHT_LO:	    return this->writeBits(57,7,0,val);
-    case AMACreg::WARN_EN_HV_LEFT_HI:	    return this->writeBits(58,7,0,val);
-    case AMACreg::WARN_EN_HV_LEFT_LO:	    return this->writeBits(59,7,0,val);
-    case AMACreg::WARN_EN_HV_RIGHT_HI:	    return this->writeBits(60,7,0,val);
-    case AMACreg::WARN_EN_HV_RIGHT_LO:	    return this->writeBits(61,7,0,val);
-    case AMACreg::WARN_EN_LV_LEFT_HI:	    return this->writeBits(62,7,0,val);
-    case AMACreg::WARN_EN_LV_LEFT_LO:	    return this->writeBits(63,7,0,val);
-    case AMACreg::WARN_EN_LV_RIGHT_HI:	    return this->writeBits(64,7,0,val);
-    case AMACreg::WARN_EN_LV_RIGHT_LO:      return this->writeBits(65,7,0,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_L_CH0: return this->writeBits(66,10,0,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_L_CH1: return this->writeBits(67,10,2,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_L_CH2: return this->writeBits(68,10,4,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_L_CH3: return this->writeBits(69,10,6,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_L_CH4: return this->writeBits(71,10,0,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_L_CH5: return this->writeBits(72,10,2,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_L_CH6: return this->writeBits(73,10,4,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_L_CH0: return this->writeBits(75,10,0,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_L_CH1: return this->writeBits(76,10,2,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_L_CH2: return this->writeBits(77,10,4,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_L_CH3: return this->writeBits(78,10,6,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_L_CH4: return this->writeBits(80,10,0,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_L_CH5: return this->writeBits(81,10,2,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_L_CH6: return this->writeBits(82,10,4,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_R_CH0: return this->writeBits(84,10,0,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_R_CH1: return this->writeBits(85,10,2,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_R_CH2: return this->writeBits(86,10,4,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_R_CH3: return this->writeBits(87,10,6,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_R_CH4: return this->writeBits(89,10,0,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_R_CH5: return this->writeBits(90,10,2,val);
-    case AMACreg::ILOCK_HV_THRESH_HI_R_CH6: return this->writeBits(91,10,4,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_R_CH0: return this->writeBits(93,10,0,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_R_CH1: return this->writeBits(94,10,2,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_R_CH2: return this->writeBits(95,10,4,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_R_CH3: return this->writeBits(96,10,6,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_R_CH4: return this->writeBits(98,10,0,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_R_CH5: return this->writeBits(99,10,2,val);
-    case AMACreg::ILOCK_HV_THRESH_LO_R_CH6: return this->writeBits(100,10,4,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_L_CH0: return this->writeBits(102,10,0,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_L_CH1: return this->writeBits(103,10,2,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_L_CH2: return this->writeBits(104,10,4,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_L_CH3: return this->writeBits(105,10,6,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_L_CH4: return this->writeBits(107,10,0,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_L_CH5: return this->writeBits(108,10,2,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_L_CH6: return this->writeBits(109,10,4,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_L_CH0: return this->writeBits(111,10,0,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_L_CH1: return this->writeBits(112,10,2,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_L_CH2: return this->writeBits(113,10,4,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_L_CH3: return this->writeBits(114,10,6,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_L_CH4: return this->writeBits(116,10,0,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_L_CH5: return this->writeBits(117,10,2,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_L_CH6: return this->writeBits(118,10,4,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_R_CH0: return this->writeBits(120,10,0,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_R_CH1: return this->writeBits(121,10,2,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_R_CH2: return this->writeBits(122,10,4,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_R_CH3: return this->writeBits(123,10,6,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_R_CH4: return this->writeBits(125,10,0,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_R_CH5: return this->writeBits(126,10,2,val);
-    case AMACreg::ILOCK_LV_THRESH_HI_R_CH6: return this->writeBits(127,10,4,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_R_CH0: return this->writeBits(129,10,0,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_R_CH1: return this->writeBits(130,10,2,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_R_CH2: return this->writeBits(131,10,4,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_R_CH3: return this->writeBits(132,10,6,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_R_CH4: return this->writeBits(134,10,0,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_R_CH5: return this->writeBits(135,10,2,val);
-    case AMACreg::ILOCK_LV_THRESH_LO_R_CH6: return this->writeBits(136,10,4,val);
-    case AMACreg::WARN_HV_THRESH_HI_L_CH0:  return this->writeBits(138,10,0,val);
-    case AMACreg::WARN_HV_THRESH_HI_L_CH1:  return this->writeBits(139,10,2,val);
-    case AMACreg::WARN_HV_THRESH_HI_L_CH2:  return this->writeBits(140,10,4,val);
-    case AMACreg::WARN_HV_THRESH_HI_L_CH3:  return this->writeBits(141,10,6,val);
-    case AMACreg::WARN_HV_THRESH_HI_L_CH4:  return this->writeBits(143,10,0,val);
-    case AMACreg::WARN_HV_THRESH_HI_L_CH5:  return this->writeBits(144,10,2,val);
-    case AMACreg::WARN_HV_THRESH_HI_L_CH6:  return this->writeBits(145,10,4,val);
-    case AMACreg::WARN_HV_THRESH_LO_L_CH0:  return this->writeBits(147,10,0,val);
-    case AMACreg::WARN_HV_THRESH_LO_L_CH1:  return this->writeBits(148,10,2,val);
-    case AMACreg::WARN_HV_THRESH_LO_L_CH2:  return this->writeBits(149,10,4,val);
-    case AMACreg::WARN_HV_THRESH_LO_L_CH3:  return this->writeBits(150,10,6,val);
-    case AMACreg::WARN_HV_THRESH_LO_L_CH4:  return this->writeBits(152,10,0,val);
-    case AMACreg::WARN_HV_THRESH_LO_L_CH5:  return this->writeBits(153,10,2,val);
-    case AMACreg::WARN_HV_THRESH_LO_L_CH6:  return this->writeBits(154,10,4,val);
-    case AMACreg::WARN_HV_THRESH_HI_R_CH0:  return this->writeBits(156,10,0,val);
-    case AMACreg::WARN_HV_THRESH_HI_R_CH1:  return this->writeBits(157,10,2,val);
-    case AMACreg::WARN_HV_THRESH_HI_R_CH2:  return this->writeBits(158,10,4,val);
-    case AMACreg::WARN_HV_THRESH_HI_R_CH3:  return this->writeBits(159,10,6,val);
-    case AMACreg::WARN_HV_THRESH_HI_R_CH4:  return this->writeBits(161,10,0,val);
-    case AMACreg::WARN_HV_THRESH_HI_R_CH5:  return this->writeBits(162,10,2,val);
-    case AMACreg::WARN_HV_THRESH_HI_R_CH6:  return this->writeBits(163,10,4,val);
-    case AMACreg::WARN_HV_THRESH_LO_R_CH0:  return this->writeBits(165,10,0,val);
-    case AMACreg::WARN_HV_THRESH_LO_R_CH1:  return this->writeBits(166,10,2,val);
-    case AMACreg::WARN_HV_THRESH_LO_R_CH2:  return this->writeBits(167,10,4,val);
-    case AMACreg::WARN_HV_THRESH_LO_R_CH3:  return this->writeBits(168,10,6,val);
-    case AMACreg::WARN_HV_THRESH_LO_R_CH4:  return this->writeBits(170,10,0,val);
-    case AMACreg::WARN_HV_THRESH_LO_R_CH5:  return this->writeBits(171,10,2,val);
-    case AMACreg::WARN_HV_THRESH_LO_R_CH6:  return this->writeBits(172,10,4,val);
-    case AMACreg::WARN_LV_THRESH_HI_L_CH0:  return this->writeBits(174,10,0,val);
-    case AMACreg::WARN_LV_THRESH_HI_L_CH1:  return this->writeBits(175,10,2,val);
-    case AMACreg::WARN_LV_THRESH_HI_L_CH2:  return this->writeBits(176,10,4,val);
-    case AMACreg::WARN_LV_THRESH_HI_L_CH3:  return this->writeBits(177,10,6,val);
-    case AMACreg::WARN_LV_THRESH_HI_L_CH4:  return this->writeBits(179,10,0,val);
-    case AMACreg::WARN_LV_THRESH_HI_L_CH5:  return this->writeBits(180,10,2,val);
-    case AMACreg::WARN_LV_THRESH_HI_L_CH6:  return this->writeBits(181,10,4,val);
-    case AMACreg::WARN_LV_THRESH_LO_L_CH0:  return this->writeBits(183,10,0,val);
-    case AMACreg::WARN_LV_THRESH_LO_L_CH1:  return this->writeBits(184,10,2,val);
-    case AMACreg::WARN_LV_THRESH_LO_L_CH2:  return this->writeBits(185,10,4,val);
-    case AMACreg::WARN_LV_THRESH_LO_L_CH3:  return this->writeBits(186,10,6,val);
-    case AMACreg::WARN_LV_THRESH_LO_L_CH4:  return this->writeBits(188,10,0,val);
-    case AMACreg::WARN_LV_THRESH_LO_L_CH5:  return this->writeBits(189,10,2,val);
-    case AMACreg::WARN_LV_THRESH_LO_L_CH6:  return this->writeBits(190,10,4,val);
-    case AMACreg::WARN_LV_THRESH_HI_R_CH0:  return this->writeBits(192,10,0,val);
-    case AMACreg::WARN_LV_THRESH_HI_R_CH1:  return this->writeBits(193,10,2,val);
-    case AMACreg::WARN_LV_THRESH_HI_R_CH2:  return this->writeBits(194,10,4,val);
-    case AMACreg::WARN_LV_THRESH_HI_R_CH3:  return this->writeBits(195,10,6,val);
-    case AMACreg::WARN_LV_THRESH_HI_R_CH4:  return this->writeBits(197,10,0,val);
-    case AMACreg::WARN_LV_THRESH_HI_R_CH5:  return this->writeBits(198,10,2,val);
-    case AMACreg::WARN_LV_THRESH_HI_R_CH6:  return this->writeBits(199,10,4,val);
-    case AMACreg::WARN_LV_THRESH_LO_R_CH0:  return this->writeBits(201,10,0,val);
-    case AMACreg::WARN_LV_THRESH_LO_R_CH1:  return this->writeBits(202,10,2,val);
-    case AMACreg::WARN_LV_THRESH_LO_R_CH2:  return this->writeBits(203,10,4,val);
-    case AMACreg::WARN_LV_THRESH_LO_R_CH3:  return this->writeBits(204,10,6,val);
-    case AMACreg::WARN_LV_THRESH_LO_R_CH4:  return this->writeBits(206,10,0,val);
-    case AMACreg::WARN_LV_THRESH_LO_R_CH5:  return this->writeBits(207,10,2,val);
-    case AMACreg::WARN_LV_THRESH_LO_R_CH6:  return this->writeBits(208,10,4,val);
-    default:
-      return -2; break;
+// Writes the according bits in the according AMAC register
+int AMAC::write(AMACreg reg, unsigned val) {
+    switch (reg) {
+        case AMACreg::LEFT_RAMP_GAIN:
+            return this->writeBits(45, 2, 0, val);
+        case AMACreg::RIGHT_RAMP_GAIN:
+            return this->writeBits(45, 2, 4, val);
+        case AMACreg::OPAMP_GAIN_RIGHT:
+            return this->writeBits(42, 4, 4, val);
+        case AMACreg::OPAMP_GAIN_LEFT:
+            return this->writeBits(42, 4, 0, val);
+        case AMACreg::BANDGAP_CONTROL:
+            return this->writeBits(40, 5, 0, val);
+        case AMACreg::RT_CH3_GAIN_SEL:
+            return this->writeBits(45, 1, 7, val);
+        case AMACreg::LT_CH3_GAIN_SEL:
+            return this->writeBits(45, 1, 3, val);
+        case AMACreg::RT_CH0_SEL:
+            return this->writeBits(45, 1, 6, val);
+        case AMACreg::LT_CH0_SEL:
+            return this->writeBits(45, 1, 2, val);
+        case AMACreg::CLK_OUT_ENABLE:
+            return this->writeBits(41, 1, 0, val);
+        case AMACreg::CLK_SELECT:
+            return this->writeBits(49, 1, 0, val);
+        case AMACreg::HV_FREQ:
+            return this->writeBits(43, 2, 1, val);
+        case AMACreg::HV_ENABLE:
+            return this->writeBits(43, 1, 0, val);
+        case AMACreg::LV_ENABLE:
+            return this->writeBits(44, 1, 0, val);
+        case AMACreg::HV_ILOCK:
+            return this->writeBits(43, 1, 7, val);
+        case AMACreg::HV_ILOCK_LAM:
+            return this->writeBits(43, 1, 5, val);
+        case AMACreg::LV_ILOCK:
+            return this->writeBits(44, 1, 7, val);
+        case AMACreg::LV_ILOCK_LAM:
+            return this->writeBits(44, 1, 5, val);
+        case AMACreg::RESET_HV_ILOCK:
+            return this->writeBits(48, 1, 0, val);
+        case AMACreg::RESET_HV_WARN:
+            return this->writeBits(48, 1, 1, val);
+        case AMACreg::RESET_LV_ILOCK:
+            return this->writeBits(48, 1, 2, val);
+        case AMACreg::RESET_LV_WARN:
+            return this->writeBits(48, 1, 3, val);
+        case AMACreg::ILOCK_EN_HV_LEFT_HI:
+            return this->writeBits(50, 7, 0, val);
+        case AMACreg::ILOCK_EN_HV_LEFT_LO:
+            return this->writeBits(51, 7, 0, val);
+        case AMACreg::ILOCK_EN_HV_RIGHT_HI:
+            return this->writeBits(52, 7, 0, val);
+        case AMACreg::ILOCK_EN_HV_RIGHT_LO:
+            return this->writeBits(53, 7, 0, val);
+        case AMACreg::ILOCK_EN_LV_LEFT_HI:
+            return this->writeBits(54, 7, 0, val);
+        case AMACreg::ILOCK_EN_LV_LEFT_LO:
+            return this->writeBits(55, 7, 0, val);
+        case AMACreg::ILOCK_EN_LV_RIGHT_HI:
+            return this->writeBits(56, 7, 0, val);
+        case AMACreg::ILOCK_EN_LV_RIGHT_LO:
+            return this->writeBits(57, 7, 0, val);
+        case AMACreg::WARN_EN_HV_LEFT_HI:
+            return this->writeBits(58, 7, 0, val);
+        case AMACreg::WARN_EN_HV_LEFT_LO:
+            return this->writeBits(59, 7, 0, val);
+        case AMACreg::WARN_EN_HV_RIGHT_HI:
+            return this->writeBits(60, 7, 0, val);
+        case AMACreg::WARN_EN_HV_RIGHT_LO:
+            return this->writeBits(61, 7, 0, val);
+        case AMACreg::WARN_EN_LV_LEFT_HI:
+            return this->writeBits(62, 7, 0, val);
+        case AMACreg::WARN_EN_LV_LEFT_LO:
+            return this->writeBits(63, 7, 0, val);
+        case AMACreg::WARN_EN_LV_RIGHT_HI:
+            return this->writeBits(64, 7, 0, val);
+        case AMACreg::WARN_EN_LV_RIGHT_LO:
+            return this->writeBits(65, 7, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_L_CH0:
+            return this->writeBits(66, 10, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_L_CH1:
+            return this->writeBits(67, 10, 2, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_L_CH2:
+            return this->writeBits(68, 10, 4, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_L_CH3:
+            return this->writeBits(69, 10, 6, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_L_CH4:
+            return this->writeBits(71, 10, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_L_CH5:
+            return this->writeBits(72, 10, 2, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_L_CH6:
+            return this->writeBits(73, 10, 4, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_L_CH0:
+            return this->writeBits(75, 10, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_L_CH1:
+            return this->writeBits(76, 10, 2, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_L_CH2:
+            return this->writeBits(77, 10, 4, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_L_CH3:
+            return this->writeBits(78, 10, 6, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_L_CH4:
+            return this->writeBits(80, 10, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_L_CH5:
+            return this->writeBits(81, 10, 2, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_L_CH6:
+            return this->writeBits(82, 10, 4, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_R_CH0:
+            return this->writeBits(84, 10, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_R_CH1:
+            return this->writeBits(85, 10, 2, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_R_CH2:
+            return this->writeBits(86, 10, 4, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_R_CH3:
+            return this->writeBits(87, 10, 6, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_R_CH4:
+            return this->writeBits(89, 10, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_R_CH5:
+            return this->writeBits(90, 10, 2, val);
+        case AMACreg::ILOCK_HV_THRESH_HI_R_CH6:
+            return this->writeBits(91, 10, 4, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_R_CH0:
+            return this->writeBits(93, 10, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_R_CH1:
+            return this->writeBits(94, 10, 2, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_R_CH2:
+            return this->writeBits(95, 10, 4, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_R_CH3:
+            return this->writeBits(96, 10, 6, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_R_CH4:
+            return this->writeBits(98, 10, 0, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_R_CH5:
+            return this->writeBits(99, 10, 2, val);
+        case AMACreg::ILOCK_HV_THRESH_LO_R_CH6:
+            return this->writeBits(100, 10, 4, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_L_CH0:
+            return this->writeBits(102, 10, 0, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_L_CH1:
+            return this->writeBits(103, 10, 2, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_L_CH2:
+            return this->writeBits(104, 10, 4, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_L_CH3:
+            return this->writeBits(105, 10, 6, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_L_CH4:
+            return this->writeBits(107, 10, 0, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_L_CH5:
+            return this->writeBits(108, 10, 2, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_L_CH6:
+            return this->writeBits(109, 10, 4, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_L_CH0:
+            return this->writeBits(111, 10, 0, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_L_CH1:
+            return this->writeBits(112, 10, 2, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_L_CH2:
+            return this->writeBits(113, 10, 4, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_L_CH3:
+            return this->writeBits(114, 10, 6, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_L_CH4:
+            return this->writeBits(116, 10, 0, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_L_CH5:
+            return this->writeBits(117, 10, 2, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_L_CH6:
+            return this->writeBits(118, 10, 4, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_R_CH0:
+            return this->writeBits(120, 10, 0, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_R_CH1:
+            return this->writeBits(121, 10, 2, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_R_CH2:
+            return this->writeBits(122, 10, 4, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_R_CH3:
+            return this->writeBits(123, 10, 6, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_R_CH4:
+            return this->writeBits(125, 10, 0, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_R_CH5:
+            return this->writeBits(126, 10, 2, val);
+        case AMACreg::ILOCK_LV_THRESH_HI_R_CH6:
+            return this->writeBits(127, 10, 4, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_R_CH0:
+            return this->writeBits(129, 10, 0, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_R_CH1:
+            return this->writeBits(130, 10, 2, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_R_CH2:
+            return this->writeBits(131, 10, 4, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_R_CH3:
+            return this->writeBits(132, 10, 6, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_R_CH4:
+            return this->writeBits(134, 10, 0, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_R_CH5:
+            return this->writeBits(135, 10, 2, val);
+        case AMACreg::ILOCK_LV_THRESH_LO_R_CH6:
+            return this->writeBits(136, 10, 4, val);
+        case AMACreg::WARN_HV_THRESH_HI_L_CH0:
+            return this->writeBits(138, 10, 0, val);
+        case AMACreg::WARN_HV_THRESH_HI_L_CH1:
+            return this->writeBits(139, 10, 2, val);
+        case AMACreg::WARN_HV_THRESH_HI_L_CH2:
+            return this->writeBits(140, 10, 4, val);
+        case AMACreg::WARN_HV_THRESH_HI_L_CH3:
+            return this->writeBits(141, 10, 6, val);
+        case AMACreg::WARN_HV_THRESH_HI_L_CH4:
+            return this->writeBits(143, 10, 0, val);
+        case AMACreg::WARN_HV_THRESH_HI_L_CH5:
+            return this->writeBits(144, 10, 2, val);
+        case AMACreg::WARN_HV_THRESH_HI_L_CH6:
+            return this->writeBits(145, 10, 4, val);
+        case AMACreg::WARN_HV_THRESH_LO_L_CH0:
+            return this->writeBits(147, 10, 0, val);
+        case AMACreg::WARN_HV_THRESH_LO_L_CH1:
+            return this->writeBits(148, 10, 2, val);
+        case AMACreg::WARN_HV_THRESH_LO_L_CH2:
+            return this->writeBits(149, 10, 4, val);
+        case AMACreg::WARN_HV_THRESH_LO_L_CH3:
+            return this->writeBits(150, 10, 6, val);
+        case AMACreg::WARN_HV_THRESH_LO_L_CH4:
+            return this->writeBits(152, 10, 0, val);
+        case AMACreg::WARN_HV_THRESH_LO_L_CH5:
+            return this->writeBits(153, 10, 2, val);
+        case AMACreg::WARN_HV_THRESH_LO_L_CH6:
+            return this->writeBits(154, 10, 4, val);
+        case AMACreg::WARN_HV_THRESH_HI_R_CH0:
+            return this->writeBits(156, 10, 0, val);
+        case AMACreg::WARN_HV_THRESH_HI_R_CH1:
+            return this->writeBits(157, 10, 2, val);
+        case AMACreg::WARN_HV_THRESH_HI_R_CH2:
+            return this->writeBits(158, 10, 4, val);
+        case AMACreg::WARN_HV_THRESH_HI_R_CH3:
+            return this->writeBits(159, 10, 6, val);
+        case AMACreg::WARN_HV_THRESH_HI_R_CH4:
+            return this->writeBits(161, 10, 0, val);
+        case AMACreg::WARN_HV_THRESH_HI_R_CH5:
+            return this->writeBits(162, 10, 2, val);
+        case AMACreg::WARN_HV_THRESH_HI_R_CH6:
+            return this->writeBits(163, 10, 4, val);
+        case AMACreg::WARN_HV_THRESH_LO_R_CH0:
+            return this->writeBits(165, 10, 0, val);
+        case AMACreg::WARN_HV_THRESH_LO_R_CH1:
+            return this->writeBits(166, 10, 2, val);
+        case AMACreg::WARN_HV_THRESH_LO_R_CH2:
+            return this->writeBits(167, 10, 4, val);
+        case AMACreg::WARN_HV_THRESH_LO_R_CH3:
+            return this->writeBits(168, 10, 6, val);
+        case AMACreg::WARN_HV_THRESH_LO_R_CH4:
+            return this->writeBits(170, 10, 0, val);
+        case AMACreg::WARN_HV_THRESH_LO_R_CH5:
+            return this->writeBits(171, 10, 2, val);
+        case AMACreg::WARN_HV_THRESH_LO_R_CH6:
+            return this->writeBits(172, 10, 4, val);
+        case AMACreg::WARN_LV_THRESH_HI_L_CH0:
+            return this->writeBits(174, 10, 0, val);
+        case AMACreg::WARN_LV_THRESH_HI_L_CH1:
+            return this->writeBits(175, 10, 2, val);
+        case AMACreg::WARN_LV_THRESH_HI_L_CH2:
+            return this->writeBits(176, 10, 4, val);
+        case AMACreg::WARN_LV_THRESH_HI_L_CH3:
+            return this->writeBits(177, 10, 6, val);
+        case AMACreg::WARN_LV_THRESH_HI_L_CH4:
+            return this->writeBits(179, 10, 0, val);
+        case AMACreg::WARN_LV_THRESH_HI_L_CH5:
+            return this->writeBits(180, 10, 2, val);
+        case AMACreg::WARN_LV_THRESH_HI_L_CH6:
+            return this->writeBits(181, 10, 4, val);
+        case AMACreg::WARN_LV_THRESH_LO_L_CH0:
+            return this->writeBits(183, 10, 0, val);
+        case AMACreg::WARN_LV_THRESH_LO_L_CH1:
+            return this->writeBits(184, 10, 2, val);
+        case AMACreg::WARN_LV_THRESH_LO_L_CH2:
+            return this->writeBits(185, 10, 4, val);
+        case AMACreg::WARN_LV_THRESH_LO_L_CH3:
+            return this->writeBits(186, 10, 6, val);
+        case AMACreg::WARN_LV_THRESH_LO_L_CH4:
+            return this->writeBits(188, 10, 0, val);
+        case AMACreg::WARN_LV_THRESH_LO_L_CH5:
+            return this->writeBits(189, 10, 2, val);
+        case AMACreg::WARN_LV_THRESH_LO_L_CH6:
+            return this->writeBits(190, 10, 4, val);
+        case AMACreg::WARN_LV_THRESH_HI_R_CH0:
+            return this->writeBits(192, 10, 0, val);
+        case AMACreg::WARN_LV_THRESH_HI_R_CH1:
+            return this->writeBits(193, 10, 2, val);
+        case AMACreg::WARN_LV_THRESH_HI_R_CH2:
+            return this->writeBits(194, 10, 4, val);
+        case AMACreg::WARN_LV_THRESH_HI_R_CH3:
+            return this->writeBits(195, 10, 6, val);
+        case AMACreg::WARN_LV_THRESH_HI_R_CH4:
+            return this->writeBits(197, 10, 0, val);
+        case AMACreg::WARN_LV_THRESH_HI_R_CH5:
+            return this->writeBits(198, 10, 2, val);
+        case AMACreg::WARN_LV_THRESH_HI_R_CH6:
+            return this->writeBits(199, 10, 4, val);
+        case AMACreg::WARN_LV_THRESH_LO_R_CH0:
+            return this->writeBits(201, 10, 0, val);
+        case AMACreg::WARN_LV_THRESH_LO_R_CH1:
+            return this->writeBits(202, 10, 2, val);
+        case AMACreg::WARN_LV_THRESH_LO_R_CH2:
+            return this->writeBits(203, 10, 4, val);
+        case AMACreg::WARN_LV_THRESH_LO_R_CH3:
+            return this->writeBits(204, 10, 6, val);
+        case AMACreg::WARN_LV_THRESH_LO_R_CH4:
+            return this->writeBits(206, 10, 0, val);
+        case AMACreg::WARN_LV_THRESH_LO_R_CH5:
+            return this->writeBits(207, 10, 2, val);
+        case AMACreg::WARN_LV_THRESH_LO_R_CH6:
+            return this->writeBits(208, 10, 4, val);
+        default:
+            return -2;
+            break;
     }
 }
 
+// Works until up to 4 bytes
+int AMAC::readBits(unsigned startreg, unsigned num_bits, unsigned offset,
+                   unsigned &value) {
+    int num_bytes = ((num_bits + offset - 1) / 8) + 1;
+    std::vector<uint8_t> buf(num_bytes);
 
-//Works until up to 4 bytes
-int AMAC::readBits(unsigned startreg, unsigned num_bits, unsigned offset, unsigned &value)
-{
-  int num_bytes = ((num_bits + offset -1) / 8) + 1;
-  std::vector<uint8_t> buf(num_bytes);
-
-  m_i2c->read_block(startreg, buf);
-  uint temp = 0;
-  for(int i = num_bytes - 1; i >= 0; i--)
-    {
-      temp <<= 8;
-      temp += (buf[i] & 0xFF);
+    m_i2c->read_block(startreg, buf);
+    uint temp = 0;
+    for (int i = num_bytes - 1; i >= 0; i--) {
+        temp <<= 8;
+        temp += (buf[i] & 0xFF);
     }
-  value = (temp >> offset) & ((1 << num_bits) -1);
-  return 0;
+    value = (temp >> offset) & ((1 << num_bits) - 1);
+    return 0;
 }
 
-//Works until up to 4 bytes
-//Read register, modify bits, write register
-int AMAC::writeBits(unsigned startreg, unsigned num_bits, unsigned offset, unsigned value)
-{
-  int num_bytes = ((num_bits + offset -1) / 8) + 1;
-  std::vector<uint8_t> buf(num_bytes);  
+// Works until up to 4 bytes
+// Read register, modify bits, write register
+int AMAC::writeBits(unsigned startreg, unsigned num_bits, unsigned offset,
+                    unsigned value) {
+    int num_bytes = ((num_bits + offset - 1) / 8) + 1;
+    std::vector<uint8_t> buf(num_bytes);
 
-  // Read existing value
-  int temp;
-  int mask = ((1 << num_bits) -1) << offset;
-  m_i2c->read_block(startreg, buf);
-  temp = 0;
-  for(int i = num_bytes - 1; i >= 0; i--)
-    {
-      temp <<= 8;
-      temp += (buf[i] & 0xFF);
+    // Read existing value
+    int temp;
+    int mask = ((1 << num_bits) - 1) << offset;
+    m_i2c->read_block(startreg, buf);
+    temp = 0;
+    for (int i = num_bytes - 1; i >= 0; i--) {
+        temp <<= 8;
+        temp += (buf[i] & 0xFF);
     }
 
-  // Modify the required bits
-  temp &= ~mask;
-  temp |= ((value << offset) & mask);
-  for(int i = 0; i < num_bytes; i++, temp >>= 8)
-    buf[i] = temp & 0xFF;
+    // Modify the required bits
+    temp &= ~mask;
+    temp |= ((value << offset) & mask);
+    for (int i = 0; i < num_bytes; i++, temp >>= 8) buf[i] = temp & 0xFF;
 
-  // Write back
-  m_i2c->write_block(startreg, buf);
-  return 0;
+    // Write back
+    m_i2c->write_block(startreg, buf);
+    return 0;
 }
diff --git a/src/libDevCom/AMAC.h b/src/libDevCom/AMAC.h
index 26864c19..2741df3b 100644
--- a/src/libDevCom/AMAC.h
+++ b/src/libDevCom/AMAC.h
@@ -1,232 +1,234 @@
 #ifndef AMAC_H
 #define AMAC_H
 
-#include <memory>
 #include <iostream>
+#include <memory>
 
 #include "I2CCom.h"
 
 enum class AMACreg;
 
 class AMAC {
-public:
-  AMAC(std::shared_ptr<I2CCom> i2c);
-  ~AMAC();
+ public:
+    AMAC(std::shared_ptr<I2CCom> i2c);
+    ~AMAC();
 
-  void init();
+    void init();
 
-  int read(AMACreg reg, unsigned &val);
-  int write(AMACreg reg, unsigned val);
+    int read(AMACreg reg, unsigned &val);
+    int write(AMACreg reg, unsigned val);
 
-private:
-  std::shared_ptr<I2CCom> m_i2c;
+ private:
+    std::shared_ptr<I2CCom> m_i2c;
 
-  int readBits(unsigned startreg, unsigned num_bits, unsigned offset, unsigned &value);
-  int writeBits(unsigned startreg, unsigned num_bits, unsigned offset, unsigned value);
+    int readBits(unsigned startreg, unsigned num_bits, unsigned offset,
+                 unsigned &value);
+    int writeBits(unsigned startreg, unsigned num_bits, unsigned offset,
+                  unsigned value);
 };
 
-//AMAC registers
+// AMAC registers
 enum class AMACreg {
-	STATUS_ID,
-	STATUS_HV_ILOCK,
-	STATUS_LV_ILOCK,
-	STATUS_HV_WARN,
-	STATUS_LV_WARN,
-	HV_ILOCK_LEFT_HIGH,
-	HV_ILOCK_LEFT_LOW,
-	HV_ILOCK_RIGHT_HIGH,
-	HV_ILOCK_RIGHT_LOW,
-	LV_ILOCK_LEFT_HIGH,
-	LV_ILOCK_LEFT_LOW,
-	LV_ILOCK_RIGHT_HIGH,
-	LV_ILOCK_RIGHT_LOW,
-	HV_WARN_LEFT_HIGH,
-	HV_WARN_LEFT_LOW,
-	HV_WARN_RIGHT_HIGH,
-	HV_WARN_RIGHT_LOW,
-	LV_WARN_LEFT_HIGH,
-	LV_WARN_LEFT_LOW,
-	LV_WARN_RIGHT_HIGH,
-	LV_WARN_RIGHT_LOW,
-	VALUE_LEFT_CH0, 
-	VALUE_LEFT_CH1, 
-	VALUE_LEFT_CH2, 
-	VALUE_LEFT_CH3, 
-	VALUE_LEFT_CH4, 
-	VALUE_LEFT_CH5, 
-	VALUE_LEFT_CH6, 
-	VALUE_RIGHT_CH0, 
-	VALUE_RIGHT_CH1,
-	VALUE_RIGHT_CH2,
-	VALUE_RIGHT_CH3,
-	VALUE_RIGHT_CH4,
-	VALUE_RIGHT_CH5,
-	VALUE_RIGHT_CH6,
-	OPAMP_GAIN_RIGHT,
-	OPAMP_GAIN_LEFT,
-	RIGHT_RAMP_GAIN,
-	LEFT_RAMP_GAIN,
-	BANDGAP_CONTROL,
-	RT_CH0_SEL,
-	LT_CH0_SEL,
-	RT_CH3_GAIN_SEL,
-	LT_CH3_GAIN_SEL,
-	CLK_OUT_ENABLE,
-	CLK_SELECT,
-	HV_FREQ,
-	HV_ENABLE,
-	LV_ENABLE,
-	HV_ILOCK,
-	HV_ILOCK_LAM,
-	LV_ILOCK,
-	LV_ILOCK_LAM,
-	RESET_HV_ILOCK,
-	RESET_HV_WARN,
-	RESET_LV_ILOCK,
-	RESET_LV_WARN,
-	ILOCK_FLAG_HV_LEFT_HI,
-	ILOCK_FLAG_HV_LEFT_LO,
-	ILOCK_FLAG_HV_RIGHT_HI,
-	ILOCK_FLAG_HV_RIGHT_LO,
-	ILOCK_FLAG_LV_LEFT_HI,
-	ILOCK_FLAG_LV_LEFT_LO,
-	ILOCK_FLAG_LV_RIGHT_HI,
-	ILOCK_FLAG_LV_RIGHT_LO,
-	WARN_FLAG_HV_LEFT_HI,
-	WARN_FLAG_HV_LEFT_LO,
-	WARN_FLAG_HV_RIGHT_HI,
-	WARN_FLAG_HV_RIGHT_LO,
-	WARN_FLAG_LV_LEFT_HI,
-	WARN_FLAG_LV_LEFT_LO,
-	WARN_FLAG_LV_RIGHT_HI,
-	WARN_FLAG_LV_RIGHT_LO,
-	ILOCK_EN_HV_LEFT_HI,
-	ILOCK_EN_HV_LEFT_LO,
-	ILOCK_EN_HV_RIGHT_HI,
-	ILOCK_EN_HV_RIGHT_LO,
-	ILOCK_EN_LV_LEFT_HI,
-	ILOCK_EN_LV_LEFT_LO,
-	ILOCK_EN_LV_RIGHT_HI,
-	ILOCK_EN_LV_RIGHT_LO,
-	WARN_EN_HV_LEFT_HI,
-	WARN_EN_HV_LEFT_LO,
-	WARN_EN_HV_RIGHT_HI,
-	WARN_EN_HV_RIGHT_LO,
-	WARN_EN_LV_LEFT_HI,
-	WARN_EN_LV_LEFT_LO,
-	WARN_EN_LV_RIGHT_HI,
-	WARN_EN_LV_RIGHT_LO,
-	ILOCK_HV_THRESH_HI_L_CH0,
-	ILOCK_HV_THRESH_HI_L_CH1,
-	ILOCK_HV_THRESH_HI_L_CH2,
-	ILOCK_HV_THRESH_HI_L_CH3,
-	ILOCK_HV_THRESH_HI_L_CH4,
-	ILOCK_HV_THRESH_HI_L_CH5,
-	ILOCK_HV_THRESH_HI_L_CH6,
-	ILOCK_HV_THRESH_LO_L_CH0,
-	ILOCK_HV_THRESH_LO_L_CH1,
-	ILOCK_HV_THRESH_LO_L_CH2,
-	ILOCK_HV_THRESH_LO_L_CH3,
-	ILOCK_HV_THRESH_LO_L_CH4,
-	ILOCK_HV_THRESH_LO_L_CH5,
-	ILOCK_HV_THRESH_LO_L_CH6,
-	ILOCK_HV_THRESH_HI_R_CH0,
-	ILOCK_HV_THRESH_HI_R_CH1,
-	ILOCK_HV_THRESH_HI_R_CH2,
-	ILOCK_HV_THRESH_HI_R_CH3,
-	ILOCK_HV_THRESH_HI_R_CH4,
-	ILOCK_HV_THRESH_HI_R_CH5,
-	ILOCK_HV_THRESH_HI_R_CH6,
-	ILOCK_HV_THRESH_LO_R_CH0,
-	ILOCK_HV_THRESH_LO_R_CH1,
-	ILOCK_HV_THRESH_LO_R_CH2,
-	ILOCK_HV_THRESH_LO_R_CH3,
-	ILOCK_HV_THRESH_LO_R_CH4,
-	ILOCK_HV_THRESH_LO_R_CH5,
-	ILOCK_HV_THRESH_LO_R_CH6,
-	ILOCK_LV_THRESH_HI_L_CH0,
-	ILOCK_LV_THRESH_HI_L_CH1,
-	ILOCK_LV_THRESH_HI_L_CH2,
-	ILOCK_LV_THRESH_HI_L_CH3,
-	ILOCK_LV_THRESH_HI_L_CH4,
-	ILOCK_LV_THRESH_HI_L_CH5,
-	ILOCK_LV_THRESH_HI_L_CH6,
-	ILOCK_LV_THRESH_LO_L_CH0,
-	ILOCK_LV_THRESH_LO_L_CH1,
-	ILOCK_LV_THRESH_LO_L_CH2,
-	ILOCK_LV_THRESH_LO_L_CH3,
-	ILOCK_LV_THRESH_LO_L_CH4,
-	ILOCK_LV_THRESH_LO_L_CH5,
-	ILOCK_LV_THRESH_LO_L_CH6,
-	ILOCK_LV_THRESH_HI_R_CH0,
-	ILOCK_LV_THRESH_HI_R_CH1,
-	ILOCK_LV_THRESH_HI_R_CH2,
-	ILOCK_LV_THRESH_HI_R_CH3,
-	ILOCK_LV_THRESH_HI_R_CH4,
-	ILOCK_LV_THRESH_HI_R_CH5,
-	ILOCK_LV_THRESH_HI_R_CH6,
-	ILOCK_LV_THRESH_LO_R_CH0,
-	ILOCK_LV_THRESH_LO_R_CH1,
-	ILOCK_LV_THRESH_LO_R_CH2,
-	ILOCK_LV_THRESH_LO_R_CH3,
-	ILOCK_LV_THRESH_LO_R_CH4,
-	ILOCK_LV_THRESH_LO_R_CH5,
-	ILOCK_LV_THRESH_LO_R_CH6,
-	WARN_HV_THRESH_HI_L_CH0,
-	WARN_HV_THRESH_HI_L_CH1,
-	WARN_HV_THRESH_HI_L_CH2,
-	WARN_HV_THRESH_HI_L_CH3,
-	WARN_HV_THRESH_HI_L_CH4,
-	WARN_HV_THRESH_HI_L_CH5,
-	WARN_HV_THRESH_HI_L_CH6,
-	WARN_HV_THRESH_LO_L_CH0,
-	WARN_HV_THRESH_LO_L_CH1,
-	WARN_HV_THRESH_LO_L_CH2,
-	WARN_HV_THRESH_LO_L_CH3,
-	WARN_HV_THRESH_LO_L_CH4,
-	WARN_HV_THRESH_LO_L_CH5,
-	WARN_HV_THRESH_LO_L_CH6,
-	WARN_HV_THRESH_HI_R_CH0,
-	WARN_HV_THRESH_HI_R_CH1,
-	WARN_HV_THRESH_HI_R_CH2,
-	WARN_HV_THRESH_HI_R_CH3,
-	WARN_HV_THRESH_HI_R_CH4,
-	WARN_HV_THRESH_HI_R_CH5,
-	WARN_HV_THRESH_HI_R_CH6,
-	WARN_HV_THRESH_LO_R_CH0,
-	WARN_HV_THRESH_LO_R_CH1,
-	WARN_HV_THRESH_LO_R_CH2,
-	WARN_HV_THRESH_LO_R_CH3,
-	WARN_HV_THRESH_LO_R_CH4,
-	WARN_HV_THRESH_LO_R_CH5,
-	WARN_HV_THRESH_LO_R_CH6,
-	WARN_LV_THRESH_HI_L_CH0,
-	WARN_LV_THRESH_HI_L_CH1,
-	WARN_LV_THRESH_HI_L_CH2,
-	WARN_LV_THRESH_HI_L_CH3,
-	WARN_LV_THRESH_HI_L_CH4,
-	WARN_LV_THRESH_HI_L_CH5,
-	WARN_LV_THRESH_HI_L_CH6,
-	WARN_LV_THRESH_LO_L_CH0,
-	WARN_LV_THRESH_LO_L_CH1,
-	WARN_LV_THRESH_LO_L_CH2,
-	WARN_LV_THRESH_LO_L_CH3,
-	WARN_LV_THRESH_LO_L_CH4,
-	WARN_LV_THRESH_LO_L_CH5,
-	WARN_LV_THRESH_LO_L_CH6,
-	WARN_LV_THRESH_HI_R_CH0,
-	WARN_LV_THRESH_HI_R_CH1,
-	WARN_LV_THRESH_HI_R_CH2,
-	WARN_LV_THRESH_HI_R_CH3,
-	WARN_LV_THRESH_HI_R_CH4,
-	WARN_LV_THRESH_HI_R_CH5,
-	WARN_LV_THRESH_HI_R_CH6,
-	WARN_LV_THRESH_LO_R_CH0,
-	WARN_LV_THRESH_LO_R_CH1,
-	WARN_LV_THRESH_LO_R_CH2,
-	WARN_LV_THRESH_LO_R_CH3,
-	WARN_LV_THRESH_LO_R_CH4,
-	WARN_LV_THRESH_LO_R_CH5,
-	WARN_LV_THRESH_LO_R_CH6,
+    STATUS_ID,
+    STATUS_HV_ILOCK,
+    STATUS_LV_ILOCK,
+    STATUS_HV_WARN,
+    STATUS_LV_WARN,
+    HV_ILOCK_LEFT_HIGH,
+    HV_ILOCK_LEFT_LOW,
+    HV_ILOCK_RIGHT_HIGH,
+    HV_ILOCK_RIGHT_LOW,
+    LV_ILOCK_LEFT_HIGH,
+    LV_ILOCK_LEFT_LOW,
+    LV_ILOCK_RIGHT_HIGH,
+    LV_ILOCK_RIGHT_LOW,
+    HV_WARN_LEFT_HIGH,
+    HV_WARN_LEFT_LOW,
+    HV_WARN_RIGHT_HIGH,
+    HV_WARN_RIGHT_LOW,
+    LV_WARN_LEFT_HIGH,
+    LV_WARN_LEFT_LOW,
+    LV_WARN_RIGHT_HIGH,
+    LV_WARN_RIGHT_LOW,
+    VALUE_LEFT_CH0,
+    VALUE_LEFT_CH1,
+    VALUE_LEFT_CH2,
+    VALUE_LEFT_CH3,
+    VALUE_LEFT_CH4,
+    VALUE_LEFT_CH5,
+    VALUE_LEFT_CH6,
+    VALUE_RIGHT_CH0,
+    VALUE_RIGHT_CH1,
+    VALUE_RIGHT_CH2,
+    VALUE_RIGHT_CH3,
+    VALUE_RIGHT_CH4,
+    VALUE_RIGHT_CH5,
+    VALUE_RIGHT_CH6,
+    OPAMP_GAIN_RIGHT,
+    OPAMP_GAIN_LEFT,
+    RIGHT_RAMP_GAIN,
+    LEFT_RAMP_GAIN,
+    BANDGAP_CONTROL,
+    RT_CH0_SEL,
+    LT_CH0_SEL,
+    RT_CH3_GAIN_SEL,
+    LT_CH3_GAIN_SEL,
+    CLK_OUT_ENABLE,
+    CLK_SELECT,
+    HV_FREQ,
+    HV_ENABLE,
+    LV_ENABLE,
+    HV_ILOCK,
+    HV_ILOCK_LAM,
+    LV_ILOCK,
+    LV_ILOCK_LAM,
+    RESET_HV_ILOCK,
+    RESET_HV_WARN,
+    RESET_LV_ILOCK,
+    RESET_LV_WARN,
+    ILOCK_FLAG_HV_LEFT_HI,
+    ILOCK_FLAG_HV_LEFT_LO,
+    ILOCK_FLAG_HV_RIGHT_HI,
+    ILOCK_FLAG_HV_RIGHT_LO,
+    ILOCK_FLAG_LV_LEFT_HI,
+    ILOCK_FLAG_LV_LEFT_LO,
+    ILOCK_FLAG_LV_RIGHT_HI,
+    ILOCK_FLAG_LV_RIGHT_LO,
+    WARN_FLAG_HV_LEFT_HI,
+    WARN_FLAG_HV_LEFT_LO,
+    WARN_FLAG_HV_RIGHT_HI,
+    WARN_FLAG_HV_RIGHT_LO,
+    WARN_FLAG_LV_LEFT_HI,
+    WARN_FLAG_LV_LEFT_LO,
+    WARN_FLAG_LV_RIGHT_HI,
+    WARN_FLAG_LV_RIGHT_LO,
+    ILOCK_EN_HV_LEFT_HI,
+    ILOCK_EN_HV_LEFT_LO,
+    ILOCK_EN_HV_RIGHT_HI,
+    ILOCK_EN_HV_RIGHT_LO,
+    ILOCK_EN_LV_LEFT_HI,
+    ILOCK_EN_LV_LEFT_LO,
+    ILOCK_EN_LV_RIGHT_HI,
+    ILOCK_EN_LV_RIGHT_LO,
+    WARN_EN_HV_LEFT_HI,
+    WARN_EN_HV_LEFT_LO,
+    WARN_EN_HV_RIGHT_HI,
+    WARN_EN_HV_RIGHT_LO,
+    WARN_EN_LV_LEFT_HI,
+    WARN_EN_LV_LEFT_LO,
+    WARN_EN_LV_RIGHT_HI,
+    WARN_EN_LV_RIGHT_LO,
+    ILOCK_HV_THRESH_HI_L_CH0,
+    ILOCK_HV_THRESH_HI_L_CH1,
+    ILOCK_HV_THRESH_HI_L_CH2,
+    ILOCK_HV_THRESH_HI_L_CH3,
+    ILOCK_HV_THRESH_HI_L_CH4,
+    ILOCK_HV_THRESH_HI_L_CH5,
+    ILOCK_HV_THRESH_HI_L_CH6,
+    ILOCK_HV_THRESH_LO_L_CH0,
+    ILOCK_HV_THRESH_LO_L_CH1,
+    ILOCK_HV_THRESH_LO_L_CH2,
+    ILOCK_HV_THRESH_LO_L_CH3,
+    ILOCK_HV_THRESH_LO_L_CH4,
+    ILOCK_HV_THRESH_LO_L_CH5,
+    ILOCK_HV_THRESH_LO_L_CH6,
+    ILOCK_HV_THRESH_HI_R_CH0,
+    ILOCK_HV_THRESH_HI_R_CH1,
+    ILOCK_HV_THRESH_HI_R_CH2,
+    ILOCK_HV_THRESH_HI_R_CH3,
+    ILOCK_HV_THRESH_HI_R_CH4,
+    ILOCK_HV_THRESH_HI_R_CH5,
+    ILOCK_HV_THRESH_HI_R_CH6,
+    ILOCK_HV_THRESH_LO_R_CH0,
+    ILOCK_HV_THRESH_LO_R_CH1,
+    ILOCK_HV_THRESH_LO_R_CH2,
+    ILOCK_HV_THRESH_LO_R_CH3,
+    ILOCK_HV_THRESH_LO_R_CH4,
+    ILOCK_HV_THRESH_LO_R_CH5,
+    ILOCK_HV_THRESH_LO_R_CH6,
+    ILOCK_LV_THRESH_HI_L_CH0,
+    ILOCK_LV_THRESH_HI_L_CH1,
+    ILOCK_LV_THRESH_HI_L_CH2,
+    ILOCK_LV_THRESH_HI_L_CH3,
+    ILOCK_LV_THRESH_HI_L_CH4,
+    ILOCK_LV_THRESH_HI_L_CH5,
+    ILOCK_LV_THRESH_HI_L_CH6,
+    ILOCK_LV_THRESH_LO_L_CH0,
+    ILOCK_LV_THRESH_LO_L_CH1,
+    ILOCK_LV_THRESH_LO_L_CH2,
+    ILOCK_LV_THRESH_LO_L_CH3,
+    ILOCK_LV_THRESH_LO_L_CH4,
+    ILOCK_LV_THRESH_LO_L_CH5,
+    ILOCK_LV_THRESH_LO_L_CH6,
+    ILOCK_LV_THRESH_HI_R_CH0,
+    ILOCK_LV_THRESH_HI_R_CH1,
+    ILOCK_LV_THRESH_HI_R_CH2,
+    ILOCK_LV_THRESH_HI_R_CH3,
+    ILOCK_LV_THRESH_HI_R_CH4,
+    ILOCK_LV_THRESH_HI_R_CH5,
+    ILOCK_LV_THRESH_HI_R_CH6,
+    ILOCK_LV_THRESH_LO_R_CH0,
+    ILOCK_LV_THRESH_LO_R_CH1,
+    ILOCK_LV_THRESH_LO_R_CH2,
+    ILOCK_LV_THRESH_LO_R_CH3,
+    ILOCK_LV_THRESH_LO_R_CH4,
+    ILOCK_LV_THRESH_LO_R_CH5,
+    ILOCK_LV_THRESH_LO_R_CH6,
+    WARN_HV_THRESH_HI_L_CH0,
+    WARN_HV_THRESH_HI_L_CH1,
+    WARN_HV_THRESH_HI_L_CH2,
+    WARN_HV_THRESH_HI_L_CH3,
+    WARN_HV_THRESH_HI_L_CH4,
+    WARN_HV_THRESH_HI_L_CH5,
+    WARN_HV_THRESH_HI_L_CH6,
+    WARN_HV_THRESH_LO_L_CH0,
+    WARN_HV_THRESH_LO_L_CH1,
+    WARN_HV_THRESH_LO_L_CH2,
+    WARN_HV_THRESH_LO_L_CH3,
+    WARN_HV_THRESH_LO_L_CH4,
+    WARN_HV_THRESH_LO_L_CH5,
+    WARN_HV_THRESH_LO_L_CH6,
+    WARN_HV_THRESH_HI_R_CH0,
+    WARN_HV_THRESH_HI_R_CH1,
+    WARN_HV_THRESH_HI_R_CH2,
+    WARN_HV_THRESH_HI_R_CH3,
+    WARN_HV_THRESH_HI_R_CH4,
+    WARN_HV_THRESH_HI_R_CH5,
+    WARN_HV_THRESH_HI_R_CH6,
+    WARN_HV_THRESH_LO_R_CH0,
+    WARN_HV_THRESH_LO_R_CH1,
+    WARN_HV_THRESH_LO_R_CH2,
+    WARN_HV_THRESH_LO_R_CH3,
+    WARN_HV_THRESH_LO_R_CH4,
+    WARN_HV_THRESH_LO_R_CH5,
+    WARN_HV_THRESH_LO_R_CH6,
+    WARN_LV_THRESH_HI_L_CH0,
+    WARN_LV_THRESH_HI_L_CH1,
+    WARN_LV_THRESH_HI_L_CH2,
+    WARN_LV_THRESH_HI_L_CH3,
+    WARN_LV_THRESH_HI_L_CH4,
+    WARN_LV_THRESH_HI_L_CH5,
+    WARN_LV_THRESH_HI_L_CH6,
+    WARN_LV_THRESH_LO_L_CH0,
+    WARN_LV_THRESH_LO_L_CH1,
+    WARN_LV_THRESH_LO_L_CH2,
+    WARN_LV_THRESH_LO_L_CH3,
+    WARN_LV_THRESH_LO_L_CH4,
+    WARN_LV_THRESH_LO_L_CH5,
+    WARN_LV_THRESH_LO_L_CH6,
+    WARN_LV_THRESH_HI_R_CH0,
+    WARN_LV_THRESH_HI_R_CH1,
+    WARN_LV_THRESH_HI_R_CH2,
+    WARN_LV_THRESH_HI_R_CH3,
+    WARN_LV_THRESH_HI_R_CH4,
+    WARN_LV_THRESH_HI_R_CH5,
+    WARN_LV_THRESH_HI_R_CH6,
+    WARN_LV_THRESH_LO_R_CH0,
+    WARN_LV_THRESH_LO_R_CH1,
+    WARN_LV_THRESH_LO_R_CH2,
+    WARN_LV_THRESH_LO_R_CH3,
+    WARN_LV_THRESH_LO_R_CH4,
+    WARN_LV_THRESH_LO_R_CH5,
+    WARN_LV_THRESH_LO_R_CH6,
 };
 #endif
diff --git a/src/libDevCom/ChecksumException.cpp b/src/libDevCom/ChecksumException.cpp
index e041180a..90dac24d 100644
--- a/src/libDevCom/ChecksumException.cpp
+++ b/src/libDevCom/ChecksumException.cpp
@@ -1,14 +1,13 @@
 #include "ChecksumException.h"
 
-#include <sstream>
 #include <iomanip>
+#include <sstream>
 
-ChecksumException::ChecksumException(uint32_t checksum)
-{
-  std::stringstream ss;
-  ss << "0x" << std::hex << std::setfill('0') << std::setw(2) << checksum << std::endl;
-  m_msg="Checksum: "+ss.str();
- }
+ChecksumException::ChecksumException(uint32_t checksum) {
+    std::stringstream ss;
+    ss << "0x" << std::hex << std::setfill('0') << std::setw(2) << checksum
+       << std::endl;
+    m_msg = "Checksum: " + ss.str();
+}
 
-const char* ChecksumException::what() const throw()
-{ return m_msg.c_str(); }
+const char* ChecksumException::what() const throw() { return m_msg.c_str(); }
diff --git a/src/libDevCom/ChecksumException.h b/src/libDevCom/ChecksumException.h
index 9fbf4d90..94eb6d10 100644
--- a/src/libDevCom/ChecksumException.h
+++ b/src/libDevCom/ChecksumException.h
@@ -5,15 +5,14 @@
 
 #include "ComException.h"
 
-class ChecksumException : ComException
-{
-public:
-  ChecksumException(uint32_t checksum);
+class ChecksumException : ComException {
+ public:
+    ChecksumException(uint32_t checksum);
 
-  virtual const char* what() const throw();
+    virtual const char* what() const throw();
 
-private:
-  std::string m_msg;
+ private:
+    std::string m_msg;
 };
 
-#endif // CHECKSUMEXCEPTION_H
+#endif  // CHECKSUMEXCEPTION_H
diff --git a/src/libDevCom/ClimateSensor.cpp b/src/libDevCom/ClimateSensor.cpp
index 1c3022bc..e865484d 100644
--- a/src/libDevCom/ClimateSensor.cpp
+++ b/src/libDevCom/ClimateSensor.cpp
@@ -1,15 +1,16 @@
 #include "ClimateSensor.h"
 
-#include <limits>
 #include <cmath>
+#include <limits>
 
-float ClimateSensor::dewPoint()
-{
-  if(humidity()==0) // zero humidity!
-    return -std::numeric_limits<float>::max();
+float ClimateSensor::dewPoint() {
+    if (humidity() == 0)  // zero humidity!
+        return -std::numeric_limits<float>::max();
 
-  float N = ( std::log(humidity()/100)+(17.27*temperature())/(237.3+temperature()) ) / 17.27;
-  float dew= 237.3 * N / (1-N);
+    float N = (std::log(humidity() / 100) +
+               (17.27 * temperature()) / (237.3 + temperature())) /
+              17.27;
+    float dew = 237.3 * N / (1 - N);
 
-  return dew;
+    return dew;
 }
diff --git a/src/libDevCom/ClimateSensor.h b/src/libDevCom/ClimateSensor.h
index f481ba6a..66582377 100644
--- a/src/libDevCom/ClimateSensor.h
+++ b/src/libDevCom/ClimateSensor.h
@@ -2,8 +2,8 @@
 #define CLIMATESENSOR_H
 
 //! \brief Abstract implementation of a climate sensor
-/** 
- * A climate sensor is defined as a sensor that can measure 
+/**
+ * A climate sensor is defined as a sensor that can measure
  * any one of the following properties.
  *  - temperature
  *  - humidity
@@ -12,60 +12,60 @@
  * If a given sensor does not support a certain property, then
  * it should throw the `NotSupported` exception when trying to
  * retrieve the given property.
- * 
+ *
  * All classes that inherit from this class have Python bindings
  */
-class ClimateSensor
-{
-public:
-  ClimateSensor() =default;
-  virtual ~ClimateSensor() =default;
+class ClimateSensor {
+ public:
+    ClimateSensor() = default;
+    virtual ~ClimateSensor() = default;
 
-  //! \brief Initialize the sensor
-  /**
-   * Setup any necessary sensor configuration here.
-   */
-  virtual void init() =0;
+    //! \brief Initialize the sensor
+    /**
+     * Setup any necessary sensor configuration here.
+     */
+    virtual void init() = 0;
 
-  //! \brief Reset the sensor
-  virtual void reset() =0;
+    //! \brief Reset the sensor
+    virtual void reset() = 0;
 
-  //! \brief Read the sensor measurement
-  /**
-   * Sensor climate measurements should be retrieved here
-   * and stored inside private variables.
-   */
-  virtual void read() =0;
+    //! \brief Read the sensor measurement
+    /**
+     * Sensor climate measurements should be retrieved here
+     * and stored inside private variables.
+     */
+    virtual void read() = 0;
 
-  //! \brief Last measured temperature (Celsius)
-  /**
-   * Raise `NotSupported` exception if the sensor 
-   * cannot measure temperature.
-   */
-  virtual float temperature() const =0;
+    //! \brief Last measured temperature (Celsius)
+    /**
+     * Raise `NotSupported` exception if the sensor
+     * cannot measure temperature.
+     */
+    virtual float temperature() const = 0;
 
-  //! \brief Last measured relative humidity (0 to 1)
-  /**
-   * Raise `NotSupported` exception if the sensor 
-   * cannot measure humidity.
-   */  
-  virtual float humidity() const =0;
+    //! \brief Last measured relative humidity (0 to 1)
+    /**
+     * Raise `NotSupported` exception if the sensor
+     * cannot measure humidity.
+     */
+    virtual float humidity() const = 0;
 
-  //! \brief Last measured pressure (Pascal)
-  /**
-   * Raise `NotSupported` exception if the sensor 
-   * cannot measure pressure.
-   */  
-  virtual float pressure() const =0;
+    //! \brief Last measured pressure (Pascal)
+    /**
+     * Raise `NotSupported` exception if the sensor
+     * cannot measure pressure.
+     */
+    virtual float pressure() const = 0;
 
-  //! \brief Dew point corresponding to the last measured temperature and humidity
-  /**
-   * At zero (measured) relative humidity, the smallest possible float
-   * is returned.
-   *
-   * \return Dew poitn in [°C]
-   */
-  float dewPoint();
+    //! \brief Dew point corresponding to the last measured temperature and
+    //! humidity
+    /**
+     * At zero (measured) relative humidity, the smallest possible float
+     * is returned.
+     *
+     * \return Dew poitn in [°C]
+     */
+    float dewPoint();
 };
 
-#endif // CLIMATESENSOR_H
+#endif  // CLIMATESENSOR_H
diff --git a/src/libDevCom/ComIOException.h b/src/libDevCom/ComIOException.h
index 219bcc2f..4c99eb8c 100644
--- a/src/libDevCom/ComIOException.h
+++ b/src/libDevCom/ComIOException.h
@@ -5,15 +5,14 @@
 
 #include "ComException.h"
 
-class ComIOException : public ComException
-{
-public:
-  ComIOException(const std::string& msg);
+class ComIOException : public ComException {
+ public:
+    ComIOException(const std::string& msg);
 
-  virtual const char* what() const throw();
+    virtual const char* what() const throw();
 
-private:
-  std::string m_msg;
+ private:
+    std::string m_msg;
 };
 
-#endif // COMIOEXCEPTION_H
+#endif  // COMIOEXCEPTION_H
diff --git a/src/libDevCom/DAC5571.cpp b/src/libDevCom/DAC5571.cpp
index f896fc6c..342b9406 100644
--- a/src/libDevCom/DAC5571.cpp
+++ b/src/libDevCom/DAC5571.cpp
@@ -4,43 +4,37 @@
 #include "NotSupportedException.h"
 
 DAC5571::DAC5571(float reference, std::shared_ptr<I2CCom> com)
-  : DACDevice(std::make_shared<LinearCalibration>(reference, 0xFF)), m_com(com)
-{ }
+    : DACDevice(std::make_shared<LinearCalibration>(reference, 0xFF)),
+      m_com(com) {}
 
-DAC5571::~DAC5571()
-{ }
+DAC5571::~DAC5571() {}
 
-void DAC5571::setCount(int32_t counts)
-{
-  uint16_t command=((counts&0xFF)<<4);
-  m_com->write_reg16(command);
+void DAC5571::setCount(int32_t counts) {
+    uint16_t command = ((counts & 0xFF) << 4);
+    m_com->write_reg16(command);
 }
 
-void DAC5571::setCount(uint8_t ch, int32_t counts)
-{
-  throw NotSupportedException("DAC5571 does not support multiple channels.");
+void DAC5571::setCount(uint8_t ch, int32_t counts) {
+    throw NotSupportedException("DAC5571 does not support multiple channels.");
 }
 
-void DAC5571::setCount(const std::vector<uint8_t>& chs, const std::vector<int32_t>& counts)
-{
-  throw NotSupportedException("DAC5571 does not support multiple channels.");
+void DAC5571::setCount(const std::vector<uint8_t>& chs,
+                       const std::vector<int32_t>& counts) {
+    throw NotSupportedException("DAC5571 does not support multiple channels.");
 }
 
-int32_t DAC5571::readCount()
-{
-  throw NotSupportedException("DAC5571 does not support reading.");
-  return 0;
+int32_t DAC5571::readCount() {
+    throw NotSupportedException("DAC5571 does not support reading.");
+    return 0;
 }
- 
-int32_t DAC5571::readCount(uint8_t ch)
-{
-  throw NotSupportedException("DAC5571 does not support reading.");
-  return 0;
-}
- 
-void DAC5571::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data)
-{
-  data.clear();
-  throw NotSupportedException("DAC5571 does not support reading.");
+
+int32_t DAC5571::readCount(uint8_t ch) {
+    throw NotSupportedException("DAC5571 does not support reading.");
+    return 0;
 }
 
+void DAC5571::readCount(const std::vector<uint8_t>& chs,
+                        std::vector<int32_t>& data) {
+    data.clear();
+    throw NotSupportedException("DAC5571 does not support reading.");
+}
diff --git a/src/libDevCom/DAC5571.h b/src/libDevCom/DAC5571.h
index 19b888b6..72daf110 100644
--- a/src/libDevCom/DAC5571.h
+++ b/src/libDevCom/DAC5571.h
@@ -3,25 +3,26 @@
 
 #include <memory>
 
-#include "I2CCom.h"
 #include "DACDevice.h"
+#include "I2CCom.h"
 
-class DAC5571 : public DACDevice
-{
-public:
-  DAC5571(float reference, std::shared_ptr<I2CCom> com);
-  virtual ~DAC5571();
+class DAC5571 : public DACDevice {
+ public:
+    DAC5571(float reference, std::shared_ptr<I2CCom> com);
+    virtual ~DAC5571();
 
-  virtual void setCount(int32_t counts);
-  virtual void setCount(uint8_t ch, int32_t counts);
-  virtual void setCount(const std::vector<uint8_t>& chs, const std::vector<int32_t>& counts);
+    virtual void setCount(int32_t counts);
+    virtual void setCount(uint8_t ch, int32_t counts);
+    virtual void setCount(const std::vector<uint8_t>& chs,
+                          const std::vector<int32_t>& counts);
 
-  virtual int32_t readCount();
-  virtual int32_t readCount(uint8_t ch);
-  virtual void readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
+    virtual int32_t readCount();
+    virtual int32_t readCount(uint8_t ch);
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data);
 
-private:
-  std::shared_ptr<I2CCom> m_com;
+ private:
+    std::shared_ptr<I2CCom> m_com;
 };
 
-#endif // DAC5571_H
+#endif  // DAC5571_H
diff --git a/src/libDevCom/DAC5574.cpp b/src/libDevCom/DAC5574.cpp
index 33a108c3..0f9a672a 100644
--- a/src/libDevCom/DAC5574.cpp
+++ b/src/libDevCom/DAC5574.cpp
@@ -1,69 +1,55 @@
 #include "DAC5574.h"
 
-#include "LinearCalibration.h"
-
-#include <iostream>
 #include <iomanip>
+#include <iostream>
+
+#include "LinearCalibration.h"
 
 DAC5574::DAC5574(float reference, std::shared_ptr<I2CCom> com)
-  : DACDevice(std::make_shared<LinearCalibration>(reference, 0xFF)), m_com(com)
-{ }
+    : DACDevice(std::make_shared<LinearCalibration>(reference, 0xFF)),
+      m_com(com) {}
 
-DAC5574::~DAC5574()
-{ }
+DAC5574::~DAC5574() {}
 
-void DAC5574::setCount(int32_t counts)
-{
-  m_com->write_block({static_cast<uint8_t>((counts>>0)&0xFF),
-	0x00});
+void DAC5574::setCount(int32_t counts) {
+    m_com->write_block({static_cast<uint8_t>((counts >> 0) & 0xFF), 0x00});
 }
 
-void DAC5574::setCount(uint8_t ch, int32_t counts)
-{
-  uint8_t controlbyte=0x10|(ch<<1);
-  m_com->write_block({controlbyte,
-	static_cast<uint8_t>((counts>>0)&0xFF),
-	0x00});
+void DAC5574::setCount(uint8_t ch, int32_t counts) {
+    uint8_t controlbyte = 0x10 | (ch << 1);
+    m_com->write_block(
+        {controlbyte, static_cast<uint8_t>((counts >> 0) & 0xFF), 0x00});
 }
 
-void DAC5574::setCount(const std::vector<uint8_t>& chs, const std::vector<int32_t>& counts)
-{
-  if(chs.size()==1)
-    { // only one
-      setCount(chs[0], counts[0]);
+void DAC5574::setCount(const std::vector<uint8_t>& chs,
+                       const std::vector<int32_t>& counts) {
+    if (chs.size() == 1) {  // only one
+        setCount(chs[0], counts[0]);
+    } else {  // more than one, set only temp register for N-1 and then set all
+              // when setting N
+
+        for (uint8_t i = 0; i < chs.size() - 1; i++) {
+            uint8_t controlbyte = 0x00 | (chs[i] << 1);
+            m_com->write_block({controlbyte,
+                                static_cast<uint8_t>((counts[i] >> 8) & 0xFF),
+                                static_cast<uint8_t>((counts[i] >> 0) & 0xFF)});
+        }
+
+        uint8_t controlbyte = 0x02 | (chs.back() << 1);
+        m_com->write_block({controlbyte,
+                            static_cast<uint8_t>((counts.back() >> 8) & 0xFF),
+                            static_cast<uint8_t>((counts.back() >> 0) & 0xFF)});
     }
-  else
-    { // more than one, set only temp register for N-1 and then set all when setting N
+}
 
-      for(uint8_t i=0; i<chs.size()-1; i++)
-	{
-	  uint8_t controlbyte=0x00|(chs[i]<<1);
-	  m_com->write_block({controlbyte,
-	    static_cast<uint8_t>((counts[i]>>8)&0xFF), 
-	    static_cast<uint8_t>((counts[i]>>0)&0xFF)});
-	}
+int32_t DAC5574::readCount() { return m_com->read_reg16() >> 8; }
 
-      uint8_t controlbyte=0x02|(chs.back()<<1);
-      m_com->write_block({controlbyte,
-	    static_cast<uint8_t>((counts.back()>>8)&0xFF), 
-	    static_cast<uint8_t>((counts.back()>>0)&0xFF)});
-    }
+int32_t DAC5574::readCount(uint8_t ch) {
+    return m_com->read_reg16(ch << 1) >> 8;
 }
 
-int32_t DAC5574::readCount()
-{
-  return m_com->read_reg16()>>8;
-}
- 
-int32_t DAC5574::readCount(uint8_t ch)
-{
-  return m_com->read_reg16(ch<<1)>>8;
+void DAC5574::readCount(const std::vector<uint8_t>& chs,
+                        std::vector<int32_t>& data) {
+    data.clear();
+    for (uint8_t ch : chs) data.push_back(readCount(ch));
 }
- 
-void DAC5574::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data)
-{
-  data.clear();
-  for(uint8_t ch : chs)
-    data.push_back(readCount(ch));
-}
-
diff --git a/src/libDevCom/DAC5574.h b/src/libDevCom/DAC5574.h
index 306d80d9..1f046e46 100644
--- a/src/libDevCom/DAC5574.h
+++ b/src/libDevCom/DAC5574.h
@@ -3,25 +3,26 @@
 
 #include <memory>
 
-#include "I2CCom.h"
 #include "DACDevice.h"
+#include "I2CCom.h"
 
-class DAC5574 : public DACDevice
-{
-public:
-  DAC5574(float reference, std::shared_ptr<I2CCom> com);
-  virtual ~DAC5574();
+class DAC5574 : public DACDevice {
+ public:
+    DAC5574(float reference, std::shared_ptr<I2CCom> com);
+    virtual ~DAC5574();
 
-  virtual void setCount(int32_t counts);
-  virtual void setCount(uint8_t ch, int32_t counts);
-  virtual void setCount(const std::vector<uint8_t>& chs, const std::vector<int32_t>& counts);
+    virtual void setCount(int32_t counts);
+    virtual void setCount(uint8_t ch, int32_t counts);
+    virtual void setCount(const std::vector<uint8_t>& chs,
+                          const std::vector<int32_t>& counts);
 
-  virtual int32_t readCount();
-  virtual int32_t readCount(uint8_t ch);
-  virtual void readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
+    virtual int32_t readCount();
+    virtual int32_t readCount(uint8_t ch);
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data);
 
-private:
-  std::shared_ptr<I2CCom> m_com;
+ private:
+    std::shared_ptr<I2CCom> m_com;
 };
 
-#endif // DAC5574_H
+#endif  // DAC5574_H
diff --git a/src/libDevCom/DACDevice.cpp b/src/libDevCom/DACDevice.cpp
index fb44634b..7deebdef 100644
--- a/src/libDevCom/DACDevice.cpp
+++ b/src/libDevCom/DACDevice.cpp
@@ -3,57 +3,58 @@
 #include <cmath>
 
 DACDevice::DACDevice(std::shared_ptr<DeviceCalibration> calibration)
-  : m_calibration(calibration)
-{ }
+    : m_calibration(calibration) {}
 
-DACDevice::~DACDevice()
-{ }
+DACDevice::~DACDevice() {}
 
-void DACDevice::setCalibration(std::shared_ptr<DeviceCalibration> calibration)
-{ m_calibration=calibration; }
+void DACDevice::setCalibration(std::shared_ptr<DeviceCalibration> calibration) {
+    m_calibration = calibration;
+}
 
-void DACDevice::setCalibration(uint8_t ch, std::shared_ptr<DeviceCalibration> calibration)
-{ m_channelCalibration[ch]=calibration; }
+void DACDevice::setCalibration(uint8_t ch,
+                               std::shared_ptr<DeviceCalibration> calibration) {
+    m_channelCalibration[ch] = calibration;
+}
 
-std::shared_ptr<DeviceCalibration> DACDevice::findCalibration(uint8_t ch) const
-{
-  return (m_channelCalibration.find(ch)==m_channelCalibration.end())?m_calibration:m_channelCalibration.at(ch);
+std::shared_ptr<DeviceCalibration> DACDevice::findCalibration(
+    uint8_t ch) const {
+    return (m_channelCalibration.find(ch) == m_channelCalibration.end())
+               ? m_calibration
+               : m_channelCalibration.at(ch);
 }
 
-double DACDevice::set(double value)
-{
-  uint32_t counts=m_calibration->uncalibrate(value);
-  setCount(counts);
-  return m_calibration->calibrate(counts);
+double DACDevice::set(double value) {
+    uint32_t counts = m_calibration->uncalibrate(value);
+    setCount(counts);
+    return m_calibration->calibrate(counts);
 }
 
-double DACDevice::set(uint8_t ch, double value)
-{
-  int32_t counts=findCalibration(ch)->uncalibrate(value);
-  setCount(ch, counts);
-  return findCalibration(ch)->calibrate(counts);
+double DACDevice::set(uint8_t ch, double value) {
+    int32_t counts = findCalibration(ch)->uncalibrate(value);
+    setCount(ch, counts);
+    return findCalibration(ch)->calibrate(counts);
 }
 
-void DACDevice::set(const std::vector<uint8_t>& chs, const std::vector<double>& values)
-{
-  std::vector<int32_t> counts;
-  for(uint32_t i=0;i<chs.size();i++)
-    counts.push_back(findCalibration(chs[i])->uncalibrate(values[i]));
-  setCount(chs, counts);
+void DACDevice::set(const std::vector<uint8_t>& chs,
+                    const std::vector<double>& values) {
+    std::vector<int32_t> counts;
+    for (uint32_t i = 0; i < chs.size(); i++)
+        counts.push_back(findCalibration(chs[i])->uncalibrate(values[i]));
+    setCount(chs, counts);
 }
 
-double DACDevice::read()
-{ return m_calibration->calibrate(readCount()); }
+double DACDevice::read() { return m_calibration->calibrate(readCount()); }
 
-double DACDevice::read(uint8_t ch)
-{ return findCalibration(ch)->calibrate(readCount(ch)); }
+double DACDevice::read(uint8_t ch) {
+    return findCalibration(ch)->calibrate(readCount(ch));
+}
 
-void DACDevice::read(const std::vector<uint8_t>& chs, std::vector<double>& data)
-{
-  std::vector<int32_t> counts(chs.size());
-  readCount(chs, counts);
+void DACDevice::read(const std::vector<uint8_t>& chs,
+                     std::vector<double>& data) {
+    std::vector<int32_t> counts(chs.size());
+    readCount(chs, counts);
 
-  data.clear();
-  for(uint32_t i=0;i<chs.size();i++)
-    data.push_back(findCalibration(chs[i])->calibrate(counts[i]));
+    data.clear();
+    for (uint32_t i = 0; i < chs.size(); i++)
+        data.push_back(findCalibration(chs[i])->calibrate(counts[i]));
 }
diff --git a/src/libDevCom/DACDevice.h b/src/libDevCom/DACDevice.h
index 632d895c..de1dfc1a 100644
--- a/src/libDevCom/DACDevice.h
+++ b/src/libDevCom/DACDevice.h
@@ -2,9 +2,9 @@
 #define DACDEVICE_H
 
 #include <cstdint>
-#include <vector>
-#include <memory>
 #include <map>
+#include <memory>
+#include <vector>
 
 #include "DeviceCalibration.h"
 #include "DummyCalibration.h"
@@ -15,7 +15,7 @@
  * - Conversion from volts to counts using the `DeviceCalibration` classes.
  * - Defines an abstract interface for writing DAC values in counts.
  *
- * Multi-channel DAC's are supported via an optional channel argument to 
+ * Multi-channel DAC's are supported via an optional channel argument to
  * most functions.
  *
  * ## Calibration
@@ -28,130 +28,135 @@
  * is reduced using a voltage divider. The calibration defined as the reduced
  * value.
  *
- * For multi-channel DAC's, a per-channel calibration can be applied using the 
+ * For multi-channel DAC's, a per-channel calibration can be applied using the
  * `setCalibration(ch,...)` function. If no per-channel calibration is set for
  * a specific channel, then the global calibration (set via constructor or
  * `setCalibration(...)`) is used.
  */
-class DACDevice
-{
-public:
-  /**
-   * \param calibration Global calibration for all channels.
-   */  
-  DACDevice(std::shared_ptr<DeviceCalibration> calibration=std::make_shared<DummyCalibration>());
-  virtual ~DACDevice();
-
-  //! Set global calibration
-  /**
-   * \param calibration Global calibration for all channels.
-   */    
-  void setCalibration(std::shared_ptr<DeviceCalibration> calibration);
-
-  //! Set per-channel calibration
-  /**
-   * Override global calibration for specific channels.
-   *
-   * \param ch Channel to calibrate
-   * \param calibration Calibration for `ch`
-   */ 
-  void setCalibration(uint8_t ch, std::shared_ptr<DeviceCalibration> calibration);
-
-  //! Write DAC value (counts) of "default" channel
-  /**
-   * Implementation of writing to the DAC goes here
-   */  
-  virtual void setCount(int32_t counts) =0;
-
-  //! Write DAC value (counts) of channel `ch`
-  /**
-   * Implementation of writing to the DAC goes here
-   */    
-  virtual void setCount(uint8_t ch, int32_t counts) =0;
-
-  //! Bulk write DAC value (counts) of channels `chs`
-  /**
-   * Implementation of writing to the DAC goes here
-   *
-   * \param chs List of channels to write
-   * \param counts DAC outputs corresponding to channels in `chs`
-   */      
-  virtual void setCount(const std::vector<uint8_t>& chs, const std::vector<int32_t>& counts) =0;
-
-  //! Read current DAC value of "default" channel (counts)
-  /**
-   * Implementation of reading from the DAC goes here
-   */
-  virtual int32_t readCount() =0;
-
-  //! Read current DAC value channel `ch` (counts)
-  /**
-   * Implementation of reading from the DAC goes here
-   */
-  virtual int32_t readCount(uint8_t ch) =0;
-
-  //! Bulk read current DAC values of channels `chs` (counts)
-  /**
-   * Implementation of reading from the DAC goes here
-   * 
-   * The `data` vector used to store the results does not 
-   * need to be the same size as `chs`. The implementatino
-   * of `readCount` should clear and allocated the vector
-   * to the right size.
-   *
-   * \param chs List of channel numbers to read
-   * \param data Vector where readings will be stored
-   */  
-  virtual void    readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data) =0;
-
-  //! Set DAC output value of "default" channel (volts)
-  /**
-   * Call `setCount` using per-channel calibration.
-   */  
-  double set(double value);
-
-  //! Set DAC output value of channel `ch` (volts)
-  /**
-   * Call `setCount` using per-channel calibration.
-   */  
-  double set(uint8_t ch, double value);
-
-  //! Set DAC output values for channels `chs` (volts)
-  /**
-   * Call `setCount` using per-channel calibration.
-   */
-  void   set(const std::vector<uint8_t>& chs, const std::vector<double>& values);
-
-  //! Read calibrated current DAC value of "default" channel (volts)
-  /**
-   * \return result of `readCount`, followed by calibration.
-   */
-  double read();
-
-  //! Read calibrated current DAC value of channel `ch` (volts)
-  /**
-   * \return result of `readCount`, followed by calibration.
-   */
-  double read(uint8_t ch);
-
-  //! Read calibrated current DAC value of channels `chs` (volts)
-  /**
-   * \return result of `readCount`, followed by calibration.
-   */
-  void   read(const std::vector<uint8_t>& chs, std::vector<double>& data);
-
-private:
-  //! Find `DeviceCalibration` for given channel
-  /**
-   * The global calibration is returned if `ch` does not have a per-channel calibration
-   * set.
-   *
-   * \return The calibration to be used for the given channel. (per-channel or global)
-   */
-  std::shared_ptr<DeviceCalibration> findCalibration(uint8_t ch) const;
-
-  std::shared_ptr<DeviceCalibration> m_calibration;
-  std::map<uint8_t, std::shared_ptr<DeviceCalibration>> m_channelCalibration;
+class DACDevice {
+ public:
+    /**
+     * \param calibration Global calibration for all channels.
+     */
+    DACDevice(std::shared_ptr<DeviceCalibration> calibration =
+                  std::make_shared<DummyCalibration>());
+    virtual ~DACDevice();
+
+    //! Set global calibration
+    /**
+     * \param calibration Global calibration for all channels.
+     */
+    void setCalibration(std::shared_ptr<DeviceCalibration> calibration);
+
+    //! Set per-channel calibration
+    /**
+     * Override global calibration for specific channels.
+     *
+     * \param ch Channel to calibrate
+     * \param calibration Calibration for `ch`
+     */
+    void setCalibration(uint8_t ch,
+                        std::shared_ptr<DeviceCalibration> calibration);
+
+    //! Write DAC value (counts) of "default" channel
+    /**
+     * Implementation of writing to the DAC goes here
+     */
+    virtual void setCount(int32_t counts) = 0;
+
+    //! Write DAC value (counts) of channel `ch`
+    /**
+     * Implementation of writing to the DAC goes here
+     */
+    virtual void setCount(uint8_t ch, int32_t counts) = 0;
+
+    //! Bulk write DAC value (counts) of channels `chs`
+    /**
+     * Implementation of writing to the DAC goes here
+     *
+     * \param chs List of channels to write
+     * \param counts DAC outputs corresponding to channels in `chs`
+     */
+    virtual void setCount(const std::vector<uint8_t>& chs,
+                          const std::vector<int32_t>& counts) = 0;
+
+    //! Read current DAC value of "default" channel (counts)
+    /**
+     * Implementation of reading from the DAC goes here
+     */
+    virtual int32_t readCount() = 0;
+
+    //! Read current DAC value channel `ch` (counts)
+    /**
+     * Implementation of reading from the DAC goes here
+     */
+    virtual int32_t readCount(uint8_t ch) = 0;
+
+    //! Bulk read current DAC values of channels `chs` (counts)
+    /**
+     * Implementation of reading from the DAC goes here
+     *
+     * The `data` vector used to store the results does not
+     * need to be the same size as `chs`. The implementatino
+     * of `readCount` should clear and allocated the vector
+     * to the right size.
+     *
+     * \param chs List of channel numbers to read
+     * \param data Vector where readings will be stored
+     */
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data) = 0;
+
+    //! Set DAC output value of "default" channel (volts)
+    /**
+     * Call `setCount` using per-channel calibration.
+     */
+    double set(double value);
+
+    //! Set DAC output value of channel `ch` (volts)
+    /**
+     * Call `setCount` using per-channel calibration.
+     */
+    double set(uint8_t ch, double value);
+
+    //! Set DAC output values for channels `chs` (volts)
+    /**
+     * Call `setCount` using per-channel calibration.
+     */
+    void set(const std::vector<uint8_t>& chs,
+             const std::vector<double>& values);
+
+    //! Read calibrated current DAC value of "default" channel (volts)
+    /**
+     * \return result of `readCount`, followed by calibration.
+     */
+    double read();
+
+    //! Read calibrated current DAC value of channel `ch` (volts)
+    /**
+     * \return result of `readCount`, followed by calibration.
+     */
+    double read(uint8_t ch);
+
+    //! Read calibrated current DAC value of channels `chs` (volts)
+    /**
+     * \return result of `readCount`, followed by calibration.
+     */
+    void read(const std::vector<uint8_t>& chs, std::vector<double>& data);
+
+ private:
+    //! Find `DeviceCalibration` for given channel
+    /**
+     * The global calibration is returned if `ch` does not have a per-channel
+     * calibration set.
+     *
+     * \return The calibration to be used for the given channel. (per-channel or
+     * global)
+     */
+    std::shared_ptr<DeviceCalibration> findCalibration(uint8_t ch) const;
+
+    std::shared_ptr<DeviceCalibration> m_calibration;
+    std::map<uint8_t, std::shared_ptr<DeviceCalibration>> m_channelCalibration;
 };
 
-#endif // DACDEVICE_H
+#endif  // DACDEVICE_H
diff --git a/src/libDevCom/DeviceCalibration.h b/src/libDevCom/DeviceCalibration.h
index a9e6536b..995875d1 100644
--- a/src/libDevCom/DeviceCalibration.h
+++ b/src/libDevCom/DeviceCalibration.h
@@ -12,27 +12,26 @@
  * of the device. If the voltage value of interest is fed to an ADC input using
  * a voltage divider, then the calibration can already account for it.
  */
-class DeviceCalibration
-{
-public:
-  DeviceCalibration();
-  virtual ~DeviceCalibration();
+class DeviceCalibration {
+ public:
+    DeviceCalibration();
+    virtual ~DeviceCalibration();
 
-  //! \brief Convert counts to a physical value
-  /**
-   * \param counts Counts used by the device.
-   *
-   * \return Physical value
-   */
-  virtual double calibrate(int32_t counts) =0;
+    //! \brief Convert counts to a physical value
+    /**
+     * \param counts Counts used by the device.
+     *
+     * \return Physical value
+     */
+    virtual double calibrate(int32_t counts) = 0;
 
-  //! \brief Convert physical value to counts
-  /**
-   * \param value Physical value
-   *
-   * \return Counts used by the device.
-   */  
-  virtual int32_t uncalibrate(double value) =0;
+    //! \brief Convert physical value to counts
+    /**
+     * \param value Physical value
+     *
+     * \return Counts used by the device.
+     */
+    virtual int32_t uncalibrate(double value) = 0;
 };
 
-#endif // DEVICECALIBRATION_H
+#endif  // DEVICECALIBRATION_H
diff --git a/src/libDevCom/DeviceCom.h b/src/libDevCom/DeviceCom.h
index bb346f44..bb707a1e 100644
--- a/src/libDevCom/DeviceCom.h
+++ b/src/libDevCom/DeviceCom.h
@@ -1,42 +1,41 @@
 #ifndef DEVICECOM_H
 #define DEVICECOM_H
 
-#include <vector>
 #include <cstdint>
+#include <vector>
 
-class DeviceCom
-{
-public:
-  DeviceCom();
-
-  //
-  // Write commands
-  virtual void write_reg32(uint32_t address, uint32_t data) =0;
-  virtual void write_reg16(uint32_t address, uint16_t data) =0;
-  virtual void write_reg8 (uint32_t address, uint8_t  data) =0;
-
-  virtual void write_reg32(uint32_t data) =0;
-  virtual void write_reg16(uint16_t data) =0;
-  virtual void write_reg8 (uint8_t  data) =0;
-
-  virtual void write_block(uint32_t address, const std::vector<uint8_t>& data) =0;
-  virtual void write_block(const std::vector<uint8_t>& data) =0;
-
-
-  //
-  // Read commands
-  virtual uint32_t read_reg32(uint32_t address) =0;
-  virtual uint32_t read_reg24(uint32_t address) =0;
-  virtual uint16_t read_reg16(uint32_t address) =0;
-  virtual uint8_t  read_reg8 (uint32_t address) =0;
-
-  virtual uint32_t read_reg32() =0;
-  virtual uint32_t read_reg24() =0;
-  virtual uint16_t read_reg16() =0;
-  virtual uint8_t  read_reg8 () =0;
-
-  virtual void read_block(uint32_t address, std::vector<uint8_t>& data) =0;
-  virtual void read_block(std::vector<uint8_t>& data) =0;
+class DeviceCom {
+ public:
+    DeviceCom();
+
+    //
+    // Write commands
+    virtual void write_reg32(uint32_t address, uint32_t data) = 0;
+    virtual void write_reg16(uint32_t address, uint16_t data) = 0;
+    virtual void write_reg8(uint32_t address, uint8_t data) = 0;
+
+    virtual void write_reg32(uint32_t data) = 0;
+    virtual void write_reg16(uint16_t data) = 0;
+    virtual void write_reg8(uint8_t data) = 0;
+
+    virtual void write_block(uint32_t address,
+                             const std::vector<uint8_t>& data) = 0;
+    virtual void write_block(const std::vector<uint8_t>& data) = 0;
+
+    //
+    // Read commands
+    virtual uint32_t read_reg32(uint32_t address) = 0;
+    virtual uint32_t read_reg24(uint32_t address) = 0;
+    virtual uint16_t read_reg16(uint32_t address) = 0;
+    virtual uint8_t read_reg8(uint32_t address) = 0;
+
+    virtual uint32_t read_reg32() = 0;
+    virtual uint32_t read_reg24() = 0;
+    virtual uint16_t read_reg16() = 0;
+    virtual uint8_t read_reg8() = 0;
+
+    virtual void read_block(uint32_t address, std::vector<uint8_t>& data) = 0;
+    virtual void read_block(std::vector<uint8_t>& data) = 0;
 };
 
-#endif // DEVICECOM_H
+#endif  // DEVICECOM_H
diff --git a/src/libDevCom/DummyCalibration.h b/src/libDevCom/DummyCalibration.h
index e50b9d05..f8d65615 100644
--- a/src/libDevCom/DummyCalibration.h
+++ b/src/libDevCom/DummyCalibration.h
@@ -4,11 +4,10 @@
 #include "DeviceCalibration.h"
 
 //! \brief Calibration that assumes `counts = value`.
-class DummyCalibration : public DeviceCalibration
-{
-public:
-  virtual double calibrate(int32_t counts);
-  virtual int32_t uncalibrate(double value);
+class DummyCalibration : public DeviceCalibration {
+ public:
+    virtual double calibrate(int32_t counts);
+    virtual int32_t uncalibrate(double value);
 };
 
-#endif // DUMMYCALIBRATION_H
+#endif  // DUMMYCALIBRATION_H
diff --git a/src/libDevCom/FT232H.cpp b/src/libDevCom/FT232H.cpp
index 86b36a72..58a96933 100644
--- a/src/libDevCom/FT232H.cpp
+++ b/src/libDevCom/FT232H.cpp
@@ -1,9 +1,10 @@
 #include "FT232H.h"
 
-//labremote
+// labremote
 #include "Logger.h"
 
-FT232H::FT232H(MPSSEChip::Protocol protocol, MPSSEChip::Speed speed, MPSSEChip::Endianness endianness,
-            const std::string& description, const std::string& serial) :
-    MPSSEChip(protocol, speed, endianness, 0x0403, 0x6014, description, serial)
-{}
+FT232H::FT232H(MPSSEChip::Protocol protocol, MPSSEChip::Speed speed,
+               MPSSEChip::Endianness endianness, const std::string& description,
+               const std::string& serial)
+    : MPSSEChip(protocol, speed, endianness, 0x0403, 0x6014, description,
+                serial) {}
diff --git a/src/libDevCom/FT232H.h b/src/libDevCom/FT232H.h
index 144bc133..5faea172 100644
--- a/src/libDevCom/FT232H.h
+++ b/src/libDevCom/FT232H.h
@@ -1,8 +1,8 @@
 #ifndef FT232H_H
 #define FT232H_H
 
-// these map the GPIO functionality of the ADBUS and ACBUS to the pin numbering scheme used by libmpsse
-// (excludes default SK, D0, DI, CS pins)
+// these map the GPIO functionality of the ADBUS and ACBUS to the pin numbering
+// scheme used by libmpsse (excludes default SK, D0, DI, CS pins)
 #define GPIO_ADBUS_4 0
 #define GPIO_ADBUS_5 1
 #define GPIO_ADBUS_6 2
@@ -25,14 +25,13 @@
  * Vendor ID: 0x0403
  * Product ID: 0x6014
  */
-class FT232H : public MPSSEChip
-{
-    public:
-        FT232H(MPSSEChip::Protocol protocol, MPSSEChip::Speed speed, MPSSEChip::Endianness endianness,
-            const std::string& description = "", const std::string& serial = "");
+class FT232H : public MPSSEChip {
+ public:
+    FT232H(MPSSEChip::Protocol protocol, MPSSEChip::Speed speed,
+           MPSSEChip::Endianness endianness,
+           const std::string& description = "", const std::string& serial = "");
 
-    private:
+ private:
+};  // FT232H
 
-}; // FT232H
-
-#endif // FT232H_H
+#endif  // FT232H_H
diff --git a/src/libDevCom/FileCalibration.cpp b/src/libDevCom/FileCalibration.cpp
index 5c5edf5f..b32759fe 100644
--- a/src/libDevCom/FileCalibration.cpp
+++ b/src/libDevCom/FileCalibration.cpp
@@ -3,41 +3,39 @@
 #include <cmath>
 #include <fstream>
 
-FileCalibration::FileCalibration(const std::string& path)
-{
-  std::ifstream fh(path);
-  // Read header
-  std::string dummy;
-  std::getline(fh, dummy);
-  
-  double counts,value;
-  while(!fh.eof())
-    {
-      fh >> counts >> value;
-      m_counts.push_back(counts);
-      m_values.push_back(value );
+FileCalibration::FileCalibration(const std::string& path) {
+    std::ifstream fh(path);
+    // Read header
+    std::string dummy;
+    std::getline(fh, dummy);
+
+    double counts, value;
+    while (!fh.eof()) {
+        fh >> counts >> value;
+        m_counts.push_back(counts);
+        m_values.push_back(value);
     }
 }
 
-FileCalibration::~FileCalibration()
-{ }
+FileCalibration::~FileCalibration() {}
 
-double FileCalibration::calibrate(int32_t counts)
-{
-  for(uint32_t i=0; i<m_counts.size()-1; i++)
-    {
-      if(m_counts[i]<=counts && counts<m_counts[i+1]) // Found interval
-	return m_values[i]+(m_counts[i]-counts)/(m_counts[i]-m_counts[i+1])*(m_values[i+1]-m_values[i]);
+double FileCalibration::calibrate(int32_t counts) {
+    for (uint32_t i = 0; i < m_counts.size() - 1; i++) {
+        if (m_counts[i] <= counts &&
+            counts < m_counts[i + 1])  // Found interval
+            return m_values[i] + (m_counts[i] - counts) /
+                                     (m_counts[i] - m_counts[i + 1]) *
+                                     (m_values[i + 1] - m_values[i]);
     }
-  return 0.;
+    return 0.;
 }
-  
-int32_t FileCalibration::uncalibrate(double value)
-{
-  for(uint32_t i=0; i<m_values.size()-1; i++)
-    {
-      if(m_values[i]<=value && value<m_values[i+1]) // Found interval
-	return m_counts[i]+(m_values[i]-value)/(m_values[i]-m_values[i+1])*(m_counts[i+1]-m_counts[i]);
+
+int32_t FileCalibration::uncalibrate(double value) {
+    for (uint32_t i = 0; i < m_values.size() - 1; i++) {
+        if (m_values[i] <= value && value < m_values[i + 1])  // Found interval
+            return m_counts[i] + (m_values[i] - value) /
+                                     (m_values[i] - m_values[i + 1]) *
+                                     (m_counts[i + 1] - m_counts[i]);
     }
-  return 0;
+    return 0;
 }
diff --git a/src/libDevCom/FileCalibration.h b/src/libDevCom/FileCalibration.h
index 25e2a97c..ecf15094 100644
--- a/src/libDevCom/FileCalibration.h
+++ b/src/libDevCom/FileCalibration.h
@@ -1,11 +1,11 @@
 #ifndef FILECALIBRATION_H
 #define FILECALIBRATION_H
 
-#include "DeviceCalibration.h"
-
 #include <string>
 #include <vector>
 
+#include "DeviceCalibration.h"
+
 //! \brief Calibration read from a file containing values at specific points.
 /**
  * Calibration read from a file containing values at specific points. Linear
@@ -23,21 +23,20 @@
  * The first line is a header. The remaining are measurment points with
  * the first column being the counts and the second the calibrated value.
  */
-class FileCalibration : public DeviceCalibration
-{
-public:
-  /**
-   * \param path Path to the file containing the calibration table
-   */
-  FileCalibration(const std::string& path);
-  virtual ~FileCalibration();
+class FileCalibration : public DeviceCalibration {
+ public:
+    /**
+     * \param path Path to the file containing the calibration table
+     */
+    FileCalibration(const std::string& path);
+    virtual ~FileCalibration();
 
-  virtual double calibrate(int32_t counts);
-  virtual int32_t uncalibrate(double value);
+    virtual double calibrate(int32_t counts);
+    virtual int32_t uncalibrate(double value);
 
-private:
-  std::vector<double> m_counts;
-  std::vector<double> m_values;
+ private:
+    std::vector<double> m_counts;
+    std::vector<double> m_values;
 };
 
-#endif // FILECALIBRATION_H
+#endif  // FILECALIBRATION_H
diff --git a/src/libDevCom/HIH4000.cpp b/src/libDevCom/HIH4000.cpp
index d62d1324..2791b87c 100644
--- a/src/libDevCom/HIH4000.cpp
+++ b/src/libDevCom/HIH4000.cpp
@@ -1,47 +1,37 @@
 #include "HIH4000.h"
 
+#include <cmath>
+
 #include "NotSupportedException.h"
 
-#include <cmath>
+HIH4000::HIH4000(uint8_t chan, std::shared_ptr<ADCDevice> dev,
+                 std::shared_ptr<ClimateSensor> tempSens)
+    : m_adcdev(dev), m_tempSens(tempSens), m_chan(chan) {}
 
-HIH4000::HIH4000(uint8_t chan, std::shared_ptr<ADCDevice> dev, std::shared_ptr<ClimateSensor> tempSens)
-  : m_adcdev(dev), m_tempSens(tempSens), m_chan(chan)
-{ }
-
-HIH4000::~HIH4000()
-{ }
-
-void HIH4000::init()
-{ }
-
-void HIH4000::reset()
-{ }
-
-void HIH4000::read()
-{
-  m_tempSens->read();
-  m_temperature=m_tempSens->temperature();
-  m_humidity = 0.;
-  const uint navg = 5;
-  for(uint i=0;i<navg;i++)
-    m_humidity += (float)m_adcdev->read(m_chan);
-  m_humidity/=(float)navg;
-  // temperature correction
-  m_humidity=(m_humidity-0.16)/0.0062/(1.0546-0.00216*m_temperature);
-}
+HIH4000::~HIH4000() {}
 
-float HIH4000::temperature() const
-{
-  return m_temperature;
-}
+void HIH4000::init() {}
+
+void HIH4000::reset() {}
 
-float HIH4000::humidity() const
-{
-  return m_humidity;
+void HIH4000::read() {
+    m_tempSens->read();
+    m_temperature = m_tempSens->temperature();
+    m_humidity = 0.;
+    const uint navg = 5;
+    for (uint i = 0; i < navg; i++)
+        m_humidity += static_cast<float>(m_adcdev)->read(m_chan);
+    m_humidity /= static_cast<float>(navg);
+    // temperature correction
+    m_humidity =
+        (m_humidity - 0.16) / 0.0062 / (1.0546 - 0.00216 * m_temperature);
 }
 
-float HIH4000::pressure() const
-{
-  throw NotSupportedException("Pressure not supported for HIH4000");
-  return 0;
+float HIH4000::temperature() const { return m_temperature; }
+
+float HIH4000::humidity() const { return m_humidity; }
+
+float HIH4000::pressure() const {
+    throw NotSupportedException("Pressure not supported for HIH4000");
+    return 0;
 }
diff --git a/src/libDevCom/HIH4000.h b/src/libDevCom/HIH4000.h
index 21ea4d7c..36ebfc44 100644
--- a/src/libDevCom/HIH4000.h
+++ b/src/libDevCom/HIH4000.h
@@ -1,48 +1,50 @@
 #ifndef HIH4000_H
 #define HIH4000_H
 
+#include "ADCDevice.h"
 #include "ClimateSensor.h"
 #include "TextSerialCom.h"
-#include "ADCDevice.h"
 
 //! \brief An implementation of 'ClimateSensor' for reading an HIH4000 sensor
 /**
  * Measures humidity using a HIH4000 sensor connected to one of the analog pins
  * on an Arduino via an ADC intereface.
- * humiditry requires temperature connection: according sensor has to be provided
- * HIH4000 specs: https://sensing.honeywell.com/HIH-4000-001-humidity-sensors
+ * humiditry requires temperature connection: according sensor has to be
+ * provided HIH4000 specs:
+ * https://sensing.honeywell.com/HIH-4000-001-humidity-sensors
  */
 
-class HIH4000: public ClimateSensor
-{
-public:
-  /**
-   * \param chan The channel number of the analog channel connected to the Pt
-   * \param dev The ADCDevice for interfacing with the Adruino or similar - should be calibrated
-   *        to return measured voltage as 0...100% of the operational voltage
-   */
-  HIH4000(uint8_t chan, std::shared_ptr<ADCDevice> dev, std::shared_ptr<ClimateSensor> tempSens);
-  virtual ~HIH4000();
+class HIH4000 : public ClimateSensor {
+ public:
+    /**
+     * \param chan The channel number of the analog channel connected to the Pt
+     * \param dev The ADCDevice for interfacing with the Adruino or similar -
+     * should be calibrated to return measured voltage as 0...100% of the
+     * operational voltage
+     */
+    HIH4000(uint8_t chan, std::shared_ptr<ADCDevice> dev,
+            std::shared_ptr<ClimateSensor> tempSens);
+    virtual ~HIH4000();
 
-  virtual void init();
-  virtual void reset();
-  virtual void read();
+    virtual void init();
+    virtual void reset();
+    virtual void read();
 
-  virtual float temperature() const;
-  virtual float humidity() const;
-  virtual float pressure() const;
+    virtual float temperature() const;
+    virtual float humidity() const;
+    virtual float pressure() const;
 
-private:
-  //! Interface with the Arduino via the ADC protocol
-  std::shared_ptr<ADCDevice> m_adcdev;
-  //! The channel of the ADC connected to the Pt
-  uint8_t m_chan;
-  //! The temperature recorded in the last reading (defaults to -273.15)
-  float m_temperature = -273.15;
-  //! The humidity recorded in the last reading (defaults to 0)
-  float m_humidity = 0.;
-  //! ref. to the temperature sensor from which temp. correction is derived
-  std::shared_ptr<ClimateSensor> m_tempSens;
+ private:
+    //! Interface with the Arduino via the ADC protocol
+    std::shared_ptr<ADCDevice> m_adcdev;
+    //! The channel of the ADC connected to the Pt
+    uint8_t m_chan;
+    //! The temperature recorded in the last reading (defaults to -273.15)
+    float m_temperature = -273.15;
+    //! The humidity recorded in the last reading (defaults to 0)
+    float m_humidity = 0.;
+    //! ref. to the temperature sensor from which temp. correction is derived
+    std::shared_ptr<ClimateSensor> m_tempSens;
 };
 
-#endif // HIH4000_H
+#endif  // HIH4000_H
diff --git a/src/libDevCom/HIH6130.cpp b/src/libDevCom/HIH6130.cpp
index 71cf514c..ca4b74ba 100644
--- a/src/libDevCom/HIH6130.cpp
+++ b/src/libDevCom/HIH6130.cpp
@@ -1,49 +1,43 @@
 #include "HIH6130.h"
 
-#include <unistd.h>
 #include <math.h>
+#include <unistd.h>
 
 #include "NotSupportedException.h"
 
-HIH6130::HIH6130(std::shared_ptr<I2CCom> i2c)
-  : m_i2c(i2c)
-{ }
+HIH6130::HIH6130(std::shared_ptr<I2CCom> i2c) : m_i2c(i2c) {}
 
-HIH6130::~HIH6130()
-{ }
+HIH6130::~HIH6130() {}
 
-void HIH6130::init()
-{ }
+void HIH6130::init() {}
 
-void HIH6130::reset()
-{ }
+void HIH6130::reset() {}
 
-void HIH6130::read()
-{
-  unsigned int humidata,tempdata;
+void HIH6130::read() {
+    unsigned int humidata, tempdata;
 
-  m_i2c->write_reg8(0x0);
-  usleep(500e3);
+    m_i2c->write_reg8(0x0);
+    usleep(500e3);
 
-  uint32_t intdata=m_i2c->read_reg32();
+    uint32_t intdata = m_i2c->read_reg32();
 
-  // Parse the data
-  m_status=(intdata>>29)&0x3;
-  humidata=(intdata>>16)&0x3FFF;
-  tempdata=(intdata>> 2)&0x3FFF;
+    // Parse the data
+    m_status = (intdata >> 29) & 0x3;
+    humidata = (intdata >> 16) & 0x3FFF;
+    tempdata = (intdata >> 2) & 0x3FFF;
 
-  m_humidity=((float)humidata)/(pow(2,14)-2.);
-  m_temperature=((float)tempdata)/(pow(2,14)-2.)*165.-40.;
+    m_humidity = (static_cast<float>(humidata)) / (pow(2, 14) - 2.);
+    m_temperature =
+        (static_cast<float>(tempdata)) / (pow(2, 14) - 2.) * 165. - 40.;
 }
 
-uint HIH6130::status() const
-{ return m_status; }
+uint HIH6130::status() const { return m_status; }
 
-float HIH6130::temperature() const
-{ return m_temperature; }
+float HIH6130::temperature() const { return m_temperature; }
 
-float HIH6130::humidity() const
-{ return m_humidity; }
+float HIH6130::humidity() const { return m_humidity; }
 
-float HIH6130::pressure() const
-{ throw NotSupportedException("HIH6130 does not have a pressure sensor"); return 0; }
+float HIH6130::pressure() const {
+    throw NotSupportedException("HIH6130 does not have a pressure sensor");
+    return 0;
+}
diff --git a/src/libDevCom/HIH6130.h b/src/libDevCom/HIH6130.h
index 6a9fdfbe..6f0480b1 100644
--- a/src/libDevCom/HIH6130.h
+++ b/src/libDevCom/HIH6130.h
@@ -1,32 +1,31 @@
 #ifndef HIH6130_H
 #define HIH6130_H
 
+#include <memory>
+
 #include "ClimateSensor.h"
 #include "I2CCom.h"
 
-#include <memory>
-
-class HIH6130: public ClimateSensor
-{
-public:
-  HIH6130(std::shared_ptr<I2CCom> i2c);
-  virtual ~HIH6130();
+class HIH6130 : public ClimateSensor {
+ public:
+    HIH6130(std::shared_ptr<I2CCom> i2c);
+    virtual ~HIH6130();
 
-  virtual void init();
-  virtual void reset();
-  virtual void read();
+    virtual void init();
+    virtual void reset();
+    virtual void read();
 
-  virtual unsigned status() const;
-  virtual float temperature() const;
-  virtual float humidity() const;
-  virtual float pressure() const;
+    virtual unsigned status() const;
+    virtual float temperature() const;
+    virtual float humidity() const;
+    virtual float pressure() const;
 
-private:
-  std::shared_ptr<I2CCom> m_i2c;
+ private:
+    std::shared_ptr<I2CCom> m_i2c;
 
-  int m_status;
-  float m_temperature;
-  float m_humidity;
+    int m_status;
+    float m_temperature;
+    float m_humidity;
 };
 
-#endif // HIH6130_H
+#endif  // HIH6130_H
diff --git a/src/libDevCom/I2CCom.cpp b/src/libDevCom/I2CCom.cpp
index a2957e2e..a664f474 100644
--- a/src/libDevCom/I2CCom.cpp
+++ b/src/libDevCom/I2CCom.cpp
@@ -1,14 +1,9 @@
 #include "I2CCom.h"
 
-I2CCom::I2CCom(uint8_t deviceAddr)
-  : m_deviceAddr(deviceAddr)
-{ }
+I2CCom::I2CCom(uint8_t deviceAddr) : m_deviceAddr(deviceAddr) {}
 
-I2CCom::~I2CCom()
-{ }
+I2CCom::~I2CCom() {}
 
-void I2CCom::setDeviceAddr(uint8_t deviceAddr)
-{ m_deviceAddr=deviceAddr; }
+void I2CCom::setDeviceAddr(uint8_t deviceAddr) { m_deviceAddr = deviceAddr; }
 
-uint8_t I2CCom::deviceAddr() const
-{ return m_deviceAddr; }
+uint8_t I2CCom::deviceAddr() const { return m_deviceAddr; }
diff --git a/src/libDevCom/I2CCom.h b/src/libDevCom/I2CCom.h
index 5bf09e79..96b5d7db 100644
--- a/src/libDevCom/I2CCom.h
+++ b/src/libDevCom/I2CCom.h
@@ -1,26 +1,25 @@
 #ifndef I2CCOM_H
 #define I2CCOM_H
 
-#include "DeviceCom.h"
-
 #include <string>
 #include <vector>
 
+#include "DeviceCom.h"
+
 /**
  * All classes that inherit from this class have Python bindings
  */
 
-class I2CCom : public DeviceCom
-{
-public:
-  I2CCom(uint8_t deviceAddr);
-  virtual ~I2CCom();
+class I2CCom : public DeviceCom {
+ public:
+    I2CCom(uint8_t deviceAddr);
+    virtual ~I2CCom();
 
-  void setDeviceAddr(uint8_t deviceAddr);
-  uint8_t deviceAddr() const;
+    void setDeviceAddr(uint8_t deviceAddr);
+    uint8_t deviceAddr() const;
 
-private:
-  uint8_t m_deviceAddr;
+ private:
+    uint8_t m_deviceAddr;
 };
 
-#endif // I2CCOM_H
+#endif  // I2CCOM_H
diff --git a/src/libDevCom/I2CDevCom.cpp b/src/libDevCom/I2CDevCom.cpp
index b49367b3..1e71bb5b 100644
--- a/src/libDevCom/I2CDevCom.cpp
+++ b/src/libDevCom/I2CDevCom.cpp
@@ -1,381 +1,375 @@
 #include "I2CDevCom.h"
 
-#include "ComIOException.h"
-
+#include <fcntl.h>
 #include <sys/ioctl.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
+#include <sys/types.h>
 #include <unistd.h>
 
+#include "ComIOException.h"
+
 #ifndef __APPLE__
-#include <linux/i2c.h>
 #include <linux/i2c-dev.h>
+#include <linux/i2c.h>
 
 #include <cstring>
-#include <string>
 #include <iterator>
+#include <string>
 
 I2CDevCom::I2CDevCom(uint8_t deviceAddr, const std::string& i2cdev)
-  : I2CCom(deviceAddr)
-{
-  m_fh = open(i2cdev.c_str(), O_RDWR);
-  if(m_fh<0)
-    throw ComIOException(std::string("I2CDev open failed: ")+std::strerror(errno));
+    : I2CCom(deviceAddr) {
+    m_fh = open(i2cdev.c_str(), O_RDWR);
+    if (m_fh < 0)
+        throw ComIOException(std::string("I2CDev open failed: ") +
+                             std::strerror(errno));
 }
 
-I2CDevCom::~I2CDevCom()
-{
-  if(m_fh>0) close(m_fh);
+I2CDevCom::~I2CDevCom() {
+    if (m_fh > 0) close(m_fh);
 }
 
-void I2CDevCom::write_reg32(uint32_t address, uint32_t data)
-{
-  uint8_t inbuf[5] = {static_cast<uint8_t>(address&0xFF),
-		      static_cast<uint8_t>((data>>24)&0xFF),
-		      static_cast<uint8_t>((data>>16)&0xFF),
-		      static_cast<uint8_t>((data>> 8)&0xFF),
-		      static_cast<uint8_t>((data>> 0)&0xFF)};
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
-
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = 5;
-  msgs[0].buf = inbuf;
-
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
-
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev write_reg32 failed: ")+std::strerror(errno));
+void I2CDevCom::write_reg32(uint32_t address, uint32_t data) {
+    uint8_t inbuf[5] = {static_cast<uint8_t>(address & 0xFF),
+                        static_cast<uint8_t>((data >> 24) & 0xFF),
+                        static_cast<uint8_t>((data >> 16) & 0xFF),
+                        static_cast<uint8_t>((data >> 8) & 0xFF),
+                        static_cast<uint8_t>((data >> 0) & 0xFF)};
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
+
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = 5;
+    msgs[0].buf = inbuf;
+
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
+
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev write_reg32 failed: ") +
+                             std::strerror(errno));
 }
 
-void I2CDevCom::write_reg16(uint32_t address, uint16_t data)
-{
-  uint8_t inbuf[3] = {static_cast<uint8_t>(address&0xFF),
-		      static_cast<uint8_t>((data>> 8)&0xFF),
-		      static_cast<uint8_t>((data>> 0)&0xFF)};
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
+void I2CDevCom::write_reg16(uint32_t address, uint16_t data) {
+    uint8_t inbuf[3] = {static_cast<uint8_t>(address & 0xFF),
+                        static_cast<uint8_t>((data >> 8) & 0xFF),
+                        static_cast<uint8_t>((data >> 0) & 0xFF)};
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = 3;
-  msgs[0].buf = inbuf;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = 3;
+    msgs[0].buf = inbuf;
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev write_reg16 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev write_reg16 failed: ") +
+                             std::strerror(errno));
 }
 
-void I2CDevCom::write_reg8 (uint32_t address, uint8_t  data)
-{
-  uint8_t inbuf[2] = {static_cast<uint8_t>(address&0xFF),
-		      data};
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
-
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = 2;
-  msgs[0].buf = inbuf;
+void I2CDevCom::write_reg8(uint32_t address, uint8_t data) {
+    uint8_t inbuf[2] = {static_cast<uint8_t>(address & 0xFF), data};
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = 2;
+    msgs[0].buf = inbuf;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev write_reg8 failed: ")+std::strerror(errno));
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
 
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev write_reg8 failed: ") +
+                             std::strerror(errno));
 }
 
-void I2CDevCom::write_reg32(uint32_t data)
-{
-  write_block({static_cast<uint8_t>((data>>24)&0xFF),
-	static_cast<uint8_t>((data>>16)&0xFF),
-	static_cast<uint8_t>((data>> 8)&0xFF),
-	static_cast<uint8_t>((data>> 0)&0xFF)});
+void I2CDevCom::write_reg32(uint32_t data) {
+    write_block({static_cast<uint8_t>((data >> 24) & 0xFF),
+                 static_cast<uint8_t>((data >> 16) & 0xFF),
+                 static_cast<uint8_t>((data >> 8) & 0xFF),
+                 static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void I2CDevCom::write_reg16(uint16_t data)
-{
-  write_block({static_cast<uint8_t>((data>> 8)&0xFF),
-	static_cast<uint8_t>((data>> 0)&0xFF)});
+void I2CDevCom::write_reg16(uint16_t data) {
+    write_block({static_cast<uint8_t>((data >> 8) & 0xFF),
+                 static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void I2CDevCom::write_reg8 (uint8_t  data)
-{
-  write_block({data});
-}
-
-void I2CDevCom::write_block(uint32_t address, const std::vector<uint8_t>& data)
-{
-  std::vector<uint8_t> inbuf=data;
-  inbuf.insert(inbuf.begin(),static_cast<uint8_t>(address&0xFF));
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
+void I2CDevCom::write_reg8(uint8_t data) { write_block({data}); }
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = inbuf.size();
-  msgs[0].buf = &inbuf[0];
+void I2CDevCom::write_block(uint32_t address,
+                            const std::vector<uint8_t>& data) {
+    std::vector<uint8_t> inbuf = data;
+    inbuf.insert(inbuf.begin(), static_cast<uint8_t>(address & 0xFF));
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = inbuf.size();
+    msgs[0].buf = &inbuf[0];
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev write_block failed: ")+std::strerror(errno));
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
 
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev write_block failed: ") +
+                             std::strerror(errno));
 }
 
-void I2CDevCom::write_block(const std::vector<uint8_t>& data)
-{
-  std::vector<uint8_t> inbuf=data;
+void I2CDevCom::write_block(const std::vector<uint8_t>& data) {
+    std::vector<uint8_t> inbuf = data;
 
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = inbuf.size();
-  msgs[0].buf = &inbuf[0];
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = inbuf.size();
+    msgs[0].buf = &inbuf[0];
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev write_block failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev write_block failed: ") +
+                             std::strerror(errno));
 }
 
-uint32_t I2CDevCom::read_reg32(uint32_t address)
-{
-  uint8_t outbuf[4];
-  uint8_t inbuf[1]={static_cast<uint8_t>(address&0xFF)};
-  struct i2c_msg msgs[2];
-  struct i2c_rdwr_ioctl_data msgset[1];
+uint32_t I2CDevCom::read_reg32(uint32_t address) {
+    uint8_t outbuf[4];
+    uint8_t inbuf[1] = {static_cast<uint8_t>(address & 0xFF)};
+    struct i2c_msg msgs[2];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = 1;
-  msgs[0].buf = inbuf;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = 1;
+    msgs[0].buf = inbuf;
 
-  msgs[1].addr = deviceAddr();
-  msgs[1].flags = I2C_M_RD;
-  msgs[1].len = 4;
-  msgs[1].buf = outbuf;
+    msgs[1].addr = deviceAddr();
+    msgs[1].flags = I2C_M_RD;
+    msgs[1].len = 4;
+    msgs[1].buf = outbuf;
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 2;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 2;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_reg32 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_reg32 failed: ") +
+                             std::strerror(errno));
 
-  return (outbuf[0]<< 24)|(outbuf[1]<< 16)|(outbuf[2]<< 8)|(outbuf[3]<< 0);
+    return (outbuf[0] << 24) | (outbuf[1] << 16) | (outbuf[2] << 8) |
+           (outbuf[3] << 0);
 }
 
-uint32_t I2CDevCom::read_reg24(uint32_t address)
-{
-  uint8_t outbuf[3];
-  uint8_t inbuf[1]={static_cast<uint8_t>(address&0xFF)};
-  struct i2c_msg msgs[2];
-  struct i2c_rdwr_ioctl_data msgset[1];
+uint32_t I2CDevCom::read_reg24(uint32_t address) {
+    uint8_t outbuf[3];
+    uint8_t inbuf[1] = {static_cast<uint8_t>(address & 0xFF)};
+    struct i2c_msg msgs[2];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = 1;
-  msgs[0].buf = inbuf;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = 1;
+    msgs[0].buf = inbuf;
 
-  msgs[1].addr = deviceAddr();
-  msgs[1].flags = I2C_M_RD;
-  msgs[1].len = 3;
-  msgs[1].buf = outbuf;
+    msgs[1].addr = deviceAddr();
+    msgs[1].flags = I2C_M_RD;
+    msgs[1].len = 3;
+    msgs[1].buf = outbuf;
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 2;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 2;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_reg24 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_reg24 failed: ") +
+                             std::strerror(errno));
 
-  return (outbuf[0]<< 16)| (outbuf[1]<< 8)|(outbuf[2]<< 0);
+    return (outbuf[0] << 16) | (outbuf[1] << 8) | (outbuf[2] << 0);
 }
 
-uint16_t I2CDevCom::read_reg16(uint32_t address)
-{
-  uint8_t outbuf[2];
-  uint8_t inbuf[1]={static_cast<uint8_t>(address&0xFF)};
-  struct i2c_msg msgs[2];
-  struct i2c_rdwr_ioctl_data msgset[1];
+uint16_t I2CDevCom::read_reg16(uint32_t address) {
+    uint8_t outbuf[2];
+    uint8_t inbuf[1] = {static_cast<uint8_t>(address & 0xFF)};
+    struct i2c_msg msgs[2];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = 1;
-  msgs[0].buf = inbuf;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = 1;
+    msgs[0].buf = inbuf;
 
-  msgs[1].addr = deviceAddr();
-  msgs[1].flags = I2C_M_RD;
-  msgs[1].len = 2;
-  msgs[1].buf = outbuf;
+    msgs[1].addr = deviceAddr();
+    msgs[1].flags = I2C_M_RD;
+    msgs[1].len = 2;
+    msgs[1].buf = outbuf;
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 2;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 2;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_reg16 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_reg16 failed: ") +
+                             std::strerror(errno));
 
-  return (outbuf[0]<< 8)|(outbuf[1]<< 0);
+    return (outbuf[0] << 8) | (outbuf[1] << 0);
 }
 
-uint8_t  I2CDevCom::read_reg8 (uint32_t address)
-{
-  uint8_t outbuf[1];
-  uint8_t inbuf[1]={static_cast<uint8_t>(address&0xFF)};
-  struct i2c_msg msgs[2];
-  struct i2c_rdwr_ioctl_data msgset[1];
+uint8_t I2CDevCom::read_reg8(uint32_t address) {
+    uint8_t outbuf[1];
+    uint8_t inbuf[1] = {static_cast<uint8_t>(address & 0xFF)};
+    struct i2c_msg msgs[2];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = 1;
-  msgs[0].buf = inbuf;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = 1;
+    msgs[0].buf = inbuf;
 
-  msgs[1].addr = deviceAddr();
-  msgs[1].flags = I2C_M_RD;
-  msgs[1].len = 1;
-  msgs[1].buf = outbuf;
+    msgs[1].addr = deviceAddr();
+    msgs[1].flags = I2C_M_RD;
+    msgs[1].len = 1;
+    msgs[1].buf = outbuf;
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 2;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 2;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_reg8 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_reg8 failed: ") +
+                             std::strerror(errno));
 
-  return outbuf[0];
+    return outbuf[0];
 }
 
-uint32_t I2CDevCom::read_reg32()
-{
-  uint8_t outbuf[4];
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
+uint32_t I2CDevCom::read_reg32() {
+    uint8_t outbuf[4];
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = I2C_M_RD;
-  msgs[0].len = 4;
-  msgs[0].buf = outbuf;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = I2C_M_RD;
+    msgs[0].len = 4;
+    msgs[0].buf = outbuf;
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_reg32 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_reg32 failed: ") +
+                             std::strerror(errno));
 
-  return (outbuf[0]<< 24)|(outbuf[1]<< 16)|(outbuf[2]<< 8)|(outbuf[3]<< 0);
+    return (outbuf[0] << 24) | (outbuf[1] << 16) | (outbuf[2] << 8) |
+           (outbuf[3] << 0);
 }
 
-uint32_t I2CDevCom::read_reg24()
-{
-  uint8_t outbuf[3];
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
+uint32_t I2CDevCom::read_reg24() {
+    uint8_t outbuf[3];
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = I2C_M_RD;
-  msgs[0].len = 3;
-  msgs[0].buf = outbuf;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = I2C_M_RD;
+    msgs[0].len = 3;
+    msgs[0].buf = outbuf;
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_reg24 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_reg24 failed: ") +
+                             std::strerror(errno));
 
-  return (outbuf[0]<< 16)|(outbuf[1]<< 8)|(outbuf[2]<< 0);
+    return (outbuf[0] << 16) | (outbuf[1] << 8) | (outbuf[2] << 0);
 }
 
+uint16_t I2CDevCom::read_reg16() {
+    uint8_t outbuf[2];
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-uint16_t I2CDevCom::read_reg16()
-{
-  uint8_t outbuf[2];
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = I2C_M_RD;
+    msgs[0].len = 2;
+    msgs[0].buf = outbuf;
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = I2C_M_RD;
-  msgs[0].len = 2;
-  msgs[0].buf = outbuf;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_reg32 failed: ") +
+                             std::strerror(errno));
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_reg32 failed: ")+std::strerror(errno));
-
-  return (outbuf[0]<< 8)|(outbuf[1]<< 0);
+    return (outbuf[0] << 8) | (outbuf[1] << 0);
 }
 
-uint8_t  I2CDevCom::read_reg8 ()
-{
-  uint8_t outbuf[1];
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
+uint8_t I2CDevCom::read_reg8() {
+    uint8_t outbuf[1];
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = I2C_M_RD;
-  msgs[0].len = 1;
-  msgs[0].buf = outbuf;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = I2C_M_RD;
+    msgs[0].len = 1;
+    msgs[0].buf = outbuf;
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_reg32 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_reg32 failed: ") +
+                             std::strerror(errno));
 
-  return outbuf[0];
+    return outbuf[0];
 }
 
-void I2CDevCom::read_block(uint32_t address, std::vector<uint8_t>& data)
-{
-  uint8_t inbuf[1]={static_cast<uint8_t>(address&0xFF)};
-  struct i2c_msg msgs[2];
-  struct i2c_rdwr_ioctl_data msgset[1];
+void I2CDevCom::read_block(uint32_t address, std::vector<uint8_t>& data) {
+    uint8_t inbuf[1] = {static_cast<uint8_t>(address & 0xFF)};
+    struct i2c_msg msgs[2];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = 0;
-  msgs[0].len = 1;
-  msgs[0].buf = inbuf;
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = 0;
+    msgs[0].len = 1;
+    msgs[0].buf = inbuf;
 
-  msgs[1].addr = deviceAddr();
-  msgs[1].flags = I2C_M_RD;
-  msgs[1].len = data.size();
-  msgs[1].buf = &data[0];
+    msgs[1].addr = deviceAddr();
+    msgs[1].flags = I2C_M_RD;
+    msgs[1].len = data.size();
+    msgs[1].buf = &data[0];
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 2;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 2;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_block failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_block failed: ") +
+                             std::strerror(errno));
 }
 
-void I2CDevCom::read_block(std::vector<uint8_t>& data)
-{
-  struct i2c_msg msgs[1];
-  struct i2c_rdwr_ioctl_data msgset[1];
+void I2CDevCom::read_block(std::vector<uint8_t>& data) {
+    struct i2c_msg msgs[1];
+    struct i2c_rdwr_ioctl_data msgset[1];
 
-  msgs[0].addr = deviceAddr();
-  msgs[0].flags = I2C_M_RD;
-  msgs[0].len = data.size();
-  msgs[0].buf = &data[0];
+    msgs[0].addr = deviceAddr();
+    msgs[0].flags = I2C_M_RD;
+    msgs[0].len = data.size();
+    msgs[0].buf = &data[0];
 
-  msgset[0].msgs = msgs;
-  msgset[0].nmsgs = 1;
+    msgset[0].msgs = msgs;
+    msgset[0].nmsgs = 1;
 
-  if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
-    throw ComIOException(std::string("I2CDev read_block failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, I2C_RDWR, &msgset) < 0)
+        throw ComIOException(std::string("I2CDev read_block failed: ") +
+                             std::strerror(errno));
 }
 #else
 // Just don't run on mac
-I2CDevCom::I2CDevCom(uint8_t deviceAddr, const std::string& i2cdev) : I2CCom(deviceAddr) {}
+I2CDevCom::I2CDevCom(uint8_t deviceAddr, const std::string& i2cdev)
+    : I2CCom(deviceAddr) {}
 
 I2CDevCom::~I2CDevCom() {}
 
@@ -383,29 +377,30 @@ void I2CDevCom::write_reg32(uint32_t address, uint32_t data) {}
 
 void I2CDevCom::write_reg16(uint32_t address, uint16_t data) {}
 
-void I2CDevCom::write_reg8 (uint32_t address, uint8_t  data) {}
+void I2CDevCom::write_reg8(uint32_t address, uint8_t data) {}
 
 void I2CDevCom::write_reg32(uint32_t data) {}
 
 void I2CDevCom::write_reg16(uint16_t data) {}
 
-void I2CDevCom::write_reg8 (uint8_t  data) {}
+void I2CDevCom::write_reg8(uint8_t data) {}
 
-void I2CDevCom::write_block(uint32_t address, const std::vector<uint8_t>& data) {}
+void I2CDevCom::write_block(uint32_t address,
+                            const std::vector<uint8_t>& data) {}
 
 void I2CDevCom::write_block(const std::vector<uint8_t>& data) {}
 
-uint32_t I2CDevCom::read_reg32(uint32_t address) {return 0;}
+uint32_t I2CDevCom::read_reg32(uint32_t address) { return 0; }
 
-uint16_t I2CDevCom::read_reg16(uint32_t address) {return 0;}
+uint16_t I2CDevCom::read_reg16(uint32_t address) { return 0; }
 
-uint8_t  I2CDevCom::read_reg8 (uint32_t address) {return 0;}
+uint8_t I2CDevCom::read_reg8(uint32_t address) { return 0; }
 
-uint32_t I2CDevCom::read_reg32() {return 0;}
+uint32_t I2CDevCom::read_reg32() { return 0; }
 
-uint16_t I2CDevCom::read_reg16() {return 0;}
+uint16_t I2CDevCom::read_reg16() { return 0; }
 
-uint8_t  I2CDevCom::read_reg8 () {return 0;}
+uint8_t I2CDevCom::read_reg8() { return 0; }
 
 void I2CDevCom::read_block(uint32_t address, std::vector<uint8_t>& data) {}
 
diff --git a/src/libDevCom/I2CDevCom.h b/src/libDevCom/I2CDevCom.h
index 61fba02f..37f61b92 100644
--- a/src/libDevCom/I2CDevCom.h
+++ b/src/libDevCom/I2CDevCom.h
@@ -3,42 +3,42 @@
 
 #include "I2CCom.h"
 
-class I2CDevCom : public I2CCom
-{
-public:
-  I2CDevCom(uint8_t deviceAddr, const std::string& i2cdev);
-  virtual ~I2CDevCom();
-
-  //
-  // Write commands
-  virtual void write_reg32(uint32_t address, uint32_t data);
-  virtual void write_reg16(uint32_t address, uint16_t data);
-  virtual void write_reg8 (uint32_t address, uint8_t  data);
-
-  virtual void write_reg32(uint32_t data);
-  virtual void write_reg16(uint16_t data);
-  virtual void write_reg8 (uint8_t  data);
-
-  virtual void write_block(uint32_t address, const std::vector<uint8_t>& data);
-  virtual void write_block(const std::vector<uint8_t>& data);
-
-  //
-  // Read commands
-  virtual uint32_t read_reg32(uint32_t address);
-  virtual uint32_t read_reg24(uint32_t address);
-  virtual uint16_t read_reg16(uint32_t address);
-  virtual uint8_t  read_reg8 (uint32_t address);
-
-  virtual uint32_t read_reg32();
-  virtual uint32_t read_reg24();
-  virtual uint16_t read_reg16();
-  virtual uint8_t  read_reg8 ();
-
-  virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
-  virtual void read_block(std::vector<uint8_t>& data);
-  
-private:
-  int m_fh =0;
+class I2CDevCom : public I2CCom {
+ public:
+    I2CDevCom(uint8_t deviceAddr, const std::string& i2cdev);
+    virtual ~I2CDevCom();
+
+    //
+    // Write commands
+    virtual void write_reg32(uint32_t address, uint32_t data);
+    virtual void write_reg16(uint32_t address, uint16_t data);
+    virtual void write_reg8(uint32_t address, uint8_t data);
+
+    virtual void write_reg32(uint32_t data);
+    virtual void write_reg16(uint16_t data);
+    virtual void write_reg8(uint8_t data);
+
+    virtual void write_block(uint32_t address,
+                             const std::vector<uint8_t>& data);
+    virtual void write_block(const std::vector<uint8_t>& data);
+
+    //
+    // Read commands
+    virtual uint32_t read_reg32(uint32_t address);
+    virtual uint32_t read_reg24(uint32_t address);
+    virtual uint16_t read_reg16(uint32_t address);
+    virtual uint8_t read_reg8(uint32_t address);
+
+    virtual uint32_t read_reg32();
+    virtual uint32_t read_reg24();
+    virtual uint16_t read_reg16();
+    virtual uint8_t read_reg8();
+
+    virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
+    virtual void read_block(std::vector<uint8_t>& data);
+
+ private:
+    int m_fh = 0;
 };
 
-#endif // I2CDEVCOM_H
+#endif  // I2CDEVCOM_H
diff --git a/src/libDevCom/I2CDevComuino.cpp b/src/libDevCom/I2CDevComuino.cpp
index d8afddfd..d47320d7 100644
--- a/src/libDevCom/I2CDevComuino.cpp
+++ b/src/libDevCom/I2CDevComuino.cpp
@@ -1,167 +1,146 @@
 #include "I2CDevComuino.h"
 
-#include "ComIOException.h"
-
 #include <chrono>
 #include <iomanip>
 #include <sstream>
 #include <thread>
 
-I2CDevComuino::I2CDevComuino(uint8_t deviceAddr, std::shared_ptr<TextSerialCom> serial)
-  : I2CCom(deviceAddr), m_serial(serial)
-{ }
+#include "ComIOException.h"
+
+I2CDevComuino::I2CDevComuino(uint8_t deviceAddr,
+                             std::shared_ptr<TextSerialCom> serial)
+    : I2CCom(deviceAddr), m_serial(serial) {}
 
-void I2CDevComuino::write_reg32(uint32_t address, uint32_t data)
-{
-  write_block({static_cast<uint8_t>(address&0xFF),
-	       static_cast<uint8_t>((data>>24)&0xFF),
-	       static_cast<uint8_t>((data>>16)&0xFF),
-	       static_cast<uint8_t>((data>> 8)&0xFF),
-	       static_cast<uint8_t>((data>> 0)&0xFF)});
+void I2CDevComuino::write_reg32(uint32_t address, uint32_t data) {
+    write_block({static_cast<uint8_t>(address & 0xFF),
+                 static_cast<uint8_t>((data >> 24) & 0xFF),
+                 static_cast<uint8_t>((data >> 16) & 0xFF),
+                 static_cast<uint8_t>((data >> 8) & 0xFF),
+                 static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void I2CDevComuino::write_reg16(uint32_t address, uint16_t data)
-{
-  write_block({static_cast<uint8_t>(address&0xFF),
-	       static_cast<uint8_t>((data>> 8)&0xFF),
-	       static_cast<uint8_t>((data>> 0)&0xFF)});
+void I2CDevComuino::write_reg16(uint32_t address, uint16_t data) {
+    write_block({static_cast<uint8_t>(address & 0xFF),
+                 static_cast<uint8_t>((data >> 8) & 0xFF),
+                 static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void I2CDevComuino::write_reg8 (uint32_t address, uint8_t  data)
-{
-  write_block({static_cast<uint8_t>(address&0xFF),
-	       data});
+void I2CDevComuino::write_reg8(uint32_t address, uint8_t data) {
+    write_block({static_cast<uint8_t>(address & 0xFF), data});
 }
 
-void I2CDevComuino::write_reg32(uint32_t data)
-{
-  write_block({static_cast<uint8_t>((data>>24)&0xFF),
-	       static_cast<uint8_t>((data>>16)&0xFF),
-	       static_cast<uint8_t>((data>> 8)&0xFF),
-	       static_cast<uint8_t>((data>> 0)&0xFF)});
+void I2CDevComuino::write_reg32(uint32_t data) {
+    write_block({static_cast<uint8_t>((data >> 24) & 0xFF),
+                 static_cast<uint8_t>((data >> 16) & 0xFF),
+                 static_cast<uint8_t>((data >> 8) & 0xFF),
+                 static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void I2CDevComuino::write_reg16(uint16_t data)
-{
-  write_block({static_cast<uint8_t>((data>> 8)&0xFF),
-	       static_cast<uint8_t>((data>> 0)&0xFF)});
+void I2CDevComuino::write_reg16(uint16_t data) {
+    write_block({static_cast<uint8_t>((data >> 8) & 0xFF),
+                 static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void I2CDevComuino::write_reg8 (uint8_t  data)
-{
-  write_block({data});
+void I2CDevComuino::write_reg8(uint8_t data) { write_block({data}); }
+
+void I2CDevComuino::write_block(uint32_t address,
+                                const std::vector<uint8_t>& data) {
+    std::vector<uint8_t> inbuf = data;
+    inbuf.insert(inbuf.begin(), static_cast<uint8_t>(address & 0xFF));
+    write_block(inbuf);
 }
 
-void I2CDevComuino::write_block(uint32_t address, const std::vector<uint8_t>& data)
-{
-  std::vector<uint8_t> inbuf=data;
-  inbuf.insert(inbuf.begin(),static_cast<uint8_t>(address&0xFF));
-  write_block(inbuf);
+void I2CDevComuino::write_block(const std::vector<uint8_t>& data) {
+    std::stringstream cmd;
+    cmd << "I2C WRITE " << std::hex << std::setfill('0') << std::setw(2)
+        << (uint32_t)deviceAddr() << " ";
+    for (uint8_t x : data)
+        cmd << std::hex << std::setfill('0') << std::setw(2) << (uint32_t)x
+            << std::dec;
+
+    m_serial->send(cmd.str());
+
+    std::string response = m_serial->receive();
 }
 
-void I2CDevComuino::write_block(const std::vector<uint8_t>& data)
-{
-  std::stringstream cmd;
-  cmd << "I2C WRITE " << std::hex << std::setfill('0') << std::setw(2) << (uint32_t)deviceAddr() << " ";
-  for(uint8_t x : data)
-    cmd << std::hex << std::setfill('0') << std::setw(2) << (uint32_t)x << std::dec;
+uint32_t I2CDevComuino::read_reg32(uint32_t address) {
+    write_reg32(address);
 
-  m_serial->send(cmd.str());
+    std::vector<uint8_t> data(4);
+    read_block(data);
 
-  std::string response =  m_serial->receive();
+    return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3] << 0);
 }
 
-uint32_t I2CDevComuino::read_reg32(uint32_t address)
-{
-  write_reg32(address);
-  
-  std::vector<uint8_t> data(4);
-  read_block(data);
-    
-  return (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|(data[3]<<0);
+uint32_t I2CDevComuino::read_reg24(uint32_t address) {
+    write_reg32(address);
+
+    std::vector<uint8_t> data(3);
+    read_block(data);
+    return ((data[0] << 16) | (data[1] << 8) | (data[2] << 0));
 }
 
+uint16_t I2CDevComuino::read_reg16(uint32_t address) {
+    write_reg32(address);
 
-uint32_t I2CDevComuino::read_reg24(uint32_t address)
-{
-  write_reg32(address);
+    std::vector<uint8_t> data(2);
+    read_block(data);
 
-  std::vector<uint8_t> data(3);
-  read_block(data);
-  return (  (data[0]<< 16) | (data[1]<<8) | (data[2]<<0));
+    return (data[0] << 8) | (data[1] << 0);
 }
 
+uint8_t I2CDevComuino::read_reg8(uint32_t address) {
+    write_reg32(address);
 
-uint16_t I2CDevComuino::read_reg16(uint32_t address)
-{
-  write_reg32(address);
+    std::vector<uint8_t> data(1);
+    read_block(data);
 
-  std::vector<uint8_t> data(2);
-  read_block(data);
-    
-  return (data[0]<<8)|(data[1]<<0);
+    return (data[0] << 0);
 }
 
-uint8_t  I2CDevComuino::read_reg8 (uint32_t address)
-{
-  write_reg32(address);
+uint32_t I2CDevComuino::read_reg32() {
+    std::vector<uint8_t> data(4);
+    read_block(data);
 
-  std::vector<uint8_t> data(1);
-  read_block(data);
-    
-  return (data[0]<<0);
+    return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3] << 0);
 }
 
-uint32_t I2CDevComuino::read_reg32()
-{
-  std::vector<uint8_t> data(4);
-  read_block(data);
-    
-  return (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|(data[3]<<0);
-}
- 
-uint32_t I2CDevComuino::read_reg24()
-{
-  std::vector<uint8_t> data(3);
-  read_block(data);
-    
-  return (  (data[0]<< 16) | (data[1]<<8)|(data[2]<<0));
+uint32_t I2CDevComuino::read_reg24() {
+    std::vector<uint8_t> data(3);
+    read_block(data);
+
+    return ((data[0] << 16) | (data[1] << 8) | (data[2] << 0));
 }
 
-uint16_t I2CDevComuino::read_reg16()
-{
-  std::vector<uint8_t> data(2);
-  read_block(data);
-    
-  return (data[0]<<8)|(data[1]<<0);
+uint16_t I2CDevComuino::read_reg16() {
+    std::vector<uint8_t> data(2);
+    read_block(data);
+
+    return (data[0] << 8) | (data[1] << 0);
 }
 
-uint8_t  I2CDevComuino::read_reg8 ()
-{
-  std::vector<uint8_t> data(1);
-  read_block(data);
-    
-  return (data[0]<<0);
+uint8_t I2CDevComuino::read_reg8() {
+    std::vector<uint8_t> data(1);
+    read_block(data);
+
+    return (data[0] << 0);
 }
 
-void I2CDevComuino::read_block(uint32_t address, std::vector<uint8_t>& data)
-{
-  write_reg32(address);
-  read_block(data);
+void I2CDevComuino::read_block(uint32_t address, std::vector<uint8_t>& data) {
+    write_reg32(address);
+    read_block(data);
 }
 
-void I2CDevComuino::read_block(std::vector<uint8_t>& data)
-{
-  std::stringstream cmd;
-  cmd << "I2C READ " << std::hex << std::setfill('0') << std::setw(2) << (uint32_t)deviceAddr() << " " << data.size();
-  m_serial->send(cmd.str());
-  //std::this_thread::sleep_for(std::chrono::seconds(1));  
-  std::string response =  m_serial->receive();
+void I2CDevComuino::read_block(std::vector<uint8_t>& data) {
+    std::stringstream cmd;
+    cmd << "I2C READ " << std::hex << std::setfill('0') << std::setw(2)
+        << (uint32_t)deviceAddr() << " " << data.size();
+    m_serial->send(cmd.str());
+    // std::this_thread::sleep_for(std::chrono::seconds(1));
+    std::string response = m_serial->receive();
 
-  for(uint32_t i=0;i<response.size()/2;i++)
-    {
-      std::string byte=response.substr(2*i,2);
-      data[i]=std::stoul(byte.c_str(), nullptr, 16);
+    for (uint32_t i = 0; i < response.size() / 2; i++) {
+        std::string byte = response.substr(2 * i, 2);
+        data[i] = std::stoul(byte.c_str(), nullptr, 16);
     }
 }
-
diff --git a/src/libDevCom/I2CDevComuino.h b/src/libDevCom/I2CDevComuino.h
index 111e1329..cf2e444f 100644
--- a/src/libDevCom/I2CDevComuino.h
+++ b/src/libDevCom/I2CDevComuino.h
@@ -1,55 +1,57 @@
 #ifndef I2CDEVCOMUINO_H
 #define I2CDEVCOMUINO_H
 
-#include "I2CCom.h"
+#include <memory>
 
+#include "I2CCom.h"
 #include "TextSerialCom.h"
-#include <memory>
 
-//! \brief Implementation of the I2C communication for devices connected to an arduino 
+//! \brief Implementation of the I2C communication for devices connected to an
+//! arduino
 /**
- * it is based on the arduino sketch located in arduino/devcomuino/devcomuino.ino 
- * the device needs to be connected to the SDA/SCL pins of the arduino 
- * the SDA/SCL pins can not be used for analog readings
+ * it is based on the arduino sketch located in
+ * arduino/devcomuino/devcomuino.ino the device needs to be connected to the
+ * SDA/SCL pins of the arduino the SDA/SCL pins can not be used for analog
+ * readings
  */
 
-class I2CDevComuino : public I2CCom
-{
-public:
-  I2CDevComuino(uint8_t deviceAddr, std::shared_ptr<TextSerialCom> serial);
-  virtual ~I2CDevComuino() =default;
-
-  //
-  //Write commands 
-  virtual void write_reg32(uint32_t address, uint32_t data);
-  virtual void write_reg16(uint32_t address, uint16_t data);
-  virtual void write_reg8 (uint32_t address, uint8_t  data);
-
-  virtual void write_reg32(uint32_t data);
-  virtual void write_reg16(uint16_t data);
-  virtual void write_reg8 (uint8_t  data);
-
-  virtual void write_block(uint32_t address, const std::vector<uint8_t>& data);
-  virtual void write_block(const std::vector<uint8_t>& data);
-
-  //
-  // Read commands
-  virtual uint32_t read_reg32(uint32_t address);
-  virtual uint32_t read_reg24(uint32_t address);
-  virtual uint16_t read_reg16(uint32_t address);
-  virtual uint8_t  read_reg8 (uint32_t address);
-
-  virtual uint32_t read_reg32();
-  virtual uint32_t read_reg24();
-  virtual uint16_t read_reg16();
-  virtual uint8_t  read_reg8 ();
-
-  virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
-  virtual void read_block(std::vector<uint8_t>& data);
-    
-private:
-  /** Communication */
-  std::shared_ptr<TextSerialCom> m_serial;
+class I2CDevComuino : public I2CCom {
+ public:
+    I2CDevComuino(uint8_t deviceAddr, std::shared_ptr<TextSerialCom> serial);
+    virtual ~I2CDevComuino() = default;
+
+    //
+    // Write commands
+    virtual void write_reg32(uint32_t address, uint32_t data);
+    virtual void write_reg16(uint32_t address, uint16_t data);
+    virtual void write_reg8(uint32_t address, uint8_t data);
+
+    virtual void write_reg32(uint32_t data);
+    virtual void write_reg16(uint16_t data);
+    virtual void write_reg8(uint8_t data);
+
+    virtual void write_block(uint32_t address,
+                             const std::vector<uint8_t>& data);
+    virtual void write_block(const std::vector<uint8_t>& data);
+
+    //
+    // Read commands
+    virtual uint32_t read_reg32(uint32_t address);
+    virtual uint32_t read_reg24(uint32_t address);
+    virtual uint16_t read_reg16(uint32_t address);
+    virtual uint8_t read_reg8(uint32_t address);
+
+    virtual uint32_t read_reg32();
+    virtual uint32_t read_reg24();
+    virtual uint16_t read_reg16();
+    virtual uint8_t read_reg8();
+
+    virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
+    virtual void read_block(std::vector<uint8_t>& data);
+
+ private:
+    /** Communication */
+    std::shared_ptr<TextSerialCom> m_serial;
 };
 
-#endif // I2CDEVCOMUINO_H
+#endif  // I2CDEVCOMUINO_H
diff --git a/src/libDevCom/I2CFTDICom.cpp b/src/libDevCom/I2CFTDICom.cpp
index 98a030d8..86cc1a9b 100644
--- a/src/libDevCom/I2CFTDICom.cpp
+++ b/src/libDevCom/I2CFTDICom.cpp
@@ -1,266 +1,249 @@
 #include "I2CFTDICom.h"
-#include "MPSSEChip.h"
 
 #include <string.h>
 #include <unistd.h>
 
 #include "ComIOException.h"
+#include "MPSSEChip.h"
 
 I2CFTDICom::I2CFTDICom(std::shared_ptr<MPSSEChip> mpsse, uint8_t deviceAddr)
-  : I2CCom(deviceAddr)
-{
-  m_mpsse = mpsse;
+    : I2CCom(deviceAddr) {
+    m_mpsse = mpsse;
 }
 
-I2CFTDICom::~I2CFTDICom()
-{ }
+I2CFTDICom::~I2CFTDICom() {}
 
-void I2CFTDICom::write_reg32(uint32_t address, uint32_t data)
-{
-  std::vector<uint8_t> datavec = {static_cast<uint8_t>((data>>24)&0xFF),
-				  static_cast<uint8_t>((data>>16)&0xFF),
-				  static_cast<uint8_t>((data>> 8)&0xFF),
-				  static_cast<uint8_t>((data>> 0)&0xFF)};
+void I2CFTDICom::write_reg32(uint32_t address, uint32_t data) {
+    std::vector<uint8_t> datavec = {static_cast<uint8_t>((data >> 24) & 0xFF),
+                                    static_cast<uint8_t>((data >> 16) & 0xFF),
+                                    static_cast<uint8_t>((data >> 8) & 0xFF),
+                                    static_cast<uint8_t>((data >> 0) & 0xFF)};
 
-  write_block(address, datavec);
+    write_block(address, datavec);
 }
 
-void I2CFTDICom::write_reg16(uint32_t address, uint16_t data)
-{
-  std::vector<uint8_t> datavec = {static_cast<uint8_t>((data>> 8)&0xFF),
-				  static_cast<uint8_t>((data>> 0)&0xFF)};
+void I2CFTDICom::write_reg16(uint32_t address, uint16_t data) {
+    std::vector<uint8_t> datavec = {static_cast<uint8_t>((data >> 8) & 0xFF),
+                                    static_cast<uint8_t>((data >> 0) & 0xFF)};
 
-  write_block(address, datavec);
+    write_block(address, datavec);
 }
 
-void I2CFTDICom::write_reg8(uint32_t address, uint8_t data)
-{
-  std::vector<uint8_t> datavec = {static_cast<uint8_t>((data>> 0)&0xFF)};
+void I2CFTDICom::write_reg8(uint32_t address, uint8_t data) {
+    std::vector<uint8_t> datavec = {static_cast<uint8_t>((data >> 0) & 0xFF)};
 
-  write_block(address, datavec);
+    write_block(address, datavec);
 }
 
-void I2CFTDICom::write_reg32(uint32_t data)
-{
-  std::vector<uint8_t> datavec = {static_cast<uint8_t>((data>>24)&0xFF),
-				  static_cast<uint8_t>((data>>16)&0xFF),
-				  static_cast<uint8_t>((data>> 8)&0xFF),
-				  static_cast<uint8_t>((data>> 0)&0xFF)};
+void I2CFTDICom::write_reg32(uint32_t data) {
+    std::vector<uint8_t> datavec = {static_cast<uint8_t>((data >> 24) & 0xFF),
+                                    static_cast<uint8_t>((data >> 16) & 0xFF),
+                                    static_cast<uint8_t>((data >> 8) & 0xFF),
+                                    static_cast<uint8_t>((data >> 0) & 0xFF)};
 
-  write_block(datavec);
+    write_block(datavec);
 }
 
-void I2CFTDICom::write_reg16(uint16_t data)
-{
-  std::vector<uint8_t> datavec = {static_cast<uint8_t>((data>> 8)&0xFF),
-				  static_cast<uint8_t>((data>> 0)&0xFF)};
+void I2CFTDICom::write_reg16(uint16_t data) {
+    std::vector<uint8_t> datavec = {static_cast<uint8_t>((data >> 8) & 0xFF),
+                                    static_cast<uint8_t>((data >> 0) & 0xFF)};
 
-  write_block(datavec);
+    write_block(datavec);
 }
 
-void I2CFTDICom::write_reg8(uint8_t data)
-{
-  std::vector<uint8_t> datavec = {static_cast<uint8_t>((data>> 0)&0xFF)};
+void I2CFTDICom::write_reg8(uint8_t data) {
+    std::vector<uint8_t> datavec = {static_cast<uint8_t>((data >> 0) & 0xFF)};
 
-  write_block(datavec);
+    write_block(datavec);
 }
 
-void I2CFTDICom::write_block(uint32_t address, const std::vector<uint8_t>& data)
-{
+void I2CFTDICom::write_block(uint32_t address,
+                             const std::vector<uint8_t>& data) {
     // Establish the I2C START condition, taking control of the I2C bus.
-    if(!m_mpsse->start())
+    if (!m_mpsse->start())
         throw ComIOException("I2CFTDICom cannot sent START.");
 
     // Address the I2C secondary (i.e. wake it up), telling it that a write will
     // happen (LSB is 0)
-    char buf[1]={static_cast<int8_t>(deviceAddr()<<1)};
-    if(!m_mpsse->write(buf, 1))
-      throw ComIOException("I2CFTDICom cannot WRITE device address.");
-    
+    char buf[1] = {static_cast<int8_t>(deviceAddr() << 1)};
+    if (!m_mpsse->write(buf, 1))
+        throw ComIOException("I2CFTDICom cannot WRITE device address.");
+
     // Write the device's register address that we wish to read from
-    buf[0]=static_cast<int8_t>(address&0xFF);
-    if(!m_mpsse->write(buf, 1))
-      throw ComIOException("I2CFTDICom cannot WRITE register address.");
-    
+    buf[0] = static_cast<int8_t>(address & 0xFF);
+    if (!m_mpsse->write(buf, 1))
+        throw ComIOException("I2CFTDICom cannot WRITE register address.");
+
     // Transmit the data over the I2C bus to the I2C secondary
-    if(!m_mpsse->write(const_cast<char*>(reinterpret_cast<const char*>(&data[0])), data.size()))
-      throw ComIOException("I2CFTDICom cannot WRITE data.");
-    
-    // Establish the I2C STOP condition on the bus, ending the current I2C transaction.
-    if(!m_mpsse->stop())
-      throw ComIOException("I2CFTDICom cannot send STOP.");
+    if (!m_mpsse->write(
+            const_cast<char*>(reinterpret_cast<const char*>(&data[0])),
+            data.size()))
+        throw ComIOException("I2CFTDICom cannot WRITE data.");
+
+    // Establish the I2C STOP condition on the bus, ending the current I2C
+    // transaction.
+    if (!m_mpsse->stop()) throw ComIOException("I2CFTDICom cannot send STOP.");
 }
 
-void I2CFTDICom::write_block(const std::vector<uint8_t>& data)
-{
-  // Establish the I2C START condition, taking control of the I2C bus.
-  if(!m_mpsse->start())
-    throw ComIOException("I2CFTDICom cannot sent START.");
-
-  // Address the I2C secondary (i.e. wake it up), telling it that a write will
-  // happen (LSB is 0)
-  char buf[1]={static_cast<int8_t>(deviceAddr()<<1)};
-  if(!m_mpsse->write(buf, 1))
-    throw ComIOException("I2CFTDICom cannot WRITE device address.");
-
-  // Transmit the data over the I2C bus to the I2C secondary
-  if(!m_mpsse->write(const_cast<char*>(reinterpret_cast<const char*>(&data[0])), data.size()))
-    throw ComIOException("I2CFTDICom cannot WRITE data.");
-
-  // Establish the I2C STOP condition on the bus, ending the current I2C transaction.
-  if(!m_mpsse->stop())
-    throw ComIOException("I2CFTDICom cannot send STOP.");
+void I2CFTDICom::write_block(const std::vector<uint8_t>& data) {
+    // Establish the I2C START condition, taking control of the I2C bus.
+    if (!m_mpsse->start())
+        throw ComIOException("I2CFTDICom cannot sent START.");
+
+    // Address the I2C secondary (i.e. wake it up), telling it that a write will
+    // happen (LSB is 0)
+    char buf[1] = {static_cast<int8_t>(deviceAddr() << 1)};
+    if (!m_mpsse->write(buf, 1))
+        throw ComIOException("I2CFTDICom cannot WRITE device address.");
+
+    // Transmit the data over the I2C bus to the I2C secondary
+    if (!m_mpsse->write(
+            const_cast<char*>(reinterpret_cast<const char*>(&data[0])),
+            data.size()))
+        throw ComIOException("I2CFTDICom cannot WRITE data.");
+
+    // Establish the I2C STOP condition on the bus, ending the current I2C
+    // transaction.
+    if (!m_mpsse->stop()) throw ComIOException("I2CFTDICom cannot send STOP.");
 }
 
-uint32_t I2CFTDICom::read_reg32(uint32_t address)
-{
-  std::vector<uint8_t> data(4);
-  read_block(address, data);
-  return (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|(data[3]<<0);
+uint32_t I2CFTDICom::read_reg32(uint32_t address) {
+    std::vector<uint8_t> data(4);
+    read_block(address, data);
+    return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3] << 0);
 }
 
-uint32_t I2CFTDICom::read_reg24(uint32_t address)
-{
-  std::vector<uint8_t> data(3);
-  read_block(address, data);
-  return (data[0]<<16)|(data[1]<<8)|(data[2]<<0);
+uint32_t I2CFTDICom::read_reg24(uint32_t address) {
+    std::vector<uint8_t> data(3);
+    read_block(address, data);
+    return (data[0] << 16) | (data[1] << 8) | (data[2] << 0);
 }
 
-uint16_t I2CFTDICom::read_reg16(uint32_t address)
-{
-  std::vector<uint8_t> data(2);
-  read_block(address, data);
-  return (data[0]<<8)|(data[1]<<0);
+uint16_t I2CFTDICom::read_reg16(uint32_t address) {
+    std::vector<uint8_t> data(2);
+    read_block(address, data);
+    return (data[0] << 8) | (data[1] << 0);
 }
 
-uint8_t I2CFTDICom::read_reg8(uint32_t address)
-{
-  std::vector<uint8_t> data(1);
-  read_block(address, data);
-  return (data[0]<<0);
+uint8_t I2CFTDICom::read_reg8(uint32_t address) {
+    std::vector<uint8_t> data(1);
+    read_block(address, data);
+    return (data[0] << 0);
 }
 
-uint32_t I2CFTDICom::read_reg32()
-{
-  std::vector<uint8_t> data(4);
-  read_block(data);
-  return (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|(data[3]<<0);
+uint32_t I2CFTDICom::read_reg32() {
+    std::vector<uint8_t> data(4);
+    read_block(data);
+    return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3] << 0);
 }
 
-uint32_t I2CFTDICom::read_reg24()
-{
-  std::vector<uint8_t> data(3);
-  read_block(data);
-  return (data[0]<<16)|(data[1]<<8)|(data[2]<<0);
+uint32_t I2CFTDICom::read_reg24() {
+    std::vector<uint8_t> data(3);
+    read_block(data);
+    return (data[0] << 16) | (data[1] << 8) | (data[2] << 0);
 }
 
-uint16_t I2CFTDICom::read_reg16()
-{
-  std::vector<uint8_t> data(2);
-  read_block(data);
-  return (data[0]<<8)|(data[1]<<0);
+uint16_t I2CFTDICom::read_reg16() {
+    std::vector<uint8_t> data(2);
+    read_block(data);
+    return (data[0] << 8) | (data[1] << 0);
 }
 
-uint8_t I2CFTDICom::read_reg8()
-{
-  std::vector<uint8_t> data(1);
-  read_block(data);
-  return (data[0]<<0);
+uint8_t I2CFTDICom::read_reg8() {
+    std::vector<uint8_t> data(1);
+    read_block(data);
+    return (data[0] << 0);
 }
 
-void I2CFTDICom::read_block(uint32_t address, std::vector<uint8_t>& data)
-{
-  char buf[1] = {0};
-  char *outbuf;
-
-  // Establish the I2C START condition, taking control of the I2C bus.
-  if(!m_mpsse->start())
-    throw ComIOException("I2CFTDICom cannot sent START.");
-
-  // Address the I2C secondary (i.e. wake it up), telling it that a write will
-  // happen (LSB is 0)
-  buf[0]=static_cast<int8_t>(deviceAddr()<<1);
-  if(!m_mpsse->write(buf, 1))
-    throw ComIOException("I2CFTDICom cannot WRITE device address.");
-
-  // Write the device's register address that we wish to read from
-  buf[0]=static_cast<int8_t>(address&0xFF);
-  if(!m_mpsse->write(buf, 1))
-    throw ComIOException("I2CFTDICom cannot WRITE register address.");
-
-  // Read back the data, first checking that the I2C secondary responded to the address write
-  // with ACK bit HIGH
-  if(m_mpsse->get_ack())
-    {
-      // Take control of I2C bus
-      if(!m_mpsse->start())
-	    throw ComIOException("I2CFTDICom cannot sent START.");
-      
-      // Address the I2C secondary, telling it that a read will happen (LSB is 1)
-      buf[0]=static_cast<int8_t>((deviceAddr()<<1)|1);
-      if(!m_mpsse->write(buf, 1))
-	    throw ComIOException("I2CFTDICom cannot WRITE device address.");
-
-      // Set the I2C ACK bit high to allow continous clocking out of I2C data from
-      // I2C secondary during the calls to read(...).
-      m_mpsse->set_ack();
-      outbuf = m_mpsse->read(data.size());
-      for(uint32_t i=0;i<data.size();i++)
-	    data[i] = outbuf[i];
-
-      // Set the I2C ACK bit low to tell the I2C secondary that we are done
-      // reading data, and then perform a single dummy read(...) so that
-      // this NACK is clocked out from I2C primary to I2C secondary.
-      m_mpsse->set_nack();
-      m_mpsse->read(1);
+void I2CFTDICom::read_block(uint32_t address, std::vector<uint8_t>& data) {
+    char buf[1] = {0};
+    char* outbuf;
+
+    // Establish the I2C START condition, taking control of the I2C bus.
+    if (!m_mpsse->start())
+        throw ComIOException("I2CFTDICom cannot sent START.");
+
+    // Address the I2C secondary (i.e. wake it up), telling it that a write will
+    // happen (LSB is 0)
+    buf[0] = static_cast<int8_t>(deviceAddr() << 1);
+    if (!m_mpsse->write(buf, 1))
+        throw ComIOException("I2CFTDICom cannot WRITE device address.");
+
+    // Write the device's register address that we wish to read from
+    buf[0] = static_cast<int8_t>(address & 0xFF);
+    if (!m_mpsse->write(buf, 1))
+        throw ComIOException("I2CFTDICom cannot WRITE register address.");
+
+    // Read back the data, first checking that the I2C secondary responded to
+    // the address write with ACK bit HIGH
+    if (m_mpsse->get_ack()) {
+        // Take control of I2C bus
+        if (!m_mpsse->start())
+            throw ComIOException("I2CFTDICom cannot sent START.");
+
+        // Address the I2C secondary, telling it that a read will happen (LSB is
+        // 1)
+        buf[0] = static_cast<int8_t>((deviceAddr() << 1) | 1);
+        if (!m_mpsse->write(buf, 1))
+            throw ComIOException("I2CFTDICom cannot WRITE device address.");
+
+        // Set the I2C ACK bit high to allow continous clocking out of I2C data
+        // from I2C secondary during the calls to read(...).
+        m_mpsse->set_ack();
+        outbuf = m_mpsse->read(data.size());
+        for (uint32_t i = 0; i < data.size(); i++) data[i] = outbuf[i];
+
+        // Set the I2C ACK bit low to tell the I2C secondary that we are done
+        // reading data, and then perform a single dummy read(...) so that
+        // this NACK is clocked out from I2C primary to I2C secondary.
+        m_mpsse->set_nack();
+        m_mpsse->read(1);
+    } else {
+        throw ComIOException("I2CFTDICom did not see an ACK.");
     }
-  else
-    throw ComIOException("I2CFTDICom did not see an ACK.");
 
-  // Establish the I2C STOP condition on the bus, ending the current I2C transaction.
-  if(!m_mpsse->stop())
-    throw ComIOException("I2CFTDICom cannot send STOP.");
+    // Establish the I2C STOP condition on the bus, ending the current I2C
+    // transaction.
+    if (!m_mpsse->stop()) throw ComIOException("I2CFTDICom cannot send STOP.");
 }
 
-void I2CFTDICom::read_block(std::vector<uint8_t>& data)
-{
-  char buf[1] = {0};
-  char *outbuf;
-
-  // Establish the I2C START condition, taking control of the I2C bus.
-  if(!m_mpsse->start())
-    throw ComIOException("I2CFTDICom cannot sent START.");
-
-  // Read back the data, first checking that the I2C secondary responded to the address write
-  // with ACK bit HIGH
-  if(m_mpsse->get_ack())
-    {
-      // Take control of I2C bus
-      if(!m_mpsse->start())
-	    throw ComIOException("I2CFTDICom cannot sent START.");
-      
-      // Address the I2C secondary, telling it that a read will happen (LSB is 1)
-      buf[0]=static_cast<int8_t>((deviceAddr()<<1)|1);
-      if(!m_mpsse->write(buf, 1))
-	    throw ComIOException("I2CFTDICom cannot WRITE device address.");
-
-      // Set the I2C ACK bit high to allow continous clocking out of I2C data from
-      // I2C secondary during the calls to read(...).
-      m_mpsse->set_ack();
-      outbuf = m_mpsse->read(data.size());
-      for(uint32_t i=0;i<data.size();i++)
-	    data[i] = outbuf[i];
-
-      // Set the I2C ACK bit low to tell the I2C secondary that we are done
-      // reading data, and then perform a single dummy read(...) so that
-      // this NACK is clocked out from I2C primary to I2C secondary.
-      m_mpsse->set_nack();
-      m_mpsse->read(1);
+void I2CFTDICom::read_block(std::vector<uint8_t>& data) {
+    char buf[1] = {0};
+    char* outbuf;
+
+    // Establish the I2C START condition, taking control of the I2C bus.
+    if (!m_mpsse->start())
+        throw ComIOException("I2CFTDICom cannot sent START.");
+
+    // Read back the data, first checking that the I2C secondary responded to
+    // the address write with ACK bit HIGH
+    if (m_mpsse->get_ack()) {
+        // Take control of I2C bus
+        if (!m_mpsse->start())
+            throw ComIOException("I2CFTDICom cannot sent START.");
+
+        // Address the I2C secondary, telling it that a read will happen (LSB is
+        // 1)
+        buf[0] = static_cast<int8_t>((deviceAddr() << 1) | 1);
+        if (!m_mpsse->write(buf, 1))
+            throw ComIOException("I2CFTDICom cannot WRITE device address.");
+
+        // Set the I2C ACK bit high to allow continous clocking out of I2C data
+        // from I2C secondary during the calls to read(...).
+        m_mpsse->set_ack();
+        outbuf = m_mpsse->read(data.size());
+        for (uint32_t i = 0; i < data.size(); i++) data[i] = outbuf[i];
+
+        // Set the I2C ACK bit low to tell the I2C secondary that we are done
+        // reading data, and then perform a single dummy read(...) so that
+        // this NACK is clocked out from I2C primary to I2C secondary.
+        m_mpsse->set_nack();
+        m_mpsse->read(1);
+    } else {
+        throw ComIOException("I2CFTDICom did not see an ACK.");
     }
-  else
-    throw ComIOException("I2CFTDICom did not see an ACK.");
 
-  // Establish the I2C STOP condition on the bus, ending the current I2C transaction.
-  if(!m_mpsse->stop())
-    throw ComIOException("I2CFTDICom cannot send STOP.");
+    // Establish the I2C STOP condition on the bus, ending the current I2C
+    // transaction.
+    if (!m_mpsse->stop()) throw ComIOException("I2CFTDICom cannot send STOP.");
 }
diff --git a/src/libDevCom/I2CFTDICom.h b/src/libDevCom/I2CFTDICom.h
index b6ccceb1..13fb1ba2 100644
--- a/src/libDevCom/I2CFTDICom.h
+++ b/src/libDevCom/I2CFTDICom.h
@@ -6,42 +6,42 @@ class MPSSEChip;
 
 #include <memory>
 
-class I2CFTDICom : public I2CCom 
-{
-public:
-  I2CFTDICom(std::shared_ptr<MPSSEChip> mpsse, uint8_t deviceAddr);
-  virtual ~I2CFTDICom();
-
-  //
-  // Write commands
-  virtual void write_reg32(uint32_t address, uint32_t data);
-  virtual void write_reg16(uint32_t address, uint16_t data);
-  virtual void write_reg8 (uint32_t address, uint8_t  data);
-
-  virtual void write_reg32(uint32_t data);
-  virtual void write_reg16(uint16_t data);
-  virtual void write_reg8 (uint8_t  data);
-
-  virtual void write_block(uint32_t address, const std::vector<uint8_t>& data);
-  virtual void write_block(const std::vector<uint8_t>& data);
-
-  //
-  // Read commands
-  virtual uint32_t read_reg32(uint32_t address);
-  virtual uint32_t read_reg24(uint32_t address);
-  virtual uint16_t read_reg16(uint32_t address);
-  virtual uint8_t  read_reg8 (uint32_t address);
-
-  virtual uint32_t read_reg32();
-  virtual uint32_t read_reg24();
-  virtual uint16_t read_reg16();
-  virtual uint8_t  read_reg8 ();
-
-  virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
-  virtual void read_block(std::vector<uint8_t>& data);
-
-private:
-  std::shared_ptr<MPSSEChip> m_mpsse;
+class I2CFTDICom : public I2CCom {
+ public:
+    I2CFTDICom(std::shared_ptr<MPSSEChip> mpsse, uint8_t deviceAddr);
+    virtual ~I2CFTDICom();
+
+    //
+    // Write commands
+    virtual void write_reg32(uint32_t address, uint32_t data);
+    virtual void write_reg16(uint32_t address, uint16_t data);
+    virtual void write_reg8(uint32_t address, uint8_t data);
+
+    virtual void write_reg32(uint32_t data);
+    virtual void write_reg16(uint16_t data);
+    virtual void write_reg8(uint8_t data);
+
+    virtual void write_block(uint32_t address,
+                             const std::vector<uint8_t>& data);
+    virtual void write_block(const std::vector<uint8_t>& data);
+
+    //
+    // Read commands
+    virtual uint32_t read_reg32(uint32_t address);
+    virtual uint32_t read_reg24(uint32_t address);
+    virtual uint16_t read_reg16(uint32_t address);
+    virtual uint8_t read_reg8(uint32_t address);
+
+    virtual uint32_t read_reg32();
+    virtual uint32_t read_reg24();
+    virtual uint16_t read_reg16();
+    virtual uint8_t read_reg8();
+
+    virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
+    virtual void read_block(std::vector<uint8_t>& data);
+
+ private:
+    std::shared_ptr<MPSSEChip> m_mpsse;
 };
 
 #endif
diff --git a/src/libDevCom/IOExpander.cpp b/src/libDevCom/IOExpander.cpp
index b3f14ba4..1454c994 100644
--- a/src/libDevCom/IOExpander.cpp
+++ b/src/libDevCom/IOExpander.cpp
@@ -1,28 +1,24 @@
 #include "IOExpander.h"
 
-void IOExpander::setIO(uint32_t bit, bool input)
-{
-  uint8_t value=getIO();
-  if(input)
-    value|= (1<<bit);
-  else
-    value&=~(1<<bit);
-  setIO(value);
+void IOExpander::setIO(uint32_t bit, bool input) {
+    uint8_t value = getIO();
+    if (input)
+        value |= (1 << bit);
+    else
+        value &= ~(1 << bit);
+    setIO(value);
 }
 
-void IOExpander::write(uint32_t bit, bool value)
-{
-  uint8_t oldvalue=read();
-  if(value)
-    oldvalue|= (1<<bit);
-  else
-    oldvalue&=~(1<<bit);
-  write(oldvalue);
+void IOExpander::write(uint32_t bit, bool value) {
+    uint8_t oldvalue = read();
+    if (value)
+        oldvalue |= (1 << bit);
+    else
+        oldvalue &= ~(1 << bit);
+    write(oldvalue);
 }
 
-bool IOExpander::read(uint32_t bit)
-{
-  uint8_t value=read();
-  return (value>>bit)&1;
+bool IOExpander::read(uint32_t bit) {
+    uint8_t value = read();
+    return (value >> bit) & 1;
 }
-  
diff --git a/src/libDevCom/IOExpander.h b/src/libDevCom/IOExpander.h
index d923e99a..b371073b 100644
--- a/src/libDevCom/IOExpander.h
+++ b/src/libDevCom/IOExpander.h
@@ -2,27 +2,25 @@
 #define IOEXPANDER_H
 
 #include <cstdint>
-#include <vector>
-#include <memory>
 #include <map>
+#include <memory>
+#include <vector>
 
-class IOExpander
-{
-public:
-  IOExpander() =default;
-  virtual ~IOExpander() =default;
+class IOExpander {
+ public:
+    IOExpander() = default;
+    virtual ~IOExpander() = default;
 
+    // bit operations
+    void setIO(uint32_t bit, bool output);
+    void write(uint32_t bit, bool value);
+    bool read(uint32_t bit);
 
-  // bit operations
-  void setIO(uint32_t bit, bool output);
-  void write(uint32_t bit, bool value);
-  bool read(uint32_t bit);
-  
-  // block operations
-  virtual uint32_t getIO() =0;
-  virtual void setIO(uint32_t output) =0;
-  virtual void write(uint32_t value) =0;
-  virtual uint32_t read() =0;
+    // block operations
+    virtual uint32_t getIO() = 0;
+    virtual void setIO(uint32_t output) = 0;
+    virtual void write(uint32_t value) = 0;
+    virtual uint32_t read() = 0;
 };
 
-#endif // IOEXPANDER_H
+#endif  // IOEXPANDER_H
diff --git a/src/libDevCom/LTC2451.cpp b/src/libDevCom/LTC2451.cpp
index 57ecdd31..7b92b140 100644
--- a/src/libDevCom/LTC2451.cpp
+++ b/src/libDevCom/LTC2451.cpp
@@ -1,64 +1,53 @@
 #include "LTC2451.h"
 
-#include "LinearCalibration.h"
+#include <chrono>
+#include <thread>
 
+#include "ComIOException.h"
+#include "LinearCalibration.h"
 #include "NotSupportedException.h"
 #include "OutOfRangeException.h"
-#include "ComIOException.h"
-
-#include <thread>
-#include <chrono>
 
 LTC2451::LTC2451(double reference, std::shared_ptr<I2CCom> com)
-  : ADCDevice(std::make_shared<LinearCalibration>(reference, 0xFFFF)),
-    m_com(com)
-{
-  setSpeed(Speed30Hz);
+    : ADCDevice(std::make_shared<LinearCalibration>(reference, 0xFFFF)),
+      m_com(com) {
+    setSpeed(Speed30Hz);
 }
 
-LTC2451::~LTC2451()
-{ }
+LTC2451::~LTC2451() {}
 
-int32_t LTC2451::readCount()
-{
-  try
-    { // dummy read to start conversion cycle
-      m_com->read_reg16();
+int32_t LTC2451::readCount() {
+    try {  // dummy read to start conversion cycle
+        m_com->read_reg16();
+    } catch (const ComIOException&
+                 e) { /* Read might fail if conversion already in progress */
     }
-  catch(const ComIOException& e)
-    { /* Read might fail if conversion already in progress */ }
-  wait_for_finish();
-  return m_com->read_reg16();
+    wait_for_finish();
+    return m_com->read_reg16();
 }
 
-int32_t LTC2451::readCount(uint8_t ch)
-{
-  if(ch!=0)
-    throw OutOfRangeException(ch,0,0);
-  return readCount();
+int32_t LTC2451::readCount(uint8_t ch) {
+    if (ch != 0) throw OutOfRangeException(ch, 0, 0);
+    return readCount();
 }
 
-void LTC2451::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& counts)
-{
-  counts.clear();
-  for(uint8_t ch : chs)
-    counts.push_back(readCount(ch));
+void LTC2451::readCount(const std::vector<uint8_t>& chs,
+                        std::vector<int32_t>& counts) {
+    counts.clear();
+    for (uint8_t ch : chs) counts.push_back(readCount(ch));
 }
 
-void LTC2451::setSpeed(Speed speed)
-{
-  try
-    {
-      m_com->write_reg8(speed);
+void LTC2451::setSpeed(Speed speed) {
+    try {
+        m_com->write_reg8(speed);
+    } catch (const ComIOException& e) {  // Allow write to fail once, in case
+                                         // conversion in progress
+        wait_for_finish();
+        m_com->write_reg8(speed);
     }
-  catch(const ComIOException& e)
-    { // Allow write to fail once, in case conversion in progress
-      wait_for_finish();
-      m_com->write_reg8(speed);
-    } 
 }
 
-void LTC2451::wait_for_finish()
-{
-  std::this_thread::sleep_for(std::chrono::milliseconds(1000/30+15)); // assume 30Hz rate
+void LTC2451::wait_for_finish() {
+    std::this_thread::sleep_for(
+        std::chrono::milliseconds(1000 / 30 + 15));  // assume 30Hz rate
 }
diff --git a/src/libDevCom/LTC2451.h b/src/libDevCom/LTC2451.h
index e6f59522..d70374e2 100644
--- a/src/libDevCom/LTC2451.h
+++ b/src/libDevCom/LTC2451.h
@@ -5,36 +5,37 @@
 
 #include <memory>
 
-#include "I2CCom.h"
 #include "ADCDevice.h"
+#include "I2CCom.h"
 
 /** \brief LTC2451: Ultra-Tiny, 16-Bit ΔΣ ADC with I2C Interface
  *
  * [Datasheet](https://www.analog.com/en/products/ltc2451.html)
  */
-class LTC2451 : public ADCDevice
-{
-public:
-  enum Speed {Speed60Hz=0, Speed30Hz=1};
-
-  LTC2451(double reference, std::shared_ptr<I2CCom> com);
-  virtual ~LTC2451();
-
-  virtual int32_t readCount();
-  virtual int32_t readCount(uint8_t ch);
-  virtual void    readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
-
-  // LTC2451 functionality
-  void setSpeed(Speed speed);
-private:
-  std::shared_ptr<I2CCom> m_com;
-
-  //! \brief wait until conversion finishes
-  /**
-   * Implemented as a 1/30Hz+15ms sleep to handle the
-   * longest period a conversion can take.
-   */
-  void wait_for_finish();
+class LTC2451 : public ADCDevice {
+ public:
+    enum Speed { Speed60Hz = 0, Speed30Hz = 1 };
+
+    LTC2451(double reference, std::shared_ptr<I2CCom> com);
+    virtual ~LTC2451();
+
+    virtual int32_t readCount();
+    virtual int32_t readCount(uint8_t ch);
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data);
+
+    // LTC2451 functionality
+    void setSpeed(Speed speed);
+
+ private:
+    std::shared_ptr<I2CCom> m_com;
+
+    //! \brief wait until conversion finishes
+    /**
+     * Implemented as a 1/30Hz+15ms sleep to handle the
+     * longest period a conversion can take.
+     */
+    void wait_for_finish();
 };
 
-#endif // LTC2451_H
+#endif  // LTC2451_H
diff --git a/src/libDevCom/LinearCalibration.cpp b/src/libDevCom/LinearCalibration.cpp
index 86a7e6e7..fe25d37a 100644
--- a/src/libDevCom/LinearCalibration.cpp
+++ b/src/libDevCom/LinearCalibration.cpp
@@ -3,14 +3,14 @@
 #include <cmath>
 
 LinearCalibration::LinearCalibration(double reference, uint32_t max)
-  : m_reference(reference), m_max(max)
-{ }
+    : m_reference(reference), m_max(max) {}
 
-LinearCalibration::~LinearCalibration()
-{ }
+LinearCalibration::~LinearCalibration() {}
 
-double LinearCalibration::calibrate(int32_t counts)
-{ return (double)counts/m_max*m_reference; }
+double LinearCalibration::calibrate(int32_t counts) {
+    return static_cast<double>(counts) / m_max * m_reference;
+}
 
-int32_t LinearCalibration::uncalibrate(double value)
-{ return round(value*m_max/m_reference); }
+int32_t LinearCalibration::uncalibrate(double value) {
+    return round(value * m_max / m_reference);
+}
diff --git a/src/libDevCom/LinearCalibration.h b/src/libDevCom/LinearCalibration.h
index 58fc41b5..61fe01ca 100644
--- a/src/libDevCom/LinearCalibration.h
+++ b/src/libDevCom/LinearCalibration.h
@@ -3,9 +3,11 @@
 
 #include "DeviceCalibration.h"
 
-//! \brief Calibration that assumes a linear relationship between counts and the output value
+//! \brief Calibration that assumes a linear relationship between counts and the
+//! output value
 /**
- * The conversion uses the following formula to convert counts (signed integer) to a value:
+ * The conversion uses the following formula to convert counts (signed integer)
+ * to a value:
  * ```
  *  value = reference * counts / max
  * ```
@@ -15,25 +17,24 @@
  * - `reference = 3.3`
  * - `counts = 0xFF`
  *
- * The counts are assumed to represented by a signed integer. This allows support
- * for differential devices with negative values represented as such.
+ * The counts are assumed to represented by a signed integer. This allows
+ * support for differential devices with negative values represented as such.
  */
-class LinearCalibration : public DeviceCalibration
-{
-public:
-  /**
-   * \param reference Voltage at `max` counts
-   * \param max Counts at `reference` value
-   */
-  LinearCalibration(double reference, uint32_t max);
-  virtual ~LinearCalibration();
+class LinearCalibration : public DeviceCalibration {
+ public:
+    /**
+     * \param reference Voltage at `max` counts
+     * \param max Counts at `reference` value
+     */
+    LinearCalibration(double reference, uint32_t max);
+    virtual ~LinearCalibration();
 
-  virtual double calibrate(int32_t counts);
-  virtual int32_t uncalibrate(double value);
+    virtual double calibrate(int32_t counts);
+    virtual int32_t uncalibrate(double value);
 
-private:
-  double m_reference;
-  uint32_t m_max;
+ private:
+    double m_reference;
+    uint32_t m_max;
 };
 
-#endif // LINEARCALIBRATION_H
+#endif  // LINEARCALIBRATION_H
diff --git a/src/libDevCom/MAX11619.cpp b/src/libDevCom/MAX11619.cpp
index e8012653..6bad6009 100644
--- a/src/libDevCom/MAX11619.cpp
+++ b/src/libDevCom/MAX11619.cpp
@@ -1,46 +1,40 @@
 #include "MAX11619.h"
 
 #include "LinearCalibration.h"
-
 #include "NotSupportedException.h"
 
 MAX11619::MAX11619(double reference, std::shared_ptr<SPICom> com)
-  : ADCDevice(std::make_shared<LinearCalibration>(reference, 0x3FF)),
-    m_com(com)
-{ }
+    : ADCDevice(std::make_shared<LinearCalibration>(reference, 0x3FF)),
+      m_com(com) {}
 
-MAX11619::~MAX11619()
-{ }
+MAX11619::~MAX11619() {}
 
-int32_t MAX11619::readCount()
-{
-  m_com->write_block({0x18,0xF9});
+int32_t MAX11619::readCount() {
+    m_com->write_block({0x18, 0xF9});
 
-  return (m_com->read_reg16(16)>>2)&0x3FF;
+    return (m_com->read_reg16(16) >> 2) & 0x3FF;
 }
 
-int32_t MAX11619::readCount(uint8_t ch)
-{
-  m_com->write_block({0x18,0xF9});
+int32_t MAX11619::readCount(uint8_t ch) {
+    m_com->write_block({0x18, 0xF9});
 
-  std::vector<uint8_t> data(2*4);
-  m_com->read_block(data);
-  uint16_t chvalue=(data[2*ch+0]<<8)|(data[2*ch+1]<<0);
+    std::vector<uint8_t> data(2 * 4);
+    m_com->read_block(data);
+    uint16_t chvalue = (data[2 * ch + 0] << 8) | (data[2 * ch + 1] << 0);
 
-  return (chvalue>>2)&0x3FF;
+    return (chvalue >> 2) & 0x3FF;
 }
 
-void MAX11619::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& counts)
-{
-  m_com->write_block({0x18,0xF9});
+void MAX11619::readCount(const std::vector<uint8_t>& chs,
+                         std::vector<int32_t>& counts) {
+    m_com->write_block({0x18, 0xF9});
 
-  std::vector<uint8_t> data(2*4);
-  m_com->read_block(data);
+    std::vector<uint8_t> data(2 * 4);
+    m_com->read_block(data);
 
-  counts.clear();
-  for(uint8_t chi=0;chi<chs.size();chi++)
-    {
-      uint16_t chresult=(data[2*chi+0]<<8)|(data[2*chi+1]<<0);
-      counts.push_back((chresult>>2)&0x3FF);
+    counts.clear();
+    for (uint8_t chi = 0; chi < chs.size(); chi++) {
+        uint16_t chresult = (data[2 * chi + 0] << 8) | (data[2 * chi + 1] << 0);
+        counts.push_back((chresult >> 2) & 0x3FF);
     }
 }
diff --git a/src/libDevCom/MAX11619.h b/src/libDevCom/MAX11619.h
index b361af9c..2ff78edb 100644
--- a/src/libDevCom/MAX11619.h
+++ b/src/libDevCom/MAX11619.h
@@ -3,24 +3,24 @@
 
 #include <stdint.h>
 
-#include <memory>
 #include <map>
+#include <memory>
 
-#include "SPICom.h"
 #include "ADCDevice.h"
+#include "SPICom.h"
 
-class MAX11619 : public ADCDevice
-{
-public:
-  MAX11619(double reference, std::shared_ptr<SPICom> com);
-  virtual ~MAX11619();
+class MAX11619 : public ADCDevice {
+ public:
+    MAX11619(double reference, std::shared_ptr<SPICom> com);
+    virtual ~MAX11619();
 
-  virtual int32_t readCount();
-  virtual int32_t readCount(uint8_t ch);
-  virtual void     readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
+    virtual int32_t readCount();
+    virtual int32_t readCount(uint8_t ch);
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data);
 
-private:
-  std::shared_ptr<SPICom> m_com;
+ private:
+    std::shared_ptr<SPICom> m_com;
 };
 
-#endif // MAX11619_H
+#endif  // MAX11619_H
diff --git a/src/libDevCom/MCP23008.cpp b/src/libDevCom/MCP23008.cpp
index a4817b69..e2c57434 100644
--- a/src/libDevCom/MCP23008.cpp
+++ b/src/libDevCom/MCP23008.cpp
@@ -1,29 +1,20 @@
 #include "MCP23008.h"
 
-MCP23008::MCP23008(std::shared_ptr<I2CCom> com)
-  : IOExpander(), m_com(com)
-{
-  m_com->write_reg8(MCP23008_IPOL, 0x0); // Do not support inversion
+MCP23008::MCP23008(std::shared_ptr<I2CCom> com) : IOExpander(), m_com(com) {
+    m_com->write_reg8(MCP23008_IPOL, 0x0);  // Do not support inversion
 }
 
-uint32_t MCP23008::getIO()
-{
-  return m_com->read_reg8(MCP23008_IODIR);
-}
+uint32_t MCP23008::getIO() { return m_com->read_reg8(MCP23008_IODIR); }
 
-void MCP23008::setIO(uint32_t input)
-{
-  m_com->write_reg8(MCP23008_IODIR, input);
+void MCP23008::setIO(uint32_t input) {
+    m_com->write_reg8(MCP23008_IODIR, input);
 }
 
-void MCP23008::write(uint32_t value)
-{
-  m_com->write_reg8(MCP23008_GPIO, value);
+void MCP23008::write(uint32_t value) {
+    m_com->write_reg8(MCP23008_GPIO, value);
 }
 
-uint32_t MCP23008::read()
-{ 
-  m_com->write_reg8(MCP23008_OLAT);
-  return m_com->read_reg8()&0xFF;
+uint32_t MCP23008::read() {
+    m_com->write_reg8(MCP23008_OLAT);
+    return m_com->read_reg8() & 0xFF;
 }
-
diff --git a/src/libDevCom/MCP23008.h b/src/libDevCom/MCP23008.h
index ed802096..5689a899 100644
--- a/src/libDevCom/MCP23008.h
+++ b/src/libDevCom/MCP23008.h
@@ -1,35 +1,34 @@
 #ifndef MCP23008_H
 #define MCP23008_H
 
-#include "IOExpander.h"
 #include "I2CCom.h"
+#include "IOExpander.h"
 
 // Register map
-#define MCP23008_IODIR   0x00
-#define MCP23008_IPOL    0x01
+#define MCP23008_IODIR 0x00
+#define MCP23008_IPOL 0x01
 #define MCP23008_GPINTEN 0x02
-#define MCP23008_DEFVAL  0x03
-#define MCP23008_INTCON  0x04
-#define MCP23008_IOCON   0x05
-#define MCP23008_GPPU    0x06
-#define MCP23008_INTF    0x07
-#define MCP23008_INTCAP  0x08
-#define MCP23008_GPIO    0x09
-#define MCP23008_OLAT    0x0A
+#define MCP23008_DEFVAL 0x03
+#define MCP23008_INTCON 0x04
+#define MCP23008_IOCON 0x05
+#define MCP23008_GPPU 0x06
+#define MCP23008_INTF 0x07
+#define MCP23008_INTCAP 0x08
+#define MCP23008_GPIO 0x09
+#define MCP23008_OLAT 0x0A
 
-class MCP23008 : public IOExpander
-{
-public:
-  MCP23008(std::shared_ptr<I2CCom> com);
-  virtual ~MCP23008() =default;
+class MCP23008 : public IOExpander {
+ public:
+    MCP23008(std::shared_ptr<I2CCom> com);
+    virtual ~MCP23008() = default;
 
-  virtual uint32_t getIO();
-  virtual void setIO(uint32_t input);
-  virtual void write(uint32_t value);
-  virtual uint32_t read();
+    virtual uint32_t getIO();
+    virtual void setIO(uint32_t input);
+    virtual void write(uint32_t value);
+    virtual uint32_t read();
 
-private:
-  std::shared_ptr<I2CCom> m_com;
+ private:
+    std::shared_ptr<I2CCom> m_com;
 };
 
-#endif // MCP23008_H
+#endif  // MCP23008_H
diff --git a/src/libDevCom/MCP23017.cpp b/src/libDevCom/MCP23017.cpp
index 06319968..a8fb3a88 100644
--- a/src/libDevCom/MCP23017.cpp
+++ b/src/libDevCom/MCP23017.cpp
@@ -1,38 +1,31 @@
 #include "MCP23017.h"
 
-#include <iostream>
 #include <iomanip>
+#include <iostream>
 
-MCP23017::MCP23017(std::shared_ptr<I2CCom> com)
-  : IOExpander(), m_com(com)
-{
-  m_com->write_reg8(MCP23017_IPOLA, 0x0); // Do not support inversion
-  m_com->write_reg8(MCP23017_IPOLB, 0x0); // Do not support inversion
+MCP23017::MCP23017(std::shared_ptr<I2CCom> com) : IOExpander(), m_com(com) {
+    m_com->write_reg8(MCP23017_IPOLA, 0x0);  // Do not support inversion
+    m_com->write_reg8(MCP23017_IPOLB, 0x0);  // Do not support inversion
 }
 
-uint32_t MCP23017::getIO()
-{ 
-  uint16_t ioa=m_com->read_reg8(MCP23017_IODIRA);
-  uint16_t iob=m_com->read_reg8(MCP23017_IODIRB);
-  return (iob<<8)|(ioa<<0);
+uint32_t MCP23017::getIO() {
+    uint16_t ioa = m_com->read_reg8(MCP23017_IODIRA);
+    uint16_t iob = m_com->read_reg8(MCP23017_IODIRB);
+    return (iob << 8) | (ioa << 0);
 }
 
-void MCP23017::setIO(uint32_t output)
-{
-  m_com->write_reg8(MCP23017_IODIRA, (output>>0)&0xFF);
-  m_com->write_reg8(MCP23017_IODIRB, (output>>8)&0xFF);
+void MCP23017::setIO(uint32_t output) {
+    m_com->write_reg8(MCP23017_IODIRA, (output >> 0) & 0xFF);
+    m_com->write_reg8(MCP23017_IODIRB, (output >> 8) & 0xFF);
 }
 
-void MCP23017::write(uint32_t value)
-{
-  m_com->write_reg8(MCP23017_GPIOA, (value>>0)&0xFF);
-  m_com->write_reg8(MCP23017_GPIOB, (value>>8)&0xFF);
+void MCP23017::write(uint32_t value) {
+    m_com->write_reg8(MCP23017_GPIOA, (value >> 0) & 0xFF);
+    m_com->write_reg8(MCP23017_GPIOB, (value >> 8) & 0xFF);
 }
 
-uint32_t MCP23017::read()
-{ 
-  uint16_t reada=m_com->read_reg8(MCP23017_OLATA);
-  uint16_t readb=m_com->read_reg8(MCP23017_OLATB);
-  return (readb<<8)|(reada<<0);
+uint32_t MCP23017::read() {
+    uint16_t reada = m_com->read_reg8(MCP23017_OLATA);
+    uint16_t readb = m_com->read_reg8(MCP23017_OLATB);
+    return (readb << 8) | (reada << 0);
 }
-
diff --git a/src/libDevCom/MCP23017.h b/src/libDevCom/MCP23017.h
index a5d6ec4d..0435a0cc 100644
--- a/src/libDevCom/MCP23017.h
+++ b/src/libDevCom/MCP23017.h
@@ -1,46 +1,45 @@
 #ifndef MCP23017_H
 #define MCP23017_H
 
-#include "IOExpander.h"
 #include "I2CCom.h"
+#include "IOExpander.h"
 
 // Register map
-#define MCP23017_IODIRA   0x00
-#define MCP23017_IODIRB   0x01
-#define MCP23017_IPOLA    0x02
-#define MCP23017_IPOLB    0x03
+#define MCP23017_IODIRA 0x00
+#define MCP23017_IODIRB 0x01
+#define MCP23017_IPOLA 0x02
+#define MCP23017_IPOLB 0x03
 #define MCP23017_GPINTENA 0x04
 #define MCP23017_GPINTENB 0x05
-#define MCP23017_DEFVALA  0x06
-#define MCP23017_DEFVALB  0x07
-#define MCP23017_INTCONA  0x08
-#define MCP23017_INTCONB  0x09
-#define MCP23017_IOCONA   0x0A
-#define MCP23017_IOCONB   0x0B
-#define MCP23017_GPPUA    0x0C
-#define MCP23017_GPPUB    0x0D
-#define MCP23017_INTFA    0x0E
-#define MCP23017_INTFB    0x0F
-#define MCP23017_INTCAPA  0x10
-#define MCP23017_INTCAPB  0x11
-#define MCP23017_GPIOA    0x12
-#define MCP23017_GPIOB    0x13
-#define MCP23017_OLATA    0x14
-#define MCP23017_OLATB    0x15
+#define MCP23017_DEFVALA 0x06
+#define MCP23017_DEFVALB 0x07
+#define MCP23017_INTCONA 0x08
+#define MCP23017_INTCONB 0x09
+#define MCP23017_IOCONA 0x0A
+#define MCP23017_IOCONB 0x0B
+#define MCP23017_GPPUA 0x0C
+#define MCP23017_GPPUB 0x0D
+#define MCP23017_INTFA 0x0E
+#define MCP23017_INTFB 0x0F
+#define MCP23017_INTCAPA 0x10
+#define MCP23017_INTCAPB 0x11
+#define MCP23017_GPIOA 0x12
+#define MCP23017_GPIOB 0x13
+#define MCP23017_OLATA 0x14
+#define MCP23017_OLATB 0x15
 
-class MCP23017 : public IOExpander
-{
-public:
-  MCP23017(std::shared_ptr<I2CCom> com);
-  virtual ~MCP23017() =default;
+class MCP23017 : public IOExpander {
+ public:
+    MCP23017(std::shared_ptr<I2CCom> com);
+    virtual ~MCP23017() = default;
 
-  virtual uint32_t getIO();
-  virtual void setIO(uint32_t input);
-  virtual void write(uint32_t value);
-  virtual uint32_t read();
+    virtual uint32_t getIO();
+    virtual void setIO(uint32_t input);
+    virtual void write(uint32_t value);
+    virtual uint32_t read();
 
-private:
-  std::shared_ptr<I2CCom> m_com;
+ private:
+    std::shared_ptr<I2CCom> m_com;
 };
 
-#endif // MCP23017_H
+#endif  // MCP23017_H
diff --git a/src/libDevCom/MCP3425.cpp b/src/libDevCom/MCP3425.cpp
index ac276cfb..c1ace678 100644
--- a/src/libDevCom/MCP3425.cpp
+++ b/src/libDevCom/MCP3425.cpp
@@ -1,134 +1,127 @@
 #include "MCP3425.h"
 
+#include <cmath>
+
 #include "LinearCalibration.h"
 #include "OutOfRangeException.h"
 
-#include <cmath>
-
-MCP3425::MCP3425(Resolution bit_res, ConversionMode conv_mode, Gain gain, std::shared_ptr<I2CCom> com)
-  : ADCDevice(std::make_shared<LinearCalibration>(2.048/pow(2,gain),
-						  (uint16_t)pow(2,bit_res - 1))),
-    m_resolution(bit_res), m_conv_mode(conv_mode), m_gain(gain), m_com(com)
-{ }
+MCP3425::MCP3425(Resolution bit_res, ConversionMode conv_mode, Gain gain,
+                 std::shared_ptr<I2CCom> com)
+    : ADCDevice(std::make_shared<LinearCalibration>(
+          2.048 / pow(2, gain), (uint16_t)pow(2, bit_res - 1))),
+      m_resolution(bit_res),
+      m_conv_mode(conv_mode),
+      m_gain(gain),
+      m_com(com) {}
 
 MCP3425::MCP3425(std::shared_ptr<I2CCom> com)
-  : ADCDevice(std::make_shared<LinearCalibration>(2.048/pow(2,Gain::x1),
-						    (uint16_t)pow(2,Resolution::bit16 - 1))),
-    m_resolution(Resolution::bit16), m_conv_mode(ConversionMode::Shot), m_gain(Gain::x1), m_com(com)
-{ }
-
-MCP3425::~MCP3425()
-{ }
-
-//Default read on device on ch0
-int32_t  MCP3425::readCount()
-{
-  //Resolution bit
-  uint8_t bit;
-  switch(m_resolution)
-    {
-    case bit12:
-      bit = 0;
-      break;
-    case bit14:
-      bit = 1;
-      break;
-    case bit16:
-      bit = 2;
-      break;
-    default:
-      bit = 0;
-      break;
+    : ADCDevice(std::make_shared<LinearCalibration>(
+          2.048 / pow(2, Gain::x1), (uint16_t)pow(2, Resolution::bit16 - 1))),
+      m_resolution(Resolution::bit16),
+      m_conv_mode(ConversionMode::Shot),
+      m_gain(Gain::x1),
+      m_com(com) {}
+
+MCP3425::~MCP3425() {}
+
+// Default read on device on ch0
+int32_t MCP3425::readCount() {
+    // Resolution bit
+    uint8_t bit;
+    switch (m_resolution) {
+        case bit12:
+            bit = 0;
+            break;
+        case bit14:
+            bit = 1;
+            break;
+        case bit16:
+            bit = 2;
+            break;
+        default:
+            bit = 0;
+            break;
     }
 
-  //Configuration register
-  uint8_t vConfig = 0x80|(m_conv_mode << 4)|(bit << 2)|m_gain;
+    // Configuration register
+    uint8_t vConfig = 0x80 | (m_conv_mode << 4) | (bit << 2) | m_gain;
 
-  //Write on configuration register
-  m_com->write_reg8(vConfig);
+    // Write on configuration register
+    m_com->write_reg8(vConfig);
 
-  //Read the regsiter
-  std::vector<uint8_t>data(3);
+    // Read the regsiter
+    std::vector<uint8_t> data(3);
 
-  //Wait until the read value is not ready
-  bool ready = false;
-  while(!ready)
-    {
-      m_com->read_block(0x7F&vConfig,data);
+    // Wait until the read value is not ready
+    bool ready = false;
+    while (!ready) {
+        m_com->read_block(0x7F & vConfig, data);
 
-      //Test if the conversion result is ready
-      if ((data[2]&0x80) == 0x00)
-	ready = true;
+        // Test if the conversion result is ready
+        if ((data[2] & 0x80) == 0x00) ready = true;
     }
 
-  int16_t chcount = (data[0]<<8)|(data[1]<<0);
-  return chcount;
+    int16_t chcount = (data[0] << 8) | (data[1] << 0);
+    return chcount;
 }
 
-int32_t MCP3425::readCount(uint8_t ch)
-{ 
-  //Check if Channel exist
-  if (ch != 0)
-    throw OutOfRangeException(ch,0,0);
-
-  //Resolution bit
-  uint8_t bit;
-  switch(m_resolution)
-    {
-    case bit12:
-      bit = 0;
-      break;
-    case bit14:
-      bit = 1;
-      break;
-    case bit16:
-      bit = 2;
-      break;
-    default:
-      bit = 0;
-      break;
+int32_t MCP3425::readCount(uint8_t ch) {
+    // Check if Channel exist
+    if (ch != 0) throw OutOfRangeException(ch, 0, 0);
+
+    // Resolution bit
+    uint8_t bit;
+    switch (m_resolution) {
+        case bit12:
+            bit = 0;
+            break;
+        case bit14:
+            bit = 1;
+            break;
+        case bit16:
+            bit = 2;
+            break;
+        default:
+            bit = 0;
+            break;
     }
 
-  //Configuration register
-  uint8_t vConfig = 0;
-  vConfig = 0x80|(ch<<5)|(m_conv_mode << 4)|(bit << 2)|m_gain;
-
-  //Write on configuration register
-  m_com->write_reg8(vConfig);
-      
-  //Read the regsiter
-  std::vector<uint8_t>data(3);
-
-  //Wait until the read value is not ready
-  bool ready = false;
-  while(!ready)
-    {
-      m_com->read_block(0x7F&vConfig,data);
-
-      //Test if the conversion result is ready
-      if ((data[2]&0x80) == 0x00)
-	ready = true;
+    // Configuration register
+    uint8_t vConfig = 0;
+    vConfig = 0x80 | (ch << 5) | (m_conv_mode << 4) | (bit << 2) | m_gain;
+
+    // Write on configuration register
+    m_com->write_reg8(vConfig);
+
+    // Read the regsiter
+    std::vector<uint8_t> data(3);
+
+    // Wait until the read value is not ready
+    bool ready = false;
+    while (!ready) {
+        m_com->read_block(0x7F & vConfig, data);
+
+        // Test if the conversion result is ready
+        if ((data[2] & 0x80) == 0x00) ready = true;
     }
-    
-  int16_t chcount = (data[0]<<8)|(data[1]<<0);
-  return chcount;
+
+    int16_t chcount = (data[0] << 8) | (data[1] << 0);
+    return chcount;
 }
 
-void MCP3425::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& counts)
-{
-  //Clear counts table
-  counts.clear();
+void MCP3425::readCount(const std::vector<uint8_t>& chs,
+                        std::vector<int32_t>& counts) {
+    // Clear counts table
+    counts.clear();
 
-  //Data table
-  std::vector<uint8_t>data(2);
+    // Data table
+    std::vector<uint8_t> data(2);
 
-  //Do the Voltage measurement sequence
-  for(uint8_t i=0; i<chs.size(); i++)
-    {
-      //Check if Channel exist
-      if (chs[i] != 0)
-	throw OutOfRangeException(chs[i],0,0);
+    // Do the Voltage measurement sequence
+    for (uint8_t i = 0; i < chs.size(); i++) {
+        // Check if Channel exist
+        if (chs[i] != 0) throw OutOfRangeException(chs[i], 0, 0);
 
-      counts[i]=readCount(chs[i]);
-    }   
+        counts[i] = readCount(chs[i]);
+    }
 }
diff --git a/src/libDevCom/MCP3425.h b/src/libDevCom/MCP3425.h
index c4ed0a69..68012da4 100644
--- a/src/libDevCom/MCP3425.h
+++ b/src/libDevCom/MCP3425.h
@@ -5,41 +5,40 @@
 
 #include <memory>
 
-#include "I2CCom.h"
 #include "ADCDevice.h"
+#include "I2CCom.h"
 
-class MCP3425 : public ADCDevice
-{
-public:
-
-  //Bit resolution
-  enum Resolution {bit12 = 12, bit14 = 14, bit16 = 16};
-
-  //Conversion mode
-  enum ConversionMode {Shot = 0, Cont = 1};
-
-  //Gain
-  enum Gain {x1 = 0, x2 = 1, x4 = 2, x8 = 3};
-
-  //Initialisation of ADC
-  MCP3425(Resolution bit_res, ConversionMode conv_mode, Gain gain, std::shared_ptr<I2CCom> com);
-  MCP3425(std::shared_ptr<I2CCom> com);
-  virtual ~MCP3425();
-
-  //Read value from ADC
-  virtual int32_t readCount();
-  virtual int32_t readCount(uint8_t ch);
-  virtual void    readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
-
-private:
-
-  //Properties of device
-  Resolution m_resolution;
-  ConversionMode  m_conv_mode;
-  Gain m_gain;
-
-  //Pointer for I2C communication
-  std::shared_ptr<I2CCom> m_com;
+class MCP3425 : public ADCDevice {
+ public:
+    // Bit resolution
+    enum Resolution { bit12 = 12, bit14 = 14, bit16 = 16 };
+
+    // Conversion mode
+    enum ConversionMode { Shot = 0, Cont = 1 };
+
+    // Gain
+    enum Gain { x1 = 0, x2 = 1, x4 = 2, x8 = 3 };
+
+    // Initialisation of ADC
+    MCP3425(Resolution bit_res, ConversionMode conv_mode, Gain gain,
+            std::shared_ptr<I2CCom> com);
+    MCP3425(std::shared_ptr<I2CCom> com);
+    virtual ~MCP3425();
+
+    // Read value from ADC
+    virtual int32_t readCount();
+    virtual int32_t readCount(uint8_t ch);
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data);
+
+ private:
+    // Properties of device
+    Resolution m_resolution;
+    ConversionMode m_conv_mode;
+    Gain m_gain;
+
+    // Pointer for I2C communication
+    std::shared_ptr<I2CCom> m_com;
 };
 
-#endif // MCP3425_H
+#endif  // MCP3425_H
diff --git a/src/libDevCom/MCP3428.cpp b/src/libDevCom/MCP3428.cpp
index e8fddaf5..086c9237 100644
--- a/src/libDevCom/MCP3428.cpp
+++ b/src/libDevCom/MCP3428.cpp
@@ -1,137 +1,131 @@
 #include "MCP3428.h"
 
+#include <cmath>
+
 #include "LinearCalibration.h"
 #include "OutOfRangeException.h"
 
-#include <cmath>
-
-MCP3428::MCP3428(Resolution bit_res, ConversionMode conv_mode, Gain gain, std::shared_ptr<I2CCom> com)
-  : ADCDevice(std::make_shared<LinearCalibration>(2.048/pow(2,gain),
-						  (uint16_t)pow(2,bit_res - 1))),
-    m_resolution(bit_res), m_conv_mode(conv_mode), m_gain(gain), m_com(com)
-{ }
+MCP3428::MCP3428(Resolution bit_res, ConversionMode conv_mode, Gain gain,
+                 std::shared_ptr<I2CCom> com)
+    : ADCDevice(std::make_shared<LinearCalibration>(
+          2.048 / pow(2, gain), (uint16_t)pow(2, bit_res - 1))),
+      m_resolution(bit_res),
+      m_conv_mode(conv_mode),
+      m_gain(gain),
+      m_com(com) {}
 
 MCP3428::MCP3428(std::shared_ptr<I2CCom> com)
-  : ADCDevice(std::make_shared<LinearCalibration>(2.048/pow(2,Gain::x1),
-						  (uint16_t)pow(2,Resolution::bit16 - 1))),
-    m_resolution(Resolution::bit16), m_conv_mode(ConversionMode::Shot), m_gain(Gain::x1), m_com(com)
-{ }
-
-MCP3428::~MCP3428()
-{ }
-
-void MCP3428::setGain(Gain gain)
-{ m_gain=gain; }
-
-//Default read on device on ch0
-int32_t  MCP3428::readCount()
-{
-  //Resolution bit
-  uint8_t bit;
-  switch(m_resolution)
-    {
-    case bit12:
-      bit = 0;
-      break;
-    case bit14:
-      bit = 1;
-      break;
-    case bit16:
-      bit = 2;
-      break;
-    default:
-      bit = 0;
-      break;
+    : ADCDevice(std::make_shared<LinearCalibration>(
+          2.048 / pow(2, Gain::x1), (uint16_t)pow(2, Resolution::bit16 - 1))),
+      m_resolution(Resolution::bit16),
+      m_conv_mode(ConversionMode::Shot),
+      m_gain(Gain::x1),
+      m_com(com) {}
+
+MCP3428::~MCP3428() {}
+
+void MCP3428::setGain(Gain gain) { m_gain = gain; }
+
+// Default read on device on ch0
+int32_t MCP3428::readCount() {
+    // Resolution bit
+    uint8_t bit;
+    switch (m_resolution) {
+        case bit12:
+            bit = 0;
+            break;
+        case bit14:
+            bit = 1;
+            break;
+        case bit16:
+            bit = 2;
+            break;
+        default:
+            bit = 0;
+            break;
     }
 
-  //Configuration register
-  uint8_t vConfig = 0x80|(m_conv_mode << 4)|(bit << 2)|m_gain;
+    // Configuration register
+    uint8_t vConfig = 0x80 | (m_conv_mode << 4) | (bit << 2) | m_gain;
 
-  //Write on configuration register
-  m_com->write_reg8(vConfig);
+    // Write on configuration register
+    m_com->write_reg8(vConfig);
 
-  //Read the regsiter
-  std::vector<uint8_t>data(3);
+    // Read the regsiter
+    std::vector<uint8_t> data(3);
 
-  //Wait until the read value is not ready
-  bool ready = false;
-  while(!ready)
-    {
-      m_com->read_block(0x7F&vConfig,data);
+    // Wait until the read value is not ready
+    bool ready = false;
+    while (!ready) {
+        m_com->read_block(0x7F & vConfig, data);
 
-      //Test if the conversion result is ready
-      if ((data[2]&0x80) == 0x00)
-	ready = true;
+        // Test if the conversion result is ready
+        if ((data[2] & 0x80) == 0x00) ready = true;
     }
 
-  int16_t chcount = (data[0]<<8)|(data[1]<<0);
-  return chcount;
+    int16_t chcount = (data[0] << 8) | (data[1] << 0);
+    return chcount;
 }
 
-int32_t MCP3428::readCount(uint8_t ch)
-{ 
-  //Check if Channel exist
-  if (ch >= m_numChannels)
-    throw OutOfRangeException(ch,0,m_numChannels-1);
-
-  //Resolution bit
-  uint8_t bit;
-  switch(m_resolution)
-    {
-    case bit12:
-      bit = 0;
-      break;
-    case bit14:
-      bit = 1;
-      break;
-    case bit16:
-      bit = 2;
-      break;
-    default:
-      bit = 0;
-      break;
+int32_t MCP3428::readCount(uint8_t ch) {
+    // Check if Channel exist
+    if (ch >= m_numChannels)
+        throw OutOfRangeException(ch, 0, m_numChannels - 1);
+
+    // Resolution bit
+    uint8_t bit;
+    switch (m_resolution) {
+        case bit12:
+            bit = 0;
+            break;
+        case bit14:
+            bit = 1;
+            break;
+        case bit16:
+            bit = 2;
+            break;
+        default:
+            bit = 0;
+            break;
     }
 
-  //Configuration register
-  uint8_t vConfig = 0;
-  vConfig = 0x80|(ch<<5)|(m_conv_mode << 4)|(bit << 2)|m_gain;
-
-  //Write on configuration register
-  m_com->write_reg8(vConfig);
-      
-  //Read the regsiter
-  std::vector<uint8_t>data(3);
-
-  //Wait until the read value is not ready
-  bool ready = false;
-  while(!ready)
-    {
-      m_com->read_block(0x7F&vConfig,data);
-
-      //Test if the conversion result is ready
-      if ((data[2]&0x80) == 0x00)
-	ready = true;
+    // Configuration register
+    uint8_t vConfig = 0;
+    vConfig = 0x80 | (ch << 5) | (m_conv_mode << 4) | (bit << 2) | m_gain;
+
+    // Write on configuration register
+    m_com->write_reg8(vConfig);
+
+    // Read the regsiter
+    std::vector<uint8_t> data(3);
+
+    // Wait until the read value is not ready
+    bool ready = false;
+    while (!ready) {
+        m_com->read_block(0x7F & vConfig, data);
+
+        // Test if the conversion result is ready
+        if ((data[2] & 0x80) == 0x00) ready = true;
     }
-    
-  int16_t chcount = (data[0]<<8)|(data[1]<<0);
-  return chcount;
+
+    int16_t chcount = (data[0] << 8) | (data[1] << 0);
+    return chcount;
 }
 
-void MCP3428::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& counts)
-{
-  //Clear counts table
-  counts.clear();
+void MCP3428::readCount(const std::vector<uint8_t>& chs,
+                        std::vector<int32_t>& counts) {
+    // Clear counts table
+    counts.clear();
 
-  //Data table
-  std::vector<uint8_t>data(2);
+    // Data table
+    std::vector<uint8_t> data(2);
 
-  //Do the Voltage measurement sequence
-  for(uint8_t i=0; i<chs.size(); i++)
-    {
-      //Check if Channel exist
-      if (chs[i] >= m_numChannels)
-	throw OutOfRangeException(chs[i],0,m_numChannels-1);
+    // Do the Voltage measurement sequence
+    for (uint8_t i = 0; i < chs.size(); i++) {
+        // Check if Channel exist
+        if (chs[i] >= m_numChannels)
+            throw OutOfRangeException(chs[i], 0, m_numChannels - 1);
 
-      counts[i]=readCount(chs[i]);
-    }   
+        counts[i] = readCount(chs[i]);
+    }
 }
diff --git a/src/libDevCom/MCP3428.h b/src/libDevCom/MCP3428.h
index d7245ca9..0e7e16ad 100644
--- a/src/libDevCom/MCP3428.h
+++ b/src/libDevCom/MCP3428.h
@@ -5,49 +5,48 @@
 
 #include <memory>
 
-#include "I2CCom.h"
 #include "ADCDevice.h"
+#include "I2CCom.h"
 
-class MCP3428 : public ADCDevice
-{
-public:
-
-  //Bit resolution
-  enum Resolution {bit12 = 12, bit14 = 14, bit16 = 16};
-
-  //Conversion mode
-  enum ConversionMode {Shot = 0, Cont = 1};
-
-  //Gain
-  enum Gain {x1 = 0, x2 = 1, x4 = 2, x8 = 3};
-
-  //Initialisation of ADC
-  MCP3428(Resolution bit_res, ConversionMode conv_mode, Gain gain, std::shared_ptr<I2CCom> com);
-  MCP3428(std::shared_ptr<I2CCom> com);
-  virtual ~MCP3428();
-
-  /**
-   * Set the gain of the ADC for all future measurements.
-   *
-   * \param gain The new gain
-   */
-  void setGain(Gain gain);
-
-  //Read value from ADC
-  virtual int32_t readCount();
-  virtual int32_t readCount(uint8_t ch);
-  virtual void    readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
-
-private:
-
-  //Properties of device
-  const  uint8_t m_numChannels = 4;
-  Resolution m_resolution;
-  ConversionMode  m_conv_mode;
-  Gain m_gain;
-
-  //Pointer for I2C communication
-  std::shared_ptr<I2CCom> m_com;
+class MCP3428 : public ADCDevice {
+ public:
+    // Bit resolution
+    enum Resolution { bit12 = 12, bit14 = 14, bit16 = 16 };
+
+    // Conversion mode
+    enum ConversionMode { Shot = 0, Cont = 1 };
+
+    // Gain
+    enum Gain { x1 = 0, x2 = 1, x4 = 2, x8 = 3 };
+
+    // Initialisation of ADC
+    MCP3428(Resolution bit_res, ConversionMode conv_mode, Gain gain,
+            std::shared_ptr<I2CCom> com);
+    MCP3428(std::shared_ptr<I2CCom> com);
+    virtual ~MCP3428();
+
+    /**
+     * Set the gain of the ADC for all future measurements.
+     *
+     * \param gain The new gain
+     */
+    void setGain(Gain gain);
+
+    // Read value from ADC
+    virtual int32_t readCount();
+    virtual int32_t readCount(uint8_t ch);
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data);
+
+ private:
+    // Properties of device
+    const uint8_t m_numChannels = 4;
+    Resolution m_resolution;
+    ConversionMode m_conv_mode;
+    Gain m_gain;
+
+    // Pointer for I2C communication
+    std::shared_ptr<I2CCom> m_com;
 };
 
-#endif // MCP3428_H
+#endif  // MCP3428_H
diff --git a/src/libDevCom/MCP4801.cpp b/src/libDevCom/MCP4801.cpp
index 628d2719..72e95e31 100644
--- a/src/libDevCom/MCP4801.cpp
+++ b/src/libDevCom/MCP4801.cpp
@@ -1,47 +1,39 @@
 #include "MCP4801.h"
 
-#include "LinearCalibration.h"
-
-#include <iostream>
 #include <iomanip>
+#include <iostream>
+
+#include "LinearCalibration.h"
 
 MCP4801::MCP4801(std::shared_ptr<SPICom> com)
-  : DACDevice(std::make_shared<LinearCalibration>(2.048, 0xFF)), m_com(com)
-{ }
+    : DACDevice(std::make_shared<LinearCalibration>(2.048, 0xFF)), m_com(com) {}
 
-MCP4801::~MCP4801()
-{ }
+MCP4801::~MCP4801() {}
 
-void MCP4801::setCount(int32_t counts)
-{
-  counts=((counts<<4)|0x3000)&0xFFFF;
-  m_com->write_reg16(counts);
+void MCP4801::setCount(int32_t counts) {
+    counts = ((counts << 4) | 0x3000) & 0xFFFF;
+    m_com->write_reg16(counts);
 }
 
-void MCP4801::setCount(uint8_t ch, int32_t counts)
-{
-  // TODO: Throw exception if wrong channel
-  setCount(counts);
+void MCP4801::setCount(uint8_t ch, int32_t counts) {
+    // TODO: Throw exception if wrong channel
+    setCount(counts);
 }
 
-void MCP4801::setCount(const std::vector<uint8_t>& chs, const std::vector<int32_t>& counts)
-{
-  for(uint8_t i=0; i<chs.size()-1; i++)
-    {
-      // TODO: Throw exception if wrong channel
-      setCount(chs[i],counts[1]);
+void MCP4801::setCount(const std::vector<uint8_t>& chs,
+                       const std::vector<int32_t>& counts) {
+    for (uint8_t i = 0; i < chs.size() - 1; i++) {
+        // TODO: Throw exception if wrong channel
+        setCount(chs[i], counts[1]);
     }
 }
 
-int32_t MCP4801::readCount()
-{ return 0; }
- 
-int32_t MCP4801::readCount(uint8_t ch)
-{ return 0; }
- 
-void MCP4801::readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data)
-{
-  data.clear();
-  data.resize(chs.size(), 0);
-}
+int32_t MCP4801::readCount() { return 0; }
 
+int32_t MCP4801::readCount(uint8_t ch) { return 0; }
+
+void MCP4801::readCount(const std::vector<uint8_t>& chs,
+                        std::vector<int32_t>& data) {
+    data.clear();
+    data.resize(chs.size(), 0);
+}
diff --git a/src/libDevCom/MCP4801.h b/src/libDevCom/MCP4801.h
index 2ef2a873..ca6608f6 100644
--- a/src/libDevCom/MCP4801.h
+++ b/src/libDevCom/MCP4801.h
@@ -3,25 +3,26 @@
 
 #include <memory>
 
-#include "SPICom.h"
 #include "DACDevice.h"
+#include "SPICom.h"
 
-class MCP4801 : public DACDevice
-{
-public:
-  MCP4801(std::shared_ptr<SPICom> com);
-  virtual ~MCP4801();
+class MCP4801 : public DACDevice {
+ public:
+    MCP4801(std::shared_ptr<SPICom> com);
+    virtual ~MCP4801();
 
-  virtual void setCount(int32_t counts);
-  virtual void setCount(uint8_t ch, int32_t counts);
-  virtual void setCount(const std::vector<uint8_t>& chs, const std::vector<int32_t>& counts);
+    virtual void setCount(int32_t counts);
+    virtual void setCount(uint8_t ch, int32_t counts);
+    virtual void setCount(const std::vector<uint8_t>& chs,
+                          const std::vector<int32_t>& counts);
 
-  virtual int32_t readCount();
-  virtual int32_t readCount(uint8_t ch);
-  virtual void readCount(const std::vector<uint8_t>& chs, std::vector<int32_t>& data);
+    virtual int32_t readCount();
+    virtual int32_t readCount(uint8_t ch);
+    virtual void readCount(const std::vector<uint8_t>& chs,
+                           std::vector<int32_t>& data);
 
-private:
-  std::shared_ptr<SPICom> m_com;
+ private:
+    std::shared_ptr<SPICom> m_com;
 };
 
-#endif // MCP4801_H
+#endif  // MCP4801_H
diff --git a/src/libDevCom/MPSSEChip.cpp b/src/libDevCom/MPSSEChip.cpp
index a21cf819..3d4e293e 100644
--- a/src/libDevCom/MPSSEChip.cpp
+++ b/src/libDevCom/MPSSEChip.cpp
@@ -1,29 +1,30 @@
 
-//labremote
+// labremote
 #include "MPSSEChip.h"
+
 #include "ComIOException.h"
 #include "Logger.h"
 
-//libmpsse
+// libmpsse
 extern "C" {
-    #include "mpsse.h"
+#include "mpsse.h"
 }
 
-//std/stl
+// std/stl
 #include <sstream>
 #include <stdexcept>
-#include <tuple> // std::get<>
-
-MPSSEChip::MPSSEChip(MPSSEChip::Protocol protocol, MPSSEChip::Speed speed, MPSSEChip::Endianness endianness,
-        int vendor_id, int product_id, const std::string& description, const std::string& serial)
-{
-    logger(logDEBUG) << "Initializing MPSSEChip with (protocol, speed, endianness)=("
-                        << protocol2str(protocol)
-                        << ", " << speed2str(speed)
-                        << ", " << endianness2str(endianness) << ")";
-
-    if(protocol != MPSSEChip::Protocol::I2C)
-    {
+#include <tuple>  // std::get<>
+
+MPSSEChip::MPSSEChip(MPSSEChip::Protocol protocol, MPSSEChip::Speed speed,
+                     MPSSEChip::Endianness endianness, int vendor_id,
+                     int product_id, const std::string& description,
+                     const std::string& serial) {
+    logger(logDEBUG)
+        << "Initializing MPSSEChip with (protocol, speed, endianness)=("
+        << protocol2str(protocol) << ", " << speed2str(speed) << ", "
+        << endianness2str(endianness) << ")";
+
+    if (protocol != MPSSEChip::Protocol::I2C) {
         std::stringstream warning;
         warning << "You have selected a serial protocol (\""
                 << MPSSEChip::protocol2str(protocol) << "\")"
@@ -33,60 +34,61 @@ MPSSEChip::MPSSEChip(MPSSEChip::Protocol protocol, MPSSEChip::Speed speed, MPSSE
 
     // get the libmpsse instances of the enumerated items
     enum modes mode;
-    switch(protocol)
-    {
-        case MPSSEChip::Protocol::I2C : {
+    switch (protocol) {
+        case MPSSEChip::Protocol::I2C: {
             mode = I2C;
             break;
         }
-        case MPSSEChip::Protocol::SPI0 : {
+        case MPSSEChip::Protocol::SPI0: {
             mode = SPI0;
             break;
         }
-        case MPSSEChip::Protocol::SPI1 : {
+        case MPSSEChip::Protocol::SPI1: {
             mode = SPI1;
             break;
         }
-        case MPSSEChip::Protocol::SPI2 : {
+        case MPSSEChip::Protocol::SPI2: {
             mode = SPI2;
             break;
         }
-    } // switch
+    }  // switch
 
     int end = (endianness == MPSSEChip::Endianness::MSBFirst) ? MSB : LSB;
 
-    if(vendor_id >= 0 && product_id >= 0)
-    {
-        if(!is_known_ftdi_device(vendor_id, product_id))
-        {
+    if (vendor_id >= 0 && product_id >= 0) {
+        if (!is_known_ftdi_device(vendor_id, product_id)) {
             std::stringstream warning;
-            warning << "You have selected a device (VID=0x" << std::hex << vendor_id
-                    << ", PID=0x" << std::hex << product_id << std::dec << ")"
-                    << " that has not been tested to be a valid FTDI/MPSSE device";
+            warning
+                << "You have selected a device (VID=0x" << std::hex << vendor_id
+                << ", PID=0x" << std::hex << product_id << std::dec << ")"
+                << " that has not been tested to be a valid FTDI/MPSSE device";
             logger(logWARNING) << warning.str();
         }
-        logger(logDEBUG) << "Opening FTDI device at 0x" << std::hex << vendor_id << ":0x" << product_id;
+        logger(logDEBUG) << "Opening FTDI device at 0x" << std::hex << vendor_id
+                         << ":0x" << product_id;
 
-        // opens the specific USB device with VID = vendor_id and PID = product_id and serial number = serial
-        // NOTE: we specify IFACE_A since on FT232H there is only one interface,
+        // opens the specific USB device with VID = vendor_id and PID =
+        // product_id and serial number = serial NOTE: we specify IFACE_A since
+        // on FT232H there is only one interface,
         //       but on other FTDI MPPSE may have several
         // Open(...) is defined in libmpsse
-        if((m_mpsse = Open(vendor_id, product_id, mode, static_cast<int>(speed),
-                    end, IFACE_A, (!description.empty())?description.c_str():NULL, (!serial.empty())?serial.c_str():NULL )) == NULL || !m_mpsse->open)
+        if ((m_mpsse = Open(
+                 vendor_id, product_id, mode, static_cast<int>(speed), end,
+                 IFACE_A, (!description.empty()) ? description.c_str() : NULL,
+                 (!serial.empty()) ? serial.c_str() : NULL)) == NULL ||
+            !m_mpsse->open)
             throw ComIOException("Failed to open MPSSE device");
-    }
-    else
-    {
+    } else {
         logger(logDEBUG) << "Opening FTDI device";
 
         // opens the first FTDI device found
         // MPSSE(...) is defined in libmpsse
-        if((m_mpsse = MPSSE(mode, static_cast<int>(speed), end)) == NULL || !m_mpsse->open)
+        if ((m_mpsse = MPSSE(mode, static_cast<int>(speed), end)) == NULL ||
+            !m_mpsse->open)
             throw ComIOException("Failed to open MPSSE device");
     }
 
-    if(protocol == MPSSEChip::Protocol::I2C)
-    {
+    if (protocol == MPSSEChip::Protocol::I2C) {
         Tristate(m_mpsse);
     }
 
@@ -95,139 +97,142 @@ MPSSEChip::MPSSEChip(MPSSEChip::Protocol protocol, MPSSEChip::Speed speed, MPSSE
     m_endianness = endianness;
 }
 
-MPSSEChip::~MPSSEChip()
-{
+MPSSEChip::~MPSSEChip() {
     // Close is defined in libmpsse
     Close(m_mpsse);
 }
 
-bool MPSSEChip::start()
-{
+bool MPSSEChip::start() {
     // Start is defined in libmpsse
     return Start(m_mpsse) == MPSSE_OK;
 }
 
-bool MPSSEChip::stop()
-{
+bool MPSSEChip::stop() {
     // Stop is defined in libmpsse
     return Stop(m_mpsse) == MPSSE_OK;
 }
 
-bool MPSSEChip::write(char* data, int size)
-{
+bool MPSSEChip::write(char* data, int size) {
     // Write is defined in libmpsse
     return Write(m_mpsse, data, size) == MPSSE_OK;
 }
 
-void MPSSEChip::gpio_write(int pin, int state)
-{
+void MPSSEChip::gpio_write(int pin, int state) {
     // PinLow and PinHigh are defined in libmpsse
-    if(state == 0)
+    if (state == 0)
         PinLow(mpsse_ctx(), pin);
     else
         PinHigh(mpsse_ctx(), pin);
 }
 
-bool MPSSEChip::get_ack()
-{
+bool MPSSEChip::get_ack() {
     // GetAck is defined in libmpsse
     return GetAck(mpsse_ctx()) == ACK;
 }
 
-void MPSSEChip::set_ack()
-{
+void MPSSEChip::set_ack() {
     // SetAck is defined in libmpsse
     SetAck(mpsse_ctx(), ACK);
 }
 
-void MPSSEChip::set_nack()
-{
+void MPSSEChip::set_nack() {
     // SetAck is defined in libmpsse
-    SetAck(mpsse_ctx(),  NACK);
+    SetAck(mpsse_ctx(), NACK);
 }
 
-char* MPSSEChip::read(int size)
-{
+char* MPSSEChip::read(int size) {
     // Read is defined in libmpsse
     return Read(mpsse_ctx(), size);
 }
 
-std::string MPSSEChip::protocol2str(const MPSSEChip::Protocol& proto)
-{
+std::string MPSSEChip::protocol2str(const MPSSEChip::Protocol& proto) {
     std::stringstream os;
-    switch(proto)
-    {
-        case MPSSEChip::Protocol::I2C : { os << "I2C"; break; }
-        case MPSSEChip::Protocol::SPI0 : { os << "SPI0"; break; }
-        case MPSSEChip::Protocol::SPI1 : { os << "SPI1"; break; }
-        case MPSSEChip::Protocol::SPI2 : { os << "SPI2"; break; }
-        case MPSSEChip::Protocol::SPI3 : { os << "SPI3"; break; }
+    switch (proto) {
+        case MPSSEChip::Protocol::I2C: {
+            os << "I2C";
+            break;
+        }
+        case MPSSEChip::Protocol::SPI0: {
+            os << "SPI0";
+            break;
+        }
+        case MPSSEChip::Protocol::SPI1: {
+            os << "SPI1";
+            break;
+        }
+        case MPSSEChip::Protocol::SPI2: {
+            os << "SPI2";
+            break;
+        }
+        case MPSSEChip::Protocol::SPI3: {
+            os << "SPI3";
+            break;
+        }
         default: {
             os << "MPSSEChip::ProtocolInvalid";
             break;
         }
-    } // switch
+    }  // switch
     return os.str();
 }
 
-std::string MPSSEChip::endianness2str(const MPSSEChip::Endianness& endianness)
-{
+std::string MPSSEChip::endianness2str(const MPSSEChip::Endianness& endianness) {
     std::stringstream os;
-    switch(endianness)
-    {
-        case MPSSEChip::Endianness::MSBFirst : { os << "MSBFirst"; break; }
-        case MPSSEChip::Endianness::LSBFirst : { os << "LSBFirst"; break; }
-        default : {
+    switch (endianness) {
+        case MPSSEChip::Endianness::MSBFirst: {
+            os << "MSBFirst";
+            break;
+        }
+        case MPSSEChip::Endianness::LSBFirst: {
+            os << "LSBFirst";
+            break;
+        }
+        default: {
             os << "MPSSEChip::EndiannessInvalid";
             break;
         }
-    } // switch
+    }  // switch
     return os.str();
 }
 
-std::string MPSSEChip::speed2str(const MPSSEChip::Speed& speed)
-{
+std::string MPSSEChip::speed2str(const MPSSEChip::Speed& speed) {
     std::stringstream os;
-    switch(speed)
-    {
-        case MPSSEChip::Speed::ONE_HUNDRED_KHZ :
-        case MPSSEChip::Speed::FOUR_HUNDRED_KHZ :
-        case MPSSEChip::Speed::ONE_MHZ :
-        case MPSSEChip::Speed::TWO_MHZ :
-        case MPSSEChip::Speed::FIVE_MHZ :
-        case MPSSEChip::Speed::SIX_MHZ :
-        case MPSSEChip::Speed::TEN_MHZ :
-        case MPSSEChip::Speed::TWELVE_MHZ :
-        case MPSSEChip::Speed::FIFTEEN_MHZ :
-        case MPSSEChip::Speed::THIRTY_MHZ :
-        case MPSSEChip::Speed::SIXTY_MHZ : {
+    switch (speed) {
+        case MPSSEChip::Speed::ONE_HUNDRED_KHZ:
+        case MPSSEChip::Speed::FOUR_HUNDRED_KHZ:
+        case MPSSEChip::Speed::ONE_MHZ:
+        case MPSSEChip::Speed::TWO_MHZ:
+        case MPSSEChip::Speed::FIVE_MHZ:
+        case MPSSEChip::Speed::SIX_MHZ:
+        case MPSSEChip::Speed::TEN_MHZ:
+        case MPSSEChip::Speed::TWELVE_MHZ:
+        case MPSSEChip::Speed::FIFTEEN_MHZ:
+        case MPSSEChip::Speed::THIRTY_MHZ:
+        case MPSSEChip::Speed::SIXTY_MHZ: {
             os << static_cast<int>(speed);
             break;
         }
-        default : {
+        default: {
             os << "MPSSEChip::SpeedInvalid";
             break;
         }
-    } // switch
+    }  // switch
     return os.str();
 }
 
-std::string MPSSEChip::to_string()
-{
+std::string MPSSEChip::to_string() {
     std::stringstream sx;
     sx << "Protocol: " << MPSSEChip::protocol2str(this->protocol())
-        << ", Speed: " << MPSSEChip::speed2str(this->speed())
-        << ", Endianness: " << MPSSEChip::endianness2str(this->endianness());
+       << ", Speed: " << MPSSEChip::speed2str(this->speed())
+       << ", Endianness: " << MPSSEChip::endianness2str(this->endianness());
     return sx.str();
 }
 
-bool MPSSEChip::is_known_ftdi_device(int vid, int pid)
-{
-    for(std::pair<int, int> device : m_known_ftdi_devices)
-    {
+bool MPSSEChip::is_known_ftdi_device(int vid, int pid) {
+    for (std::pair<int, int> device : m_known_ftdi_devices) {
         int ivid = std::get<0>(device);
         int ipid = std::get<1>(device);
-        if(ivid == vid && ipid == pid) return true;
+        if (ivid == vid && ipid == pid) return true;
     }
     return false;
 }
diff --git a/src/libDevCom/MPSSEChip.h b/src/libDevCom/MPSSEChip.h
index aaff7a50..78a4c4d5 100644
--- a/src/libDevCom/MPSSEChip.h
+++ b/src/libDevCom/MPSSEChip.h
@@ -1,163 +1,181 @@
 #ifndef MPSSE_CHIP_H
 #define MPSSE_CHIP_H
 
-//std/stl
+// std/stl
 #include <string>
 #include <vector>
 
-//libmpsse
+// libmpsse
 struct mpsse_context;
 
-//! \brief Base implementation of a device with a Multi-Protocol Synchronous Serial Engine (MPSSE).
+//! \brief Base implementation of a device with a Multi-Protocol Synchronous
+//! Serial Engine (MPSSE).
 /**
- * The `MPSSEChip` class provides the interface to the MPSSE device and is the main
- * interface to the C library `libmpsse`. Devices in `libDevCom` that communicate
- * via MPSSE should inherit from `MPSSEChip`, and use it as the primary means of
- * interfacing with the device. In this way, the `libmpsse` methods are abstracted away.
+ * The `MPSSEChip` class provides the interface to the MPSSE device and is the
+ * main interface to the C library `libmpsse`. Devices in `libDevCom` that
+ * communicate via MPSSE should inherit from `MPSSEChip`, and use it as the
+ * primary means of interfacing with the device. In this way, the `libmpsse`
+ * methods are abstracted away.
  */
-class MPSSEChip
-{
-    public:
-        //! \brief Possible MPSSE serial communication protocols supported by `libmpsse`.
-        /**
-        * It should be noted that for the SPI protocols, `libmpsse` appears to set
-        * the chip-select (CS) pin to 0x08 (ADBUS3). In actuality, any of the GPIOs
-        * should be able to be set as a CS line for an SPI secondary. This means
-        * that `libmpsse` assumes one SPI primary and one SPI secondary.
-        */
-        enum class Protocol {
-            I2C
-            ,SPI0 // note: libmpsse only supports SPI bus with single primary and single secondary (i.e. only a single CS line)
-            ,SPI1
-            ,SPI2
-            ,SPI3
-        };
-
-        //! \brief Serial communication clock speeds supported by the various serial communication protocol.
-        enum class Speed {
-            ONE_HUNDRED_KHZ   = 100000
-            ,FOUR_HUNDRED_KHZ = 400000
-            ,ONE_MHZ          = 1000000
-            ,TWO_MHZ          = 2000000
-            ,FIVE_MHZ         = 5000000
-            ,SIX_MHZ          = 6000000
-            ,TEN_MHZ          = 10000000
-            ,TWELVE_MHZ       = 12000000
-            ,FIFTEEN_MHZ      = 15000000
-            ,THIRTY_MHZ       = 30000000
-            ,SIXTY_MHZ        = 60000000
-        };
-
-        //! \brief Expected endianness of data transfer between the MPSSE serial communication primary and secondary devices on the serial bus
-        enum class Endianness {
-            MSBFirst
-            ,LSBFirst
-        };
-
-        //! \brief `MPSSEChip` constructor, instantiates an `mpsse_context` configured for serial communication.
-        /**
-        * \param protocol Serial communication protocol required (see `Protocol`).
-        * \param speed Clock rate for the synchronous communication (see `Speed`).
-        * \param endianness Whether the devices expects MSB or LSB first in data transmission (see `Endianness`).
-        * \param vendor_id USB device vendor ID of the device to open communication with.
-        * \param product_id USB device product ID of the device to open communication with.
-	* \param description Product description used to identify device to open communication with (leave blank for none).
-	* \param serial Serial number used to identify device to open communication with (leave blank for none).
-        *
-        * The default behavior, with `vendor_id` and `product_id` both equal to `-1` tells the constructor
-        * to attempt communication with the first FTDI USB device found. If both `vendor_id` and
-        * `product_id` are non-negative, then the `MPSSEChip` constructor will attempt to
-        * establish communication with the FTDI USB device with the given `vendor_id` and `product_id`.
-	*
-	* The product description and serial number can be used in a manner similar to the vendor and product ID's, with empty
-	* string disabling their check.
-	*
-        * Running `lsusb` at the command line lists the possible USB devices on your machine (along with their
-        * vendor and product IDs).
-        */
-        MPSSEChip(Protocol protocol, Speed speed, Endianness endianness,
-                    int vendor_id = -1, int product_id = -1, const std::string& description = "", const std::string& serial = "");
-
-        //! \brief `MPSSEChip` destructor, closes the `mpsse_context` and USB device.
-        ~MPSSEChip();
-
-        //! \brief Establish the `START` condition on the serial communication bus.
-        virtual bool start();
-
-        //! \brief Establish the `STOP` condition on the serial communication bus.
-        virtual bool stop();
-
-        //! \brief Write data to the serial bus.
-        /**
-        * \param data Array of data (bytes) to send.
-        * \param size Number of bytes to write.
-        */
-        virtual bool write(char* data, int size);
-
-        //! \brief Read data from the serial bus.
-        /**
-        * \param size Number of bytes to read.
-        */
-        virtual char* read(int size);
-
-        //! \brief Set the state of one of the GPIO pins on the MPSSE chip.
-        /**
-        * \param pin The GPIO pin to set.
-        * \param state The state to set the pin to (`0` is OFF/LOW, `1` is ON/HIGH)
-        *
-        * Note that in terms of the MPSSE device, the GPIO pin numbering starts
-        * counting from `0`, and does not correspond to the actual/physical pin number of
-        * the MPSSE chip. For I2C communication, GPIO pin `0` corresponds to A*BUS3.
-        * For SPI communication, GPIO pin `0` corresponds to (A*BUS4 + (N SPI secondaries) - 1).
-        */
-        virtual void gpio_write(int pin, int state);
-
-        //! \brief Get the ACK bit from a the most recent I2C write to an I2C secondary.
-        virtual bool get_ack();
-
-        //! \brief Set the I2C primary's (i.e. that of the `MPSSEChip`) ACK bit for subsequent I2C transactions.
-        virtual void set_ack();
-
-        //! \brief Set the I2C primary's (i.e. that of the `MPSSEChip`) NACK bit for subsequent I2C transactions.
-        virtual void set_nack();
-
-        //! \brief Get the currently configured `MPSSE` serial communication protocol.
-        const Protocol& protocol() const { return m_protocol; }
-
-        //! \brief Get the bus speed for the currently configured serial communication.
-        const Speed& speed() const { return m_speed; }
-
-        //! \brief Get the expected I2C device endianness.
-        const Endianness& endianness() const { return m_endianness; }
-
-        //! \brief Return a string summarizing the currently configured `MPSSEChip` instance.
-        std::string to_string();
-
-        //! \breif Convert an `MPSSEChip::Protocol` value to a human-readable `std::string`.
-        static std::string protocol2str(const Protocol& proto);
-
-        //! \breif Convert an `MPSSEChip::Speed` value to a human-readable `std::string`.
-        static std::string speed2str(const Speed& speed);
-
-        //! \brief Convert an `MPSSEChip::Endianness` value to a human-readable `std::string`.
-        static std::string endianness2str(const Endianness& endianness);
-
-    private:
-
-        bool is_known_ftdi_device(int vendor_id, int product_id);
-        std::vector<std::pair<int,int> > m_known_ftdi_devices = {
-            std::make_pair(0x0403, 0x6010),
-            std::make_pair(0x0403, 0x6011),
-            std::make_pair(0x0403, 0x6014)
-        };
-
-        struct mpsse_context* m_mpsse;
-        struct mpsse_context* mpsse_ctx() { return m_mpsse; }
-
-        Protocol m_protocol;
-        Speed m_speed;
-        Endianness m_endianness;
-
-}; // class MPSSEChip
-
-#endif // MPSSE_CHIP_H
+class MPSSEChip {
+ public:
+    //! \brief Possible MPSSE serial communication protocols supported by
+    //! `libmpsse`.
+    /**
+     * It should be noted that for the SPI protocols, `libmpsse` appears to set
+     * the chip-select (CS) pin to 0x08 (ADBUS3). In actuality, any of the GPIOs
+     * should be able to be set as a CS line for an SPI secondary. This means
+     * that `libmpsse` assumes one SPI primary and one SPI secondary.
+     */
+    enum class Protocol {
+        I2C,
+        SPI0  // note: libmpsse only supports SPI bus with single primary and
+              // single secondary (i.e. only a single CS line)
+        ,
+        SPI1,
+        SPI2,
+        SPI3
+    };
+
+    //! \brief Serial communication clock speeds supported by the various serial
+    //! communication protocol.
+    enum class Speed {
+        ONE_HUNDRED_KHZ = 100000,
+        FOUR_HUNDRED_KHZ = 400000,
+        ONE_MHZ = 1000000,
+        TWO_MHZ = 2000000,
+        FIVE_MHZ = 5000000,
+        SIX_MHZ = 6000000,
+        TEN_MHZ = 10000000,
+        TWELVE_MHZ = 12000000,
+        FIFTEEN_MHZ = 15000000,
+        THIRTY_MHZ = 30000000,
+        SIXTY_MHZ = 60000000
+    };
+
+    //! \brief Expected endianness of data transfer between the MPSSE serial
+    //! communication primary and secondary devices on the serial bus
+    enum class Endianness { MSBFirst, LSBFirst };
+
+    //! \brief `MPSSEChip` constructor, instantiates an `mpsse_context`
+    //! configured for serial communication.
+    /**
+     * \param protocol Serial communication protocol required (see `Protocol`).
+     * \param speed Clock rate for the synchronous communication (see `Speed`).
+     * \param endianness Whether the devices expects MSB or LSB first in data
+     * transmission (see `Endianness`). \param vendor_id USB device vendor ID of
+     * the device to open communication with. \param product_id USB device
+     * product ID of the device to open communication with. \param description
+     * Product description used to identify device to open communication with
+     * (leave blank for none). \param serial Serial number used to identify
+     * device to open communication with (leave blank for none).
+     *
+     * The default behavior, with `vendor_id` and `product_id` both equal to
+     * `-1` tells the constructor to attempt communication with the first FTDI
+     * USB device found. If both `vendor_id` and `product_id` are non-negative,
+     * then the `MPSSEChip` constructor will attempt to establish communication
+     * with the FTDI USB device with the given `vendor_id` and `product_id`.
+     *
+     * The product description and serial number can be used in a manner similar
+     * to the vendor and product ID's, with empty string disabling their check.
+     *
+     * Running `lsusb` at the command line lists the possible USB devices on
+     * your machine (along with their vendor and product IDs).
+     */
+    MPSSEChip(Protocol protocol, Speed speed, Endianness endianness,
+              int vendor_id = -1, int product_id = -1,
+              const std::string& description = "",
+              const std::string& serial = "");
+
+    //! \brief `MPSSEChip` destructor, closes the `mpsse_context` and USB
+    //! device.
+    ~MPSSEChip();
+
+    //! \brief Establish the `START` condition on the serial communication bus.
+    virtual bool start();
+
+    //! \brief Establish the `STOP` condition on the serial communication bus.
+    virtual bool stop();
+
+    //! \brief Write data to the serial bus.
+    /**
+     * \param data Array of data (bytes) to send.
+     * \param size Number of bytes to write.
+     */
+    virtual bool write(char* data, int size);
+
+    //! \brief Read data from the serial bus.
+    /**
+     * \param size Number of bytes to read.
+     */
+    virtual char* read(int size);
+
+    //! \brief Set the state of one of the GPIO pins on the MPSSE chip.
+    /**
+     * \param pin The GPIO pin to set.
+     * \param state The state to set the pin to (`0` is OFF/LOW, `1` is ON/HIGH)
+     *
+     * Note that in terms of the MPSSE device, the GPIO pin numbering starts
+     * counting from `0`, and does not correspond to the actual/physical pin
+     * number of the MPSSE chip. For I2C communication, GPIO pin `0` corresponds
+     * to A*BUS3. For SPI communication, GPIO pin `0` corresponds to (A*BUS4 +
+     * (N SPI secondaries) - 1).
+     */
+    virtual void gpio_write(int pin, int state);
+
+    //! \brief Get the ACK bit from a the most recent I2C write to an I2C
+    //! secondary.
+    virtual bool get_ack();
+
+    //! \brief Set the I2C primary's (i.e. that of the `MPSSEChip`) ACK bit for
+    //! subsequent I2C transactions.
+    virtual void set_ack();
+
+    //! \brief Set the I2C primary's (i.e. that of the `MPSSEChip`) NACK bit for
+    //! subsequent I2C transactions.
+    virtual void set_nack();
+
+    //! \brief Get the currently configured `MPSSE` serial communication
+    //! protocol.
+    const Protocol& protocol() const { return m_protocol; }
+
+    //! \brief Get the bus speed for the currently configured serial
+    //! communication.
+    const Speed& speed() const { return m_speed; }
+
+    //! \brief Get the expected I2C device endianness.
+    const Endianness& endianness() const { return m_endianness; }
+
+    //! \brief Return a string summarizing the currently configured `MPSSEChip`
+    //! instance.
+    std::string to_string();
+
+    //! \breif Convert an `MPSSEChip::Protocol` value to a human-readable
+    //! `std::string`.
+    static std::string protocol2str(const Protocol& proto);
+
+    //! \breif Convert an `MPSSEChip::Speed` value to a human-readable
+    //! `std::string`.
+    static std::string speed2str(const Speed& speed);
+
+    //! \brief Convert an `MPSSEChip::Endianness` value to a human-readable
+    //! `std::string`.
+    static std::string endianness2str(const Endianness& endianness);
+
+ private:
+    bool is_known_ftdi_device(int vendor_id, int product_id);
+    std::vector<std::pair<int, int> > m_known_ftdi_devices = {
+        std::make_pair(0x0403, 0x6010), std::make_pair(0x0403, 0x6011),
+        std::make_pair(0x0403, 0x6014)};
+
+    struct mpsse_context* m_mpsse;
+    struct mpsse_context* mpsse_ctx() {
+        return m_mpsse;
+    }
+
+    Protocol m_protocol;
+    Speed m_speed;
+    Endianness m_endianness;
+};  // class MPSSEChip
+
+#endif  // MPSSE_CHIP_H
diff --git a/src/libDevCom/MuxDevice.h b/src/libDevCom/MuxDevice.h
index a3d15619..fe6e5bb0 100644
--- a/src/libDevCom/MuxDevice.h
+++ b/src/libDevCom/MuxDevice.h
@@ -5,17 +5,16 @@
 
 /** \brief Interface for programmable multiplexers
  */
-class MuxDevice
-{
-public:
-  MuxDevice();
-  virtual ~MuxDevice() =default;
+class MuxDevice {
+ public:
+    MuxDevice();
+    virtual ~MuxDevice() = default;
 
-  /** \brief Select output channel
-   *
-   * \param ch Channel to set for output
-   */
-  virtual void select(uint32_t ch) =0;
+    /** \brief Select output channel
+     *
+     * \param ch Channel to set for output
+     */
+    virtual void select(uint32_t ch) = 0;
 };
 
-#endif // MUXDEVICE_H
+#endif  // MUXDEVICE_H
diff --git a/src/libDevCom/NTCSensor.cpp b/src/libDevCom/NTCSensor.cpp
index cfea1fe5..96c2f0b7 100644
--- a/src/libDevCom/NTCSensor.cpp
+++ b/src/libDevCom/NTCSensor.cpp
@@ -1,49 +1,47 @@
 #include "NTCSensor.h"
 
-#include "NotSupportedException.h"
-
 #include <cmath>
 
-NTCSensor::NTCSensor(uint8_t pin, std::shared_ptr<TextSerialCom> com, float refTemp=298.15, 
-  float Rref=10000.0, float Bntc=3435.0, float Rdiv=10000.0, float V=5.0)
-  : m_temperature(-273.15), m_devcom(1024,com), m_pin(pin), m_refTemp(refTemp), 
-    m_Rref(Rref), m_Bntc(Bntc), m_Rdiv(Rdiv), m_V(V)
-{ }
+#include "NotSupportedException.h"
+
+NTCSensor::NTCSensor(uint8_t pin, std::shared_ptr<TextSerialCom> com,
+                     float refTemp = 298.15, float Rref = 10000.0,
+                     float Bntc = 3435.0, float Rdiv = 10000.0, float V = 5.0)
+    : m_temperature(-273.15),
+      m_devcom(1024, com),
+      m_pin(pin),
+      m_refTemp(refTemp),
+      m_Rref(Rref),
+      m_Bntc(Bntc),
+      m_Rdiv(Rdiv),
+      m_V(V) {}
 
-NTCSensor::~NTCSensor()
-{ }
+NTCSensor::~NTCSensor() {}
 
-void NTCSensor::init()
-{ }
+void NTCSensor::init() {}
 
-void NTCSensor::reset()
-{ }
+void NTCSensor::reset() {}
 
-void NTCSensor::read()
-{
-  m_temperature=raw_to_C(m_devcom.read(m_pin));
-}
+void NTCSensor::read() { m_temperature = raw_to_C(m_devcom.read(m_pin)); }
 
-float NTCSensor::temperature() const
-{
-  return m_temperature;
-}
+float NTCSensor::temperature() const { return m_temperature; }
 
-float NTCSensor::humidity() const
-{
-  throw NotSupportedException("Humidity not supported for NTC");
-  return 0;
+float NTCSensor::humidity() const {
+    throw NotSupportedException("Humidity not supported for NTC");
+    return 0;
 }
 
-float NTCSensor::pressure() const
-{
-  throw NotSupportedException("Pressure not supported for NTC");
-  return 0;
+float NTCSensor::pressure() const {
+    throw NotSupportedException("Pressure not supported for NTC");
+    return 0;
 }
 
-float NTCSensor::raw_to_C(float raw)
-{
-  // If there is a reading error, return a default value
-  if(raw>=1024*m_V/5.0) return -273.15;
-  return m_Bntc*m_refTemp/(m_refTemp*std::log((m_Rdiv*(1024*m_V/5.0-raw)/raw)/m_Rref)+m_Bntc) - 273.15;
+float NTCSensor::raw_to_C(float raw) {
+    // If there is a reading error, return a default value
+    if (raw >= 1024 * m_V / 5.0) return -273.15;
+    return m_Bntc * m_refTemp /
+               (m_refTemp * std::log((m_Rdiv * (1024 * m_V / 5.0 - raw) / raw) /
+                                     m_Rref) +
+                m_Bntc) -
+           273.15;
 }
diff --git a/src/libDevCom/NTCSensor.h b/src/libDevCom/NTCSensor.h
index 63e4b30b..7c261833 100644
--- a/src/libDevCom/NTCSensor.h
+++ b/src/libDevCom/NTCSensor.h
@@ -1,70 +1,71 @@
 #ifndef NTCSENSOR_H
 #define NTCSENSOR_H
 
-#include <string>
 #include <cstdint>
+#include <string>
 
+#include "ADCDevComuino.h"
 #include "ClimateSensor.h"
 #include "TextSerialCom.h"
-#include "ADCDevComuino.h"
 
 //! \brief An implementation of 'ClimateSensor' for reading an NTC sensor
 /**
  * Measures temperature using an NTC connected to one of the analog pins
  * on an Arduino via an ADC intereface.
  */
-class NTCSensor : public ClimateSensor
-{
-public:
-  /**
-   * \param pin The pin number of the analog pin connected to the NTC
-   * \param com The TextSerialCom for interfacing with the Adruino
-   * \param refTemp The temperature at which the NTC's resistance is 
-   *   given (in degrees Kelvin)
-   * \param Rref The NTC's resistance at temperature refTemp
-   * \param Bntc The B value of the NTC
-   * \param Rdiv The resistance of the resistor in the voltage divider
-   * \param V The total voltage across the voltage divider circuit
-   *   (the NTC and the resistor)
-   */
-  NTCSensor(uint8_t pin, std::shared_ptr<TextSerialCom> com, float refTemp, float Rref, float Bntc, float Rdiv, float V);
-  virtual ~NTCSensor();
+class NTCSensor : public ClimateSensor {
+ public:
+    /**
+     * \param pin The pin number of the analog pin connected to the NTC
+     * \param com The TextSerialCom for interfacing with the Adruino
+     * \param refTemp The temperature at which the NTC's resistance is
+     *   given (in degrees Kelvin)
+     * \param Rref The NTC's resistance at temperature refTemp
+     * \param Bntc The B value of the NTC
+     * \param Rdiv The resistance of the resistor in the voltage divider
+     * \param V The total voltage across the voltage divider circuit
+     *   (the NTC and the resistor)
+     */
+    NTCSensor(uint8_t pin, std::shared_ptr<TextSerialCom> com, float refTemp,
+              float Rref, float Bntc, float Rdiv, float V);
+    virtual ~NTCSensor();
 
-  //! Does nothing (requried to implement ClimateSensor)
-  virtual void init();
-  //! Does nothing (required to implement ClimateSensor)
-  virtual void reset();
-  //! Reads the temperature from the NTC and stores it in m_temperature
-  virtual void read();
+    //! Does nothing (requried to implement ClimateSensor)
+    virtual void init();
+    //! Does nothing (required to implement ClimateSensor)
+    virtual void reset();
+    //! Reads the temperature from the NTC and stores it in m_temperature
+    virtual void read();
 
-  //! Returns the temperature (in Celsius) from the most recent reading
-  //  (defaults to -273.15)
-  virtual float temperature() const;
-  //! Throws a Not Supported exception (required to implement ClimateSensor)
-  virtual float humidity() const;
-  //! Throws a Not Supported exception (required to implement ClimateSensor
-  virtual float pressure() const;
+    //! Returns the temperature (in Celsius) from the most recent reading
+    //  (defaults to -273.15)
+    virtual float temperature() const;
+    //! Throws a Not Supported exception (required to implement ClimateSensor)
+    virtual float humidity() const;
+    //! Throws a Not Supported exception (required to implement ClimateSensor
+    virtual float pressure() const;
 
-private:
-  //! Interface with the Arduino via the ADC protocol
-  ADCDevComuino m_devcom;
-  //! The temperature at which the NTC's resistance is given (in Kelvin)
-  float m_refTemp;
-  //! The resistance of the NTC at temperature m_refTemp
-  float m_Rref;
-  //! The B value of the NTC
-  float m_Bntc;
-  //! The resistance of the resistor in the voltage divider circuit
-  float m_Rdiv;
-  //! The total voltage across the voltage divider (the NTC and the resistor)
-  float m_V;
-  //! The pin on the Arduino connected to the NTC
-  uint8_t m_pin;
-  //! The temperature recorded in the last reading (defaults to -273.15)
-  float m_temperature;
+ private:
+    //! Interface with the Arduino via the ADC protocol
+    ADCDevComuino m_devcom;
+    //! The temperature at which the NTC's resistance is given (in Kelvin)
+    float m_refTemp;
+    //! The resistance of the NTC at temperature m_refTemp
+    float m_Rref;
+    //! The B value of the NTC
+    float m_Bntc;
+    //! The resistance of the resistor in the voltage divider circuit
+    float m_Rdiv;
+    //! The total voltage across the voltage divider (the NTC and the resistor)
+    float m_V;
+    //! The pin on the Arduino connected to the NTC
+    uint8_t m_pin;
+    //! The temperature recorded in the last reading (defaults to -273.15)
+    float m_temperature;
 
-  //! Converts from the raw readout of the Arduino pin to temperature in Celsius
-  float raw_to_C(float volt);
+    //! Converts from the raw readout of the Arduino pin to temperature in
+    //! Celsius
+    float raw_to_C(float volt);
 };
 
-#endif // NTCSENSOR_H
+#endif  // NTCSENSOR_H
diff --git a/src/libDevCom/NotSupportedException.h b/src/libDevCom/NotSupportedException.h
index 5e581877..4cdaa4d5 100644
--- a/src/libDevCom/NotSupportedException.h
+++ b/src/libDevCom/NotSupportedException.h
@@ -5,15 +5,14 @@
 
 #include "ComException.h"
 
-class NotSupportedException : ComException
-{
-public:
-  NotSupportedException(const std::string& msg);
+class NotSupportedException : ComException {
+ public:
+    NotSupportedException(const std::string& msg);
 
-  virtual const char* what() const throw();
+    virtual const char* what() const throw();
 
-private:
-  std::string m_msg;
+ private:
+    std::string m_msg;
 };
 
-#endif // NOTSUPPORTEDEXCEPTION_H
+#endif  // NOTSUPPORTEDEXCEPTION_H
diff --git a/src/libDevCom/OutOfRangeException.cpp b/src/libDevCom/OutOfRangeException.cpp
index ee674018..507566c9 100644
--- a/src/libDevCom/OutOfRangeException.cpp
+++ b/src/libDevCom/OutOfRangeException.cpp
@@ -1,9 +1,11 @@
 #include "OutOfRangeException.h"
 
-OutOfRangeException::OutOfRangeException(uint32_t ch, uint32_t minCh, uint32_t maxCh)
-  : m_ch(ch),m_minCh(minCh),m_maxCh(maxCh),
-    m_msg("OutOfRangeException: "+std::to_string(ch)+" must be between "+std::to_string(minCh)+" and "+std::to_string(maxCh))
-{ }
+OutOfRangeException::OutOfRangeException(uint32_t ch, uint32_t minCh,
+                                         uint32_t maxCh)
+    : m_ch(ch),
+      m_minCh(minCh),
+      m_maxCh(maxCh),
+      m_msg("OutOfRangeException: " + std::to_string(ch) + " must be between " +
+            std::to_string(minCh) + " and " + std::to_string(maxCh)) {}
 
-const char* OutOfRangeException::what() const throw()
-{ return m_msg.c_str(); }
+const char* OutOfRangeException::what() const throw() { return m_msg.c_str(); }
diff --git a/src/libDevCom/OutOfRangeException.h b/src/libDevCom/OutOfRangeException.h
index 8b10c6fd..d2da094f 100644
--- a/src/libDevCom/OutOfRangeException.h
+++ b/src/libDevCom/OutOfRangeException.h
@@ -5,19 +5,17 @@
 
 #include "ComException.h"
 
-class OutOfRangeException : ComException
-{
-public:
-  OutOfRangeException(uint32_t ch, uint32_t minCh, uint32_t maxCh);
+class OutOfRangeException : ComException {
+ public:
+    OutOfRangeException(uint32_t ch, uint32_t minCh, uint32_t maxCh);
 
-  virtual const char* what() const throw();
+    virtual const char* what() const throw();
 
-private:
-  uint32_t m_ch;
-  uint32_t m_minCh;
-  uint32_t m_maxCh;;
-
-  std::string m_msg;  
+ private:
+    uint32_t m_ch;
+    uint32_t m_minCh;
+    uint32_t m_maxCh;
+    std::string m_msg;
 };
 
-#endif // OUTOFRANGEEXCEPTION_H
+#endif  // OUTOFRANGEEXCEPTION_H
diff --git a/src/libDevCom/PCA9548ACom.cpp b/src/libDevCom/PCA9548ACom.cpp
index 28d309b6..9c6206f8 100644
--- a/src/libDevCom/PCA9548ACom.cpp
+++ b/src/libDevCom/PCA9548ACom.cpp
@@ -2,332 +2,262 @@
 
 #include "ComIOException.h"
 
-PCA9548ACom::PCA9548ACom(uint8_t deviceAddr, uint8_t channel, std::shared_ptr<I2CCom> com)
-  : I2CCom(deviceAddr),
-    m_com(com), m_muxAddr(com->deviceAddr()), m_channel(channel)
-{ }
-
-PCA9548ACom::~PCA9548ACom()
-{ }
-
-void PCA9548ACom::write_reg32(uint32_t address, uint32_t data)
-{
-  m_com->write_reg8(1<<m_channel);
-
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->write_reg32(address, data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+PCA9548ACom::PCA9548ACom(uint8_t deviceAddr, uint8_t channel,
+                         std::shared_ptr<I2CCom> com)
+    : I2CCom(deviceAddr),
+      m_com(com),
+      m_muxAddr(com->deviceAddr()),
+      m_channel(channel) {}
+
+PCA9548ACom::~PCA9548ACom() {}
+
+void PCA9548ACom::write_reg32(uint32_t address, uint32_t data) {
+    m_com->write_reg8(1 << m_channel);
+
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->write_reg32(address, data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
 
-void PCA9548ACom::write_reg16(uint32_t address, uint16_t data)
-{
-  m_com->write_reg8(1<<m_channel);
+void PCA9548ACom::write_reg16(uint32_t address, uint16_t data) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->write_reg16(address, data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->write_reg16(address, data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
 
-void PCA9548ACom::write_reg8 (uint32_t address, uint8_t  data)
-{
-  m_com->write_reg8(1<<m_channel);
+void PCA9548ACom::write_reg8(uint32_t address, uint8_t data) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->write_reg8 (address, data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->write_reg8(address, data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
 
-void PCA9548ACom::write_reg32(uint32_t data)
-{
-  m_com->write_reg8(1<<m_channel);
+void PCA9548ACom::write_reg32(uint32_t data) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->write_reg32(data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->write_reg32(data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
 
-void PCA9548ACom::write_reg16(uint16_t data)
-{
-  m_com->write_reg8(1<<m_channel);
+void PCA9548ACom::write_reg16(uint16_t data) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->write_reg16(data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->write_reg16(data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
 
-void PCA9548ACom::write_reg8 (uint8_t  data)
-{
-  m_com->write_reg8(1<<m_channel);
+void PCA9548ACom::write_reg8(uint8_t data) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->write_reg8 (data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->write_reg8(data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
 
-void PCA9548ACom::write_block(uint32_t address, const std::vector<uint8_t>& data)
-{
-  m_com->write_reg8(1<<m_channel);
+void PCA9548ACom::write_block(uint32_t address,
+                              const std::vector<uint8_t>& data) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->write_block(address, data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->write_block(address, data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
 
-void PCA9548ACom::write_block(const std::vector<uint8_t>& data)
-{
-  m_com->write_reg8(1<<m_channel);
+void PCA9548ACom::write_block(const std::vector<uint8_t>& data) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->write_block(data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->write_block(data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
 
-uint32_t PCA9548ACom::read_reg32(uint32_t address)
-{
-  m_com->write_reg8(1<<m_channel);
+uint32_t PCA9548ACom::read_reg32(uint32_t address) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  uint32_t data=0;
-  try
-    {
-      data=m_com->read_reg32(address);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    uint32_t data = 0;
+    try {
+        data = m_com->read_reg32(address);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
-  return data;
+    return data;
 }
 
-uint32_t PCA9548ACom::read_reg24(uint32_t address)
-{
-  m_com->write_reg8(1<<m_channel);
+uint32_t PCA9548ACom::read_reg24(uint32_t address) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  uint32_t data=0;
-  try
-    {
-      data=m_com->read_reg24(address);
-      m_com->setDeviceAddr(m_muxAddr);
+    m_com->setDeviceAddr(deviceAddr());
+    uint32_t data = 0;
+    try {
+        data = m_com->read_reg24(address);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
-    }
-  return data;
+    return data;
 }
 
-uint16_t PCA9548ACom::read_reg16(uint32_t address)
-{
-  m_com->write_reg8(1<<m_channel);
+uint16_t PCA9548ACom::read_reg16(uint32_t address) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  uint16_t data=0;
-  try
-    {
-      data=m_com->read_reg16(address);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    uint16_t data = 0;
+    try {
+        data = m_com->read_reg16(address);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
-  return data;
+    return data;
 }
 
-uint8_t PCA9548ACom::read_reg8 (uint32_t address)
-{
-  m_com->write_reg8(1<<m_channel);
+uint8_t PCA9548ACom::read_reg8(uint32_t address) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  uint8_t data=0;
-  try
-    {
-      data=m_com->read_reg8 (address);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    uint8_t data = 0;
+    try {
+        data = m_com->read_reg8(address);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
-  return data;
+    return data;
 }
 
-uint32_t PCA9548ACom::read_reg32()
-{
-  m_com->write_reg8(1<<m_channel);
+uint32_t PCA9548ACom::read_reg32() {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  uint32_t data=0;
-  try
-    {
-      data=m_com->read_reg32();
-      m_com->setDeviceAddr(m_muxAddr);
+    m_com->setDeviceAddr(deviceAddr());
+    uint32_t data = 0;
+    try {
+        data = m_com->read_reg32();
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
-    }
-  return data;
+    return data;
 }
 
-uint32_t PCA9548ACom::read_reg24()
-{
-  m_com->write_reg8(1<<m_channel);
+uint32_t PCA9548ACom::read_reg24() {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  uint32_t data=0;
-  try
-    {
-      data=m_com->read_reg24();
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    uint32_t data = 0;
+    try {
+        data = m_com->read_reg24();
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
-  return data;
+    return data;
 }
 
-uint16_t PCA9548ACom::read_reg16()
-{
-  m_com->write_reg8(1<<m_channel);
+uint16_t PCA9548ACom::read_reg16() {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  uint16_t data=0;
-  try
-    {
-      data=m_com->read_reg16();
-      m_com->setDeviceAddr(m_muxAddr);
+    m_com->setDeviceAddr(deviceAddr());
+    uint16_t data = 0;
+    try {
+        data = m_com->read_reg16();
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
-    }
-  return data;
+    return data;
 }
 
-uint8_t PCA9548ACom::read_reg8 ()
-{
-  m_com->write_reg8(1<<m_channel);
+uint8_t PCA9548ACom::read_reg8() {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  uint8_t data=0;
-  try
-    {
-      data=m_com->read_reg8 ();
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    uint8_t data = 0;
+    try {
+        data = m_com->read_reg8();
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
-  return data;
+    return data;
 }
 
-void PCA9548ACom::read_block(uint32_t address, std::vector<uint8_t>& data)
-{
-  m_com->write_reg8(1<<m_channel);
+void PCA9548ACom::read_block(uint32_t address, std::vector<uint8_t>& data) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->read_block(address, data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->read_block(address, data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
 
-void PCA9548ACom::read_block(std::vector<uint8_t>& data)
-{
-  m_com->write_reg8(1<<m_channel);
+void PCA9548ACom::read_block(std::vector<uint8_t>& data) {
+    m_com->write_reg8(1 << m_channel);
 
-  m_com->setDeviceAddr(deviceAddr());
-  try
-    {
-      m_com->read_block(data);
-      m_com->setDeviceAddr(m_muxAddr);
-    }
-  catch(const ComIOException& e)
-    {
-      m_com->setDeviceAddr(m_muxAddr);
-      throw;
+    m_com->setDeviceAddr(deviceAddr());
+    try {
+        m_com->read_block(data);
+        m_com->setDeviceAddr(m_muxAddr);
+    } catch (const ComIOException& e) {
+        m_com->setDeviceAddr(m_muxAddr);
+        throw;
     }
 }
diff --git a/src/libDevCom/PCA9548ACom.h b/src/libDevCom/PCA9548ACom.h
index 41108059..627834e8 100644
--- a/src/libDevCom/PCA9548ACom.h
+++ b/src/libDevCom/PCA9548ACom.h
@@ -10,7 +10,7 @@
  * [Datasheet](https://www.ti.com/lit/ds/symlink/pca9548a.pdf)
  *
  * Implements I2C communicatoin with a device that is connected to the
- * manager using the PCA9548A multiplexer. The I2C calls are forwarded 
+ * manager using the PCA9548A multiplexer. The I2C calls are forwarded
  * to right device using the internal `com` object as follows:
  *
  *  1. Enable only PCA9548A's `channel` output
@@ -18,57 +18,58 @@
  *  3. Perform requested I2C operation using `com`
  *  4. Restore `com` target device address to PCA9548A
  *
- * The internal `com` object should target the PCA9548A device. The 
+ * The internal `com` object should target the PCA9548A device. The
  * device address should not be changed after creating the object, as
  * it is cached by the constructor.
  */
-class PCA9548ACom : public I2CCom
-{
-public:
-  /**
-   * \param deviceAddr Target device address to which all I2C calls are forwarded
-   * \param channel Output channel to which the device is connected to
-   * \param com Internal `com` device targettign the PCA9548A.
-   */
-  PCA9548ACom(uint8_t deviceAddr, uint8_t channel, std::shared_ptr<I2CCom> com);
-  virtual ~PCA9548ACom();
+class PCA9548ACom : public I2CCom {
+ public:
+    /**
+     * \param deviceAddr Target device address to which all I2C calls are
+     * forwarded \param channel Output channel to which the device is connected
+     * to \param com Internal `com` device targettign the PCA9548A.
+     */
+    PCA9548ACom(uint8_t deviceAddr, uint8_t channel,
+                std::shared_ptr<I2CCom> com);
+    virtual ~PCA9548ACom();
 
-  /** Write commands @{ */
+    /** Write commands @{ */
 
-  virtual void write_reg32(uint32_t address, uint32_t data);
-  virtual void write_reg16(uint32_t address, uint16_t data);
-  virtual void write_reg8 (uint32_t address, uint8_t  data);
+    virtual void write_reg32(uint32_t address, uint32_t data);
+    virtual void write_reg16(uint32_t address, uint16_t data);
+    virtual void write_reg8(uint32_t address, uint8_t data);
 
-  virtual void write_reg32(uint32_t data);
-  virtual void write_reg16(uint16_t data);
-  virtual void write_reg8 (uint8_t  data);
+    virtual void write_reg32(uint32_t data);
+    virtual void write_reg16(uint16_t data);
+    virtual void write_reg8(uint8_t data);
 
-  virtual void write_block(uint32_t address, const std::vector<uint8_t>& data);
-  virtual void write_block(const std::vector<uint8_t>& data);
+    virtual void write_block(uint32_t address,
+                             const std::vector<uint8_t>& data);
+    virtual void write_block(const std::vector<uint8_t>& data);
 
-  /** @} */
+    /** @} */
 
-  /** Read commands @{ */
+    /** Read commands @{ */
 
-  virtual uint32_t read_reg32(uint32_t address);
-  virtual uint32_t read_reg24(uint32_t address);
-  virtual uint16_t read_reg16(uint32_t address);
-  virtual uint8_t  read_reg8 (uint32_t address);
+    virtual uint32_t read_reg32(uint32_t address);
+    virtual uint32_t read_reg24(uint32_t address);
+    virtual uint16_t read_reg16(uint32_t address);
+    virtual uint8_t read_reg8(uint32_t address);
 
-  virtual uint32_t read_reg32();
-  virtual uint32_t read_reg24();
-  virtual uint16_t read_reg16();
-  virtual uint8_t  read_reg8 ();
+    virtual uint32_t read_reg32();
+    virtual uint32_t read_reg24();
+    virtual uint16_t read_reg16();
+    virtual uint8_t read_reg8();
 
-  virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
-  virtual void read_block(std::vector<uint8_t>& data);
+    virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
+    virtual void read_block(std::vector<uint8_t>& data);
 
-  /** @} */
+    /** @} */
 
-private:
-  std::shared_ptr<I2CCom> m_com;
-  uint8_t m_muxAddr;
-  uint8_t m_channel;
+ private:
+    std::shared_ptr<I2CCom> m_com;
+    uint8_t m_muxAddr;
+    uint8_t m_channel;
 };
 
-#endif // PCA9548ACOM_H
+#endif  // PCA9548ACOM_H
diff --git a/src/libDevCom/PGA11x.cpp b/src/libDevCom/PGA11x.cpp
index bad3218c..49440eb8 100644
--- a/src/libDevCom/PGA11x.cpp
+++ b/src/libDevCom/PGA11x.cpp
@@ -1,10 +1,5 @@
 #include "PGA11x.h"
 
-PGA11x::PGA11x(std::shared_ptr<SPICom> com)
-  : m_com(com)
-{ }
+PGA11x::PGA11x(std::shared_ptr<SPICom> com) : m_com(com) {}
 
-void PGA11x::select(uint32_t ch)
-{
-  m_com->write_reg16(0x2A00 | ch&0xF);
-}
+void PGA11x::select(uint32_t ch) { m_com->write_reg16(0x2A00 | ch & 0xF); }
diff --git a/src/libDevCom/PGA11x.h b/src/libDevCom/PGA11x.h
index 0c240862..e721b0a3 100644
--- a/src/libDevCom/PGA11x.h
+++ b/src/libDevCom/PGA11x.h
@@ -10,16 +10,15 @@
  *
  * [Datasheet](https://www.ti.com/lit/ds/symlink/pga117.pdf)
  */
-class PGA11x : public MuxDevice
-{
-public:
-  PGA11x(std::shared_ptr<SPICom> com);
-  ~PGA11x() =default;
+class PGA11x : public MuxDevice {
+ public:
+    PGA11x(std::shared_ptr<SPICom> com);
+    ~PGA11x() = default;
 
-  virtual void select(uint32_t ch);
+    virtual void select(uint32_t ch);
 
-private:
-  std::shared_ptr<SPICom> m_com;
+ private:
+    std::shared_ptr<SPICom> m_com;
 };
 
-#endif // PGA11x_H
+#endif  // PGA11x_H
diff --git a/src/libDevCom/PtSensor.cpp b/src/libDevCom/PtSensor.cpp
index 35c71cc8..361a892c 100644
--- a/src/libDevCom/PtSensor.cpp
+++ b/src/libDevCom/PtSensor.cpp
@@ -1,53 +1,51 @@
 #include "PtSensor.h"
 
-#include "NotSupportedException.h"
-
 #include <cmath>
 
-PtSensor::PtSensor(uint8_t chan, std::shared_ptr<ADCDevice> dev, float Rref, float Apt, float Bpt, float Rdiv)
-  : m_adcdev(dev), m_chan(chan), m_Rref(Rref), m_Apt(Apt), m_Bpt(Bpt), m_Rdiv(Rdiv)
-{ }
+#include "NotSupportedException.h"
 
-PtSensor::~PtSensor()
-{ }
+PtSensor::PtSensor(uint8_t chan, std::shared_ptr<ADCDevice> dev, float Rref,
+                   float Apt, float Bpt, float Rdiv)
+    : m_adcdev(dev),
+      m_chan(chan),
+      m_Rref(Rref),
+      m_Apt(Apt),
+      m_Bpt(Bpt),
+      m_Rdiv(Rdiv) {}
 
-void PtSensor::init()
-{ }
+PtSensor::~PtSensor() {}
 
-void PtSensor::reset()
-{ }
+void PtSensor::init() {}
 
-void PtSensor::read()
-{
-  m_temperature=0.;
-  for(uint i=0;i<10;i++)
-    m_temperature+=(float)m_adcdev->read(m_chan);
-  m_temperature/=10;
-  m_temperature=raw_to_C(m_temperature);
-}
+void PtSensor::reset() {}
 
-float PtSensor::temperature() const
-{
-  return m_temperature;
+void PtSensor::read() {
+    m_temperature = 0.;
+    for (uint i = 0; i < 10; i++)
+        m_temperature += static_cast<float>(m_adcdev)->read(m_chan);
+    m_temperature /= 10;
+    m_temperature = raw_to_C(m_temperature);
 }
 
-float PtSensor::humidity() const
-{
-  throw NotSupportedException("Humidity not supported for Pt");
-  return 0;
+float PtSensor::temperature() const { return m_temperature; }
+
+float PtSensor::humidity() const {
+    throw NotSupportedException("Humidity not supported for Pt");
+    return 0;
 }
 
-float PtSensor::pressure() const
-{
-  throw NotSupportedException("Pressure not supported for Pt");
-  return 0;
+float PtSensor::pressure() const {
+    throw NotSupportedException("Pressure not supported for Pt");
+    return 0;
 }
 
-float PtSensor::raw_to_C(float raw)
-{
-  // If there is a reading error, return a default value
-  if(raw>=1.) return -273.15;
-  float res = m_Apt*m_Apt-4.*m_Bpt*(1.-m_Rdiv/m_Rref*(1./raw-1.));
-  if(res<0.) return -273.15;
-  else return (std::sqrt(res)-m_Apt)/2./m_Bpt;
+float PtSensor::raw_to_C(float raw) {
+    // If there is a reading error, return a default value
+    if (raw >= 1.) return -273.15;
+    float res =
+        m_Apt * m_Apt - 4. * m_Bpt * (1. - m_Rdiv / m_Rref * (1. / raw - 1.));
+    if (res < 0.)
+        return -273.15;
+    else
+        return (std::sqrt(res) - m_Apt) / 2. / m_Bpt;
 }
diff --git a/src/libDevCom/PtSensor.h b/src/libDevCom/PtSensor.h
index b4e45941..b8426f84 100644
--- a/src/libDevCom/PtSensor.h
+++ b/src/libDevCom/PtSensor.h
@@ -1,69 +1,69 @@
 #ifndef PTSENSOR_H
 #define PTSENSOR_H
 
-#include <string>
 #include <cstdint>
+#include <string>
 
-#include "ClimateSensor.h"
 #include "ADCDevice.h"
+#include "ClimateSensor.h"
 
-//! \brief An implementation of 'ClimateSensor' for reading an Pt temperature sensor
+//! \brief An implementation of 'ClimateSensor' for reading an Pt temperature
+//! sensor
 /**
- * Measures temperature using an Pt sensor (Pt100, Pt1000 etc.) connected to one of the 
- * analog channelss on an Arduino via an ADC intereface.
- * PT sensors are available from various sources; this code was tested with a Pt1000 from TE -
+ * Measures temperature using an Pt sensor (Pt100, Pt1000 etc.) connected to one
+ * of the analog channelss on an Arduino via an ADC intereface. PT sensors are
+ * available from various sources; this code was tested with a Pt1000 from TE -
  * specs: https://www.te.com/global-en/product-NB-PTCO-157.html
  */
-class PtSensor : public ClimateSensor
-{
-public:
-  /**
-   * \param chan The channel number of the analog channel connected to the Pt
-   * \param dev The ADCDevice for interfacing with the Adruino or similar - should be calibrated
-   *        to return measured voltage as 0...100% of the operational voltage
-   * \param Rref The Pt's resistance at 0degC
-   * \param Apt The value of the linear calibration coefficient
-   * \param Bpt The value of the quadratic calibration coefficient
-   * \param Rdiv The resistance of the resistor in the voltage divider
-   *   (the Pt and the resistor)
-   */
-  PtSensor(uint8_t chan, std::shared_ptr<ADCDevice> dev, float Rref=1.e3, 
-	   float Apt=3.9083e-3, float Bpt=-5.775e-7, float Rdiv=1.e3);
-  virtual ~PtSensor();
+class PtSensor : public ClimateSensor {
+ public:
+    /**
+     * \param chan The channel number of the analog channel connected to the Pt
+     * \param dev The ADCDevice for interfacing with the Adruino or similar -
+     * should be calibrated to return measured voltage as 0...100% of the
+     * operational voltage \param Rref The Pt's resistance at 0degC \param Apt
+     * The value of the linear calibration coefficient \param Bpt The value of
+     * the quadratic calibration coefficient \param Rdiv The resistance of the
+     * resistor in the voltage divider (the Pt and the resistor)
+     */
+    PtSensor(uint8_t chan, std::shared_ptr<ADCDevice> dev, float Rref = 1.e3,
+             float Apt = 3.9083e-3, float Bpt = -5.775e-7, float Rdiv = 1.e3);
+    virtual ~PtSensor();
 
-  //! Does nothing (requried to implement ClimateSensor)
-  virtual void init();
-  //! Does nothing (required to implement ClimateSensor)
-  virtual void reset();
-  //! Reads the temperature from the NTC and stores it in m_temperature
-  virtual void read();
+    //! Does nothing (requried to implement ClimateSensor)
+    virtual void init();
+    //! Does nothing (required to implement ClimateSensor)
+    virtual void reset();
+    //! Reads the temperature from the NTC and stores it in m_temperature
+    virtual void read();
 
-  //! Returns the temperature (in Celsius) from the most recent reading
-  //  (defaults to -273.15)
-  virtual float temperature() const;
-  //! Throws a Not Supported exception (required to implement ClimateSensor)
-  virtual float humidity() const;
-  //! Throws a Not Supported exception (required to implement ClimateSensor
-  virtual float pressure() const;
+    //! Returns the temperature (in Celsius) from the most recent reading
+    //  (defaults to -273.15)
+    virtual float temperature() const;
+    //! Throws a Not Supported exception (required to implement ClimateSensor)
+    virtual float humidity() const;
+    //! Throws a Not Supported exception (required to implement ClimateSensor
+    virtual float pressure() const;
 
-private:
-  //! Interface with the Arduino via the ADC protocol
-  std::shared_ptr<ADCDevice> m_adcdev;
-  //! The resistance of the Pt at 0degC
-  float m_Rref;
-  //! The value of the linear calibration coefficient
-  float m_Apt;
-  //! The value of the quadratic calibration coefficient
-  float m_Bpt;
-  //! The resistance of the resistor in the voltage divider circuit
-  float m_Rdiv;
-  //! The channel of the ADCS connected to the Pt
-  uint8_t m_chan;
-  //! The temperature recorded in the last reading (defaults to -273.15)
-  float m_temperature = -273.15;
+ private:
+    //! Interface with the Arduino via the ADC protocol
+    std::shared_ptr<ADCDevice> m_adcdev;
+    //! The resistance of the Pt at 0degC
+    float m_Rref;
+    //! The value of the linear calibration coefficient
+    float m_Apt;
+    //! The value of the quadratic calibration coefficient
+    float m_Bpt;
+    //! The resistance of the resistor in the voltage divider circuit
+    float m_Rdiv;
+    //! The channel of the ADCS connected to the Pt
+    uint8_t m_chan;
+    //! The temperature recorded in the last reading (defaults to -273.15)
+    float m_temperature = -273.15;
 
-  //! Converts from the raw readout of the Arduino channel to temperature in Celsius
-  float raw_to_C(float volt);
+    //! Converts from the raw readout of the Arduino channel to temperature in
+    //! Celsius
+    float raw_to_C(float volt);
 };
 
-#endif // PTSENSOR_H
+#endif  // PTSENSOR_H
diff --git a/src/libDevCom/SHT85.cpp b/src/libDevCom/SHT85.cpp
index 6fa1b0e4..a06a2d6c 100644
--- a/src/libDevCom/SHT85.cpp
+++ b/src/libDevCom/SHT85.cpp
@@ -1,75 +1,62 @@
 #include "SHT85.h"
 
-#include <unistd.h>
 #include <math.h>
+#include <unistd.h>
 
-#include "NotSupportedException.h"
 #include "ChecksumException.h"
+#include "NotSupportedException.h"
+
+SHT85::SHT85(std::shared_ptr<I2CCom> i2c) : m_i2c(i2c) {}
 
-SHT85::SHT85(std::shared_ptr<I2CCom> i2c)
-  : m_i2c(i2c)
-{ }
+SHT85::~SHT85() {}
 
-SHT85::~SHT85()
-{ }
+void SHT85::init() {}
 
-void SHT85::init()
-{ }
+void SHT85::reset() {}
 
-void SHT85::reset()
-{ }
+void SHT85::read() {
+    m_i2c->write_reg16(0x2400);
+    usleep(1000e3);
 
-void SHT85::read()
-{
-  m_i2c->write_reg16(0x2400);
-  usleep(1000e3);
+    std::vector<uint8_t> data(6);
+    m_i2c->read_block(data);
+
+    uint16_t tdata = ((data[0]) << 8) | data[1];
+    uint8_t tcrc = calcCRC(data[0], data[1], data[2]);
+    if (tcrc) throw ChecksumException(tcrc);
+
+    uint16_t hdata = ((data[3]) << 8) | data[4];
+    uint8_t hcrc = calcCRC(data[3], data[4], data[5]);
+    if (hcrc) throw ChecksumException(hcrc);
+
+    // Parse the data
+    m_humidity = 100 * (static_cast<float>(hdata)) / (pow(2, 16) - 1.);
+    m_temperature = -45 + 175 * (static_cast<float>(tdata)) / (pow(2, 16) - 1.);
+}
 
-  std::vector<uint8_t> data(6);
-  m_i2c->read_block(data);
+uint SHT85::status() const { return m_status; }
 
-  uint16_t tdata=((data[0])<<8)|data[1];
-  uint8_t tcrc=calcCRC(data[0],data[1],data[2]);
-  if(tcrc)
-    throw ChecksumException(tcrc);
+float SHT85::temperature() const { return m_temperature; }
 
-  uint16_t hdata=((data[3])<<8)|data[4];
-  uint8_t hcrc=calcCRC(data[3],data[4],data[5]);
-  if(hcrc)
-    throw ChecksumException(hcrc);
+float SHT85::humidity() const { return m_humidity; }
 
-  // Parse the data
-  m_humidity=100*((float)hdata)/(pow(2,16)-1.);
-  m_temperature=-45+175*((float)tdata)/(pow(2,16)-1.);
+float SHT85::pressure() const {
+    throw NotSupportedException("SHT85 does not have a pressure sensor");
+    return 0;
 }
 
-uint SHT85::status() const
-{ return m_status; }
-
-float SHT85::temperature() const
-{ return m_temperature; }
-
-float SHT85::humidity() const
-{ return m_humidity; }
-
-float SHT85::pressure() const
-{ throw NotSupportedException("SHT85 does not have a pressure sensor"); return 0; }
-
-uint8_t SHT85::calcCRC(uint8_t byte0,uint8_t byte1,uint8_t crc) const
-{
-  static const uint8_t poly=0x31;
-  uint16_t reg=0xFF^byte0;
-
-  uint8_t bytes[]={byte1, crc};
-  for(uint32_t b=0;b<2;b++)
-    {
-      for(uint32_t bit=0;bit<8;bit++)
-	{
-	  // shift the bit in
-	  reg=(reg<<1)|(((bytes[b]>>(7-bit)))&1);
-	  if(reg&0x100)
-	    reg^=poly;
-	}
+uint8_t SHT85::calcCRC(uint8_t byte0, uint8_t byte1, uint8_t crc) const {
+    static const uint8_t poly = 0x31;
+    uint16_t reg = 0xFF ^ byte0;
+
+    uint8_t bytes[] = {byte1, crc};
+    for (uint32_t b = 0; b < 2; b++) {
+        for (uint32_t bit = 0; bit < 8; bit++) {
+            // shift the bit in
+            reg = (reg << 1) | (((bytes[b] >> (7 - bit))) & 1);
+            if (reg & 0x100) reg ^= poly;
+        }
     }
 
-  return (reg&0xFF);
+    return (reg & 0xFF);
 }
diff --git a/src/libDevCom/SHT85.h b/src/libDevCom/SHT85.h
index 891fb61f..daa7e9a6 100644
--- a/src/libDevCom/SHT85.h
+++ b/src/libDevCom/SHT85.h
@@ -1,38 +1,37 @@
 #ifndef SHT85_H
 #define SHT85_H
 
+#include <memory>
+
 #include "ClimateSensor.h"
 #include "I2CCom.h"
 
-#include <memory>
-
 /**
  * The SHT85 climate sensor.
  * [Datasheet](https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/2_Humidity_Sensors/Datasheets/Sensirion_Humidity_Sensors_SHT85_Datasheet.pdf)
  */
-class SHT85 : public ClimateSensor
-{
-public:
-  SHT85(std::shared_ptr<I2CCom> i2c);
-  virtual ~SHT85();
+class SHT85 : public ClimateSensor {
+ public:
+    SHT85(std::shared_ptr<I2CCom> i2c);
+    virtual ~SHT85();
 
-  virtual void init();
-  virtual void reset();
-  virtual void read();
+    virtual void init();
+    virtual void reset();
+    virtual void read();
 
-  virtual unsigned status() const;
-  virtual float temperature() const;
-  virtual float humidity() const;
-  virtual float pressure() const;
+    virtual unsigned status() const;
+    virtual float temperature() const;
+    virtual float humidity() const;
+    virtual float pressure() const;
 
-private:
-  std::shared_ptr<I2CCom> m_i2c;
+ private:
+    std::shared_ptr<I2CCom> m_i2c;
 
-  int m_status;
-  float m_temperature;
-  float m_humidity;
+    int m_status;
+    float m_temperature;
+    float m_humidity;
 
-  uint8_t calcCRC(uint8_t byte0,uint8_t byte1,uint8_t crc) const;
+    uint8_t calcCRC(uint8_t byte0, uint8_t byte1, uint8_t crc) const;
 };
 
-#endif // SHT85_H
+#endif  // SHT85_H
diff --git a/src/libDevCom/SPICom.h b/src/libDevCom/SPICom.h
index 6367c5dc..627d4ce1 100644
--- a/src/libDevCom/SPICom.h
+++ b/src/libDevCom/SPICom.h
@@ -1,16 +1,15 @@
 #ifndef SPICOM_H
 #define SPICOM_H
 
-#include "DeviceCom.h"
-
 #include <string>
 #include <vector>
 
-class SPICom : public DeviceCom
-{
-public:
-  SPICom();
-  virtual ~SPICom();
+#include "DeviceCom.h"
+
+class SPICom : public DeviceCom {
+ public:
+    SPICom();
+    virtual ~SPICom();
 };
 
-#endif // SPICOM_H
+#endif  // SPICOM_H
diff --git a/src/libDevCom/SPIDevCom.cpp b/src/libDevCom/SPIDevCom.cpp
index f6afc8cf..e074c5ce 100644
--- a/src/libDevCom/SPIDevCom.cpp
+++ b/src/libDevCom/SPIDevCom.cpp
@@ -1,153 +1,131 @@
 #include "SPIDevCom.h"
 
+#include <fcntl.h>
 #include <linux/spi/spidev.h>
-
 #include <sys/ioctl.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
+#include <sys/types.h>
 
 #include <cstring>
 
 #include "ComIOException.h"
 
-SPIDevCom::SPIDevCom(const std::string& spidev)
-  : SPICom()
-{
-  m_fh = open(spidev.c_str(), O_RDWR);
-  if(m_fh<0)
-    throw ComIOException(std::string("SPIDevCom open failed: ")+std::strerror(errno));
+SPIDevCom::SPIDevCom(const std::string& spidev) : SPICom() {
+    m_fh = open(spidev.c_str(), O_RDWR);
+    if (m_fh < 0)
+        throw ComIOException(std::string("SPIDevCom open failed: ") +
+                             std::strerror(errno));
 }
 
-SPIDevCom::~SPIDevCom()
-{ }
+SPIDevCom::~SPIDevCom() {}
 
-void SPIDevCom::write_reg32(uint32_t address, uint32_t data)
-{
-  write_block(address,
-	      {static_cast<uint8_t>((data>>24)&0xFF),
-		  static_cast<uint8_t>((data>>16)&0xFF),
-		  static_cast<uint8_t>((data>> 8)&0xFF),
-		  static_cast<uint8_t>((data>> 0)&0xFF)});
+void SPIDevCom::write_reg32(uint32_t address, uint32_t data) {
+    write_block(address, {static_cast<uint8_t>((data >> 24) & 0xFF),
+                          static_cast<uint8_t>((data >> 16) & 0xFF),
+                          static_cast<uint8_t>((data >> 8) & 0xFF),
+                          static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void SPIDevCom::write_reg16(uint32_t address, uint16_t data)
-{
-  write_block(address,
-	      {static_cast<uint8_t>((data>> 8)&0xFF),
-		  static_cast<uint8_t>((data>> 0)&0xFF)});
+void SPIDevCom::write_reg16(uint32_t address, uint16_t data) {
+    write_block(address, {static_cast<uint8_t>((data >> 8) & 0xFF),
+                          static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void SPIDevCom::write_reg8 (uint32_t address, uint8_t  data)
-{
-  write_block(address,{data});
+void SPIDevCom::write_reg8(uint32_t address, uint8_t data) {
+    write_block(address, {data});
 }
 
-void SPIDevCom::write_reg32(uint32_t data)
-{
-  write_block({static_cast<uint8_t>((data>>24)&0xFF),
-  	static_cast<uint8_t>((data>>16)&0xFF),
-  	static_cast<uint8_t>((data>> 8)&0xFF),
-  	static_cast<uint8_t>((data>> 0)&0xFF)});
+void SPIDevCom::write_reg32(uint32_t data) {
+    write_block({static_cast<uint8_t>((data >> 24) & 0xFF),
+                 static_cast<uint8_t>((data >> 16) & 0xFF),
+                 static_cast<uint8_t>((data >> 8) & 0xFF),
+                 static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void SPIDevCom::write_reg16(uint16_t data)
-{
-  write_block({static_cast<uint8_t>((data>> 8)&0xFF),
-	static_cast<uint8_t>((data>> 0)&0xFF)});
+void SPIDevCom::write_reg16(uint16_t data) {
+    write_block({static_cast<uint8_t>((data >> 8) & 0xFF),
+                 static_cast<uint8_t>((data >> 0) & 0xFF)});
 }
 
-void SPIDevCom::write_reg8 (uint8_t  data)
-{
-  write_block({data});
-}
+void SPIDevCom::write_reg8(uint8_t data) { write_block({data}); }
 
-void SPIDevCom::write_block(uint32_t address, const std::vector<uint8_t>& data)
-{
-  std::vector<uint8_t> inbuf=data;
-  inbuf.insert(inbuf.begin(),static_cast<uint8_t>(address&0xFF));
+void SPIDevCom::write_block(uint32_t address,
+                            const std::vector<uint8_t>& data) {
+    std::vector<uint8_t> inbuf = data;
+    inbuf.insert(inbuf.begin(), static_cast<uint8_t>(address & 0xFF));
 
-  write_block(inbuf);
+    write_block(inbuf);
 }
 
-void SPIDevCom::write_block(const std::vector<uint8_t>& data)
-{
-  struct spi_ioc_transfer msgs[1];
-  memset(msgs, 0, sizeof msgs);
+void SPIDevCom::write_block(const std::vector<uint8_t>& data) {
+    struct spi_ioc_transfer msgs[1];
+    memset(msgs, 0, sizeof msgs);
 
-  msgs[0].tx_buf = (unsigned long)&data[0];
-  msgs[0].len = data.size();
+    msgs[0].tx_buf = (unsigned long)&data[0];
+    msgs[0].len = data.size();
 
-  if (ioctl(m_fh, SPI_IOC_MESSAGE(1), &msgs) < 0)
-    throw ComIOException(std::string("SPIDevCom write_reg32 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, SPI_IOC_MESSAGE(1), &msgs) < 0)
+        throw ComIOException(std::string("SPIDevCom write_reg32 failed: ") +
+                             std::strerror(errno));
 }
 
-uint32_t SPIDevCom::read_reg32(uint32_t address)
-{
-  write_reg8(address&0xFF);
-  return read_reg32();
+uint32_t SPIDevCom::read_reg32(uint32_t address) {
+    write_reg8(address & 0xFF);
+    return read_reg32();
 }
 
-uint32_t SPIDevCom::read_reg24(uint32_t address)
-{
-  write_reg8(address&0xFF);
-  return read_reg24();
+uint32_t SPIDevCom::read_reg24(uint32_t address) {
+    write_reg8(address & 0xFF);
+    return read_reg24();
 }
 
-uint16_t SPIDevCom::read_reg16(uint32_t address)
-{
-  write_reg8(address&0xFF);
-  return read_reg16();
+uint16_t SPIDevCom::read_reg16(uint32_t address) {
+    write_reg8(address & 0xFF);
+    return read_reg16();
 }
 
-uint8_t  SPIDevCom::read_reg8 (uint32_t address)
-{
-  write_reg8(address&0xFF);
-  return read_reg8();
+uint8_t SPIDevCom::read_reg8(uint32_t address) {
+    write_reg8(address & 0xFF);
+    return read_reg8();
 }
 
-uint32_t SPIDevCom::read_reg32()
-{
-  std::vector<uint8_t> data(4);
-  read_block(data);
-  return (data[0]<<24|data[1]<<16|data[2]<<8|data[3]);
+uint32_t SPIDevCom::read_reg32() {
+    std::vector<uint8_t> data(4);
+    read_block(data);
+    return (data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]);
 }
 
-uint32_t SPIDevCom::read_reg24()
-{
-  std::vector<uint8_t> data(3);
-  read_block(data);
-  return (data[0]<<16|data[1]<<8|data[2]);
+uint32_t SPIDevCom::read_reg24() {
+    std::vector<uint8_t> data(3);
+    read_block(data);
+    return (data[0] << 16 | data[1] << 8 | data[2]);
 }
 
-uint16_t SPIDevCom::read_reg16()
-{
-  std::vector<uint8_t> data(2);
-  read_block(data);
-  return (data[0]<<8|data[1]);
+uint16_t SPIDevCom::read_reg16() {
+    std::vector<uint8_t> data(2);
+    read_block(data);
+    return (data[0] << 8 | data[1]);
 }
 
-uint8_t  SPIDevCom::read_reg8 ()
-{
-  std::vector<uint8_t> data(1);
-  read_block(data);
-  return data[0];
+uint8_t SPIDevCom::read_reg8() {
+    std::vector<uint8_t> data(1);
+    read_block(data);
+    return data[0];
 }
 
-void SPIDevCom::read_block(uint32_t address, std::vector<uint8_t>& data)
-{
-  write_reg8(address&0xFF);
-  read_block(data);
+void SPIDevCom::read_block(uint32_t address, std::vector<uint8_t>& data) {
+    write_reg8(address & 0xFF);
+    read_block(data);
 }
 
-void SPIDevCom::read_block(std::vector<uint8_t>& data)
-{
-  struct spi_ioc_transfer msgs[1];
-  memset(msgs, 0, sizeof msgs);
+void SPIDevCom::read_block(std::vector<uint8_t>& data) {
+    struct spi_ioc_transfer msgs[1];
+    memset(msgs, 0, sizeof msgs);
 
-  msgs[0].rx_buf =(unsigned long)&data[0];
-  msgs[0].len = data.size();
+    msgs[0].rx_buf = (unsigned long)&data[0];
+    msgs[0].len = data.size();
 
-  if (ioctl(m_fh, SPI_IOC_MESSAGE(1), &msgs) < 0)
-    throw ComIOException(std::string("SPIDevCom read_reg16 failed: ")+std::strerror(errno));
+    if (ioctl(m_fh, SPI_IOC_MESSAGE(1), &msgs) < 0)
+        throw ComIOException(std::string("SPIDevCom read_reg16 failed: ") +
+                             std::strerror(errno));
 }
diff --git a/src/libDevCom/SPIDevCom.h b/src/libDevCom/SPIDevCom.h
index e7b02fc0..615f7522 100644
--- a/src/libDevCom/SPIDevCom.h
+++ b/src/libDevCom/SPIDevCom.h
@@ -9,45 +9,45 @@
  * Linux [spidev](https://www.kernel.org/doc/Documentation/spi/spidev)
  * driver.
  */
-class SPIDevCom : public SPICom
-{
-public:
-  /**
-   * \param spidev Path to device file for the corresponding SPI device/
-   */
-  SPIDevCom(const std::string& spidev);
-  virtual ~SPIDevCom();
-
-  //
-  // Write commands
-  virtual void write_reg32(uint32_t address, uint32_t data);
-  virtual void write_reg16(uint32_t address, uint16_t data);
-  virtual void write_reg8 (uint32_t address, uint8_t  data);
-
-  virtual void write_reg32(uint32_t data);
-  virtual void write_reg16(uint16_t data);
-  virtual void write_reg8 (uint8_t  data);
-
-  virtual void write_block(uint32_t address, const std::vector<uint8_t>& data);
-  virtual void write_block(const std::vector<uint8_t>& data);
-
-  //
-  // Read commands
-  virtual uint32_t read_reg32(uint32_t address);
-  virtual uint32_t read_reg24(uint32_t address);
-  virtual uint16_t read_reg16(uint32_t address);
-  virtual uint8_t  read_reg8 (uint32_t address);
-
-  virtual uint32_t read_reg32();
-  virtual uint32_t read_reg24();
-  virtual uint16_t read_reg16();
-  virtual uint8_t  read_reg8 ();
-
-  virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
-  virtual void read_block(std::vector<uint8_t>& data);
-  
-private:
-  int m_fh =0;
+class SPIDevCom : public SPICom {
+ public:
+    /**
+     * \param spidev Path to device file for the corresponding SPI device/
+     */
+    SPIDevCom(const std::string& spidev);
+    virtual ~SPIDevCom();
+
+    //
+    // Write commands
+    virtual void write_reg32(uint32_t address, uint32_t data);
+    virtual void write_reg16(uint32_t address, uint16_t data);
+    virtual void write_reg8(uint32_t address, uint8_t data);
+
+    virtual void write_reg32(uint32_t data);
+    virtual void write_reg16(uint16_t data);
+    virtual void write_reg8(uint8_t data);
+
+    virtual void write_block(uint32_t address,
+                             const std::vector<uint8_t>& data);
+    virtual void write_block(const std::vector<uint8_t>& data);
+
+    //
+    // Read commands
+    virtual uint32_t read_reg32(uint32_t address);
+    virtual uint32_t read_reg24(uint32_t address);
+    virtual uint16_t read_reg16(uint32_t address);
+    virtual uint8_t read_reg8(uint32_t address);
+
+    virtual uint32_t read_reg32();
+    virtual uint32_t read_reg24();
+    virtual uint16_t read_reg16();
+    virtual uint8_t read_reg8();
+
+    virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
+    virtual void read_block(std::vector<uint8_t>& data);
+
+ private:
+    int m_fh = 0;
 };
 
-#endif // SPIDEVCOM_H
+#endif  // SPIDEVCOM_H
diff --git a/src/libDevCom/Si7021.cpp b/src/libDevCom/Si7021.cpp
index e0fed265..6951f212 100644
--- a/src/libDevCom/Si7021.cpp
+++ b/src/libDevCom/Si7021.cpp
@@ -1,71 +1,70 @@
 #include "Si7021.h"
-#include "Logger.h"
 
-#include <unistd.h>
 #include <math.h>
+#include <unistd.h>
+
 #include <iomanip>
 
-#include "NotSupportedException.h"
 #include "ChecksumException.h"
+#include "Logger.h"
+#include "NotSupportedException.h"
 
-Si7021::Si7021(std::shared_ptr<I2CCom> i2c)
-  : m_i2c(i2c)
-{ }
+Si7021::Si7021(std::shared_ptr<I2CCom> i2c) : m_i2c(i2c) {}
 
-Si7021::~Si7021()
-{ }
+Si7021::~Si7021() {}
 
-void Si7021::init()
-{
-}
+void Si7021::init() {}
+
+void Si7021::reset() {
+    // send reset command
+    m_i2c->write_reg8(0xFE);
 
-void Si7021::reset()
-{ 
-  //send reset command 
-  m_i2c->write_reg8(0xFE);
-
-  //read user register
-  m_i2c->write_reg8(0xE7);
-  uint8_t user_register = m_i2c->read_reg8();
-  
-  if (user_register!= 0x3A){
-    logger(logWARNING)<<"Something wrong with reset command. User registers read: 0x"<< std::hex<< std::setw(4)<< std::setfill('0')<< user_register;    
-  }
-  
+    // read user register
+    m_i2c->write_reg8(0xE7);
+    uint8_t user_register = m_i2c->read_reg8();
+
+    if (user_register != 0x3A) {
+        logger(logWARNING)
+            << "Something wrong with reset command. User registers read: 0x"
+            << std::hex << std::setw(4) << std::setfill('0') << user_register;
+    }
 }
 
-void Si7021::read()
-{
-  
-  m_i2c->write_reg8(0xF5);
-  uint32_t humidity_data = m_i2c->read_reg24();
-
-  // Parse the data
-  uint16_t humidata=(humidity_data   >> 8) & 0xffff;
-  m_humidity = humidata;
-  m_humidity *= 125;
-  m_humidity /= 65536;
-  m_humidity -= 6;
-  logger (logDEBUG3) << __PRETTY_FUNCTION__ <<"Relative Humidity raw data: 0x" << std::hex << std::setw(4) << std::setfill('0') << humidata << std::dec << " Relative Humidity value: " << m_humidity <<  "%";
-
-  m_i2c->write_reg8(0xE0);
-  uint32_t temperature_data = m_i2c->read_reg24();
-
-  uint16_t tempdata=(temperature_data>> 8) & 0xffff;
-  
-  m_temperature = tempdata;
-  m_temperature *= 175.72;
-  m_temperature /= 65536;
-  m_temperature -= 46.85;
-  logger (logDEBUG3) << __PRETTY_FUNCTION__ <<"Temperature raw data: 0x" << std::hex << std::setw(4) << std::setfill('0') << tempdata << std::dec << " Temperature value: " << m_temperature << " C" ;
+void Si7021::read() {
+    m_i2c->write_reg8(0xF5);
+    uint32_t humidity_data = m_i2c->read_reg24();
+
+    // Parse the data
+    uint16_t humidata = (humidity_data >> 8) & 0xffff;
+    m_humidity = humidata;
+    m_humidity *= 125;
+    m_humidity /= 65536;
+    m_humidity -= 6;
+    logger(logDEBUG3) << __PRETTY_FUNCTION__ << "Relative Humidity raw data: 0x"
+                      << std::hex << std::setw(4) << std::setfill('0')
+                      << humidata << std::dec
+                      << " Relative Humidity value: " << m_humidity << "%";
 
+    m_i2c->write_reg8(0xE0);
+    uint32_t temperature_data = m_i2c->read_reg24();
+
+    uint16_t tempdata = (temperature_data >> 8) & 0xffff;
+
+    m_temperature = tempdata;
+    m_temperature *= 175.72;
+    m_temperature /= 65536;
+    m_temperature -= 46.85;
+    logger(logDEBUG3) << __PRETTY_FUNCTION__ << "Temperature raw data: 0x"
+                      << std::hex << std::setw(4) << std::setfill('0')
+                      << tempdata << std::dec
+                      << " Temperature value: " << m_temperature << " C";
 }
 
-float Si7021::temperature() const
-{return m_temperature; }
+float Si7021::temperature() const { return m_temperature; }
 
-float Si7021::humidity() const
-{ return m_humidity; }
+float Si7021::humidity() const { return m_humidity; }
 
-float Si7021::pressure() const
-{ throw NotSupportedException("Si7021 does not have a pressure sensor"); return 0; }
+float Si7021::pressure() const {
+    throw NotSupportedException("Si7021 does not have a pressure sensor");
+    return 0;
+}
diff --git a/src/libDevCom/Si7021.h b/src/libDevCom/Si7021.h
index 2d38b3cb..10c5d535 100644
--- a/src/libDevCom/Si7021.h
+++ b/src/libDevCom/Si7021.h
@@ -1,38 +1,36 @@
 #ifndef AdafruitSi7021_H
 #define AdafruitSi7021_H
 
+#include <memory>
+
 #include "ClimateSensor.h"
 #include "I2CCom.h"
-
-#include <memory>
 /** \brief Si7021
  *
  * Implementation for the Si7021 humiidity/temperature sensor
  *
- * [Progamming Manual](https://www.silabs.com/documents/public/data-sheets/Si7021-A20.pdf)
+ * [Progamming
+ * Manual](https://www.silabs.com/documents/public/data-sheets/Si7021-A20.pdf)
  */
 
-class Si7021 : public ClimateSensor
-{
-public:
-  Si7021(std::shared_ptr<I2CCom> i2c);
-  virtual ~Si7021();
-
-  virtual void init();
-  virtual void reset();
-  virtual void read();
-
-  virtual float temperature() const;
-  virtual float humidity() const;
-  virtual float pressure() const;
-private:
-  std::shared_ptr<I2CCom> m_i2c;
-
-  float m_temperature;
-  float m_humidity;
-  
-  
-};
+class Si7021 : public ClimateSensor {
+ public:
+    Si7021(std::shared_ptr<I2CCom> i2c);
+    virtual ~Si7021();
 
-#endif // Si7021_H
+    virtual void init();
+    virtual void reset();
+    virtual void read();
+
+    virtual float temperature() const;
+    virtual float humidity() const;
+    virtual float pressure() const;
+
+ private:
+    std::shared_ptr<I2CCom> m_i2c;
+
+    float m_temperature;
+    float m_humidity;
+};
 
+#endif  // Si7021_H
diff --git a/src/libDevCom/UIOCom.cpp b/src/libDevCom/UIOCom.cpp
index 46eaa1a2..280a5503 100644
--- a/src/libDevCom/UIOCom.cpp
+++ b/src/libDevCom/UIOCom.cpp
@@ -1,83 +1,88 @@
 #include "UIOCom.h"
 
-#include "ComIOException.h"
-#include "NotSupportedException.h"
-
 #include <errno.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/mman.h>
-#include <fcntl.h>
+#include <unistd.h>
 
-UIOCom::UIOCom(const std::string& device, uint32_t size)
-  : m_size(size)
-{
-  m_fd = open(device.c_str(), O_RDWR);
-  if(m_fd==-1)
-    throw ComIOException("UIOCom cannot open "+device+": "+strerror(errno));
+#include "ComIOException.h"
+#include "NotSupportedException.h"
 
-  m_ptr = (unsigned*)mmap(NULL, m_size, PROT_READ|PROT_WRITE, MAP_SHARED, m_fd, 0);
-}
+UIOCom::UIOCom(const std::string& device, uint32_t size) : m_size(size) {
+    m_fd = open(device.c_str(), O_RDWR);
+    if (m_fd == -1)
+        throw ComIOException("UIOCom cannot open " + device + ": " +
+                             strerror(errno));
 
-UIOCom::~UIOCom()
-{
-  munmap(m_ptr, m_size);
+    m_ptr = static_cast<unsigned*>(
+        mmap(NULL, m_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_fd, 0));
 }
 
-void UIOCom::write_reg32(uint32_t address, uint32_t data)
-{ m_ptr[address] = data; }
+UIOCom::~UIOCom() { munmap(m_ptr, m_size); }
 
-void UIOCom::write_reg16(uint32_t address, uint16_t data)
-{ m_ptr[address] = data; }
-
-void UIOCom::write_reg8 (uint32_t address, uint8_t  data)
-{ m_ptr[address] = data; }
+void UIOCom::write_reg32(uint32_t address, uint32_t data) {
+    m_ptr[address] = data;
+}
 
-void UIOCom::write_reg32(uint32_t data)
-{ throw NotSupportedException("UIOCom does not support address-less writes."); }
+void UIOCom::write_reg16(uint32_t address, uint16_t data) {
+    m_ptr[address] = data;
+}
 
-void UIOCom::write_reg16(uint16_t data)
-{ throw NotSupportedException("UIOCom does not support address-less writes."); }
+void UIOCom::write_reg8(uint32_t address, uint8_t data) {
+    m_ptr[address] = data;
+}
 
-void UIOCom::write_reg8 (uint8_t  data)
-{ throw NotSupportedException("UIOCom does not support address-less writes."); }
+void UIOCom::write_reg32(uint32_t data) {
+    throw NotSupportedException("UIOCom does not support address-less writes.");
+}
 
-void UIOCom::write_block(uint32_t address, const std::vector<uint8_t>& data)
-{ throw NotSupportedException("UIOCom does not support block writes."); }
+void UIOCom::write_reg16(uint16_t data) {
+    throw NotSupportedException("UIOCom does not support address-less writes.");
+}
 
-void UIOCom::write_block(const std::vector<uint8_t>& data)
-{ throw NotSupportedException("UIOCom does not support block writes."); }
+void UIOCom::write_reg8(uint8_t data) {
+    throw NotSupportedException("UIOCom does not support address-less writes.");
+}
 
-uint32_t UIOCom::read_reg32(uint32_t address)
-{ return m_ptr[address]; }
+void UIOCom::write_block(uint32_t address, const std::vector<uint8_t>& data) {
+    throw NotSupportedException("UIOCom does not support block writes.");
+}
 
-uint32_t UIOCom::read_reg24(uint32_t address)
-{ return m_ptr[address]; }
+void UIOCom::write_block(const std::vector<uint8_t>& data) {
+    throw NotSupportedException("UIOCom does not support block writes.");
+}
 
-uint16_t UIOCom::read_reg16(uint32_t address)
-{ return m_ptr[address]; }
+uint32_t UIOCom::read_reg32(uint32_t address) { return m_ptr[address]; }
 
-uint8_t  UIOCom::read_reg8 (uint32_t address)
-{ return m_ptr[address]; }
+uint32_t UIOCom::read_reg24(uint32_t address) { return m_ptr[address]; }
 
-uint32_t UIOCom::read_reg32()
-{ throw NotSupportedException("UIOCom does not support address-less reads."); }
+uint16_t UIOCom::read_reg16(uint32_t address) { return m_ptr[address]; }
 
-uint32_t UIOCom::read_reg24()
-{ throw NotSupportedException("UIOCom does not support address-less reads."); }
+uint8_t UIOCom::read_reg8(uint32_t address) { return m_ptr[address]; }
 
-uint16_t UIOCom::read_reg16()
-{ throw NotSupportedException("UIOCom does not support address-less reads."); }
+uint32_t UIOCom::read_reg32() {
+    throw NotSupportedException("UIOCom does not support address-less reads.");
+}
 
-uint8_t  UIOCom::read_reg8 ()
-{ throw NotSupportedException("UIOCom does not support address-less reads."); }
+uint32_t UIOCom::read_reg24() {
+    throw NotSupportedException("UIOCom does not support address-less reads.");
+}
 
-void UIOCom::read_block(uint32_t address, std::vector<uint8_t>& data)
-{ throw NotSupportedException("UIOCom does not support block reads."); }
+uint16_t UIOCom::read_reg16() {
+    throw NotSupportedException("UIOCom does not support address-less reads.");
+}
 
-void UIOCom::read_block(std::vector<uint8_t>& data)
-{ throw NotSupportedException("UIOCom does not support block reads."); }
+uint8_t UIOCom::read_reg8() {
+    throw NotSupportedException("UIOCom does not support address-less reads.");
+}
 
+void UIOCom::read_block(uint32_t address, std::vector<uint8_t>& data) {
+    throw NotSupportedException("UIOCom does not support block reads.");
+}
 
+void UIOCom::read_block(std::vector<uint8_t>& data) {
+    throw NotSupportedException("UIOCom does not support block reads.");
+}
diff --git a/src/libDevCom/UIOCom.h b/src/libDevCom/UIOCom.h
index f6ebe461..dbabe116 100644
--- a/src/libDevCom/UIOCom.h
+++ b/src/libDevCom/UIOCom.h
@@ -5,44 +5,45 @@
 
 #include "DeviceCom.h"
 
-class UIOCom : public DeviceCom
-{
-public:
-  UIOCom(const std::string& device, uint32_t size);
-  virtual ~UIOCom();
-
-  //
-  // Write commands
-  virtual void write_reg32(uint32_t address, uint32_t data);
-  virtual void write_reg16(uint32_t address, uint16_t data);
-  virtual void write_reg8 (uint32_t address, uint8_t  data);
-
-  virtual void write_reg32(uint32_t data);
-  virtual void write_reg16(uint16_t data);
-  virtual void write_reg8 (uint8_t  data);
-
-  virtual void write_block(uint32_t address, const std::vector<uint8_t>& data);
-  virtual void write_block(const std::vector<uint8_t>& data);
-
-  //
-  // Read commands
-  virtual uint32_t read_reg32(uint32_t address);
-  virtual uint32_t read_reg24(uint32_t address);
-  virtual uint16_t read_reg16(uint32_t address);
-  virtual uint8_t  read_reg8 (uint32_t address);
-
-  virtual uint32_t read_reg32();
-  virtual uint32_t read_reg24();
-  virtual uint16_t read_reg16();
-  virtual uint8_t  read_reg8 ();
-
-  virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
-  virtual void read_block(std::vector<uint8_t>& data);
-private:
-  unsigned int m_size;
-
-  int m_fd;
-  unsigned *m_ptr;
+class UIOCom : public DeviceCom {
+ public:
+    UIOCom(const std::string& device, uint32_t size);
+    virtual ~UIOCom();
+
+    //
+    // Write commands
+    virtual void write_reg32(uint32_t address, uint32_t data);
+    virtual void write_reg16(uint32_t address, uint16_t data);
+    virtual void write_reg8(uint32_t address, uint8_t data);
+
+    virtual void write_reg32(uint32_t data);
+    virtual void write_reg16(uint16_t data);
+    virtual void write_reg8(uint8_t data);
+
+    virtual void write_block(uint32_t address,
+                             const std::vector<uint8_t>& data);
+    virtual void write_block(const std::vector<uint8_t>& data);
+
+    //
+    // Read commands
+    virtual uint32_t read_reg32(uint32_t address);
+    virtual uint32_t read_reg24(uint32_t address);
+    virtual uint16_t read_reg16(uint32_t address);
+    virtual uint8_t read_reg8(uint32_t address);
+
+    virtual uint32_t read_reg32();
+    virtual uint32_t read_reg24();
+    virtual uint16_t read_reg16();
+    virtual uint8_t read_reg8();
+
+    virtual void read_block(uint32_t address, std::vector<uint8_t>& data);
+    virtual void read_block(std::vector<uint8_t>& data);
+
+ private:
+    unsigned int m_size;
+
+    int m_fd;
+    unsigned* m_ptr;
 };
 
-#endif // UICOM_H
+#endif  // UICOM_H
diff --git a/src/libDevCom/examples/Si7021_example.cpp b/src/libDevCom/examples/Si7021_example.cpp
index b2bc57ff..33a9a4aa 100644
--- a/src/libDevCom/examples/Si7021_example.cpp
+++ b/src/libDevCom/examples/Si7021_example.cpp
@@ -1,18 +1,16 @@
-#include <memory>
-#include <iostream>
-#include <fstream>
-#include <cmath>
-#include <chrono>
-
-#include <sys/stat.h>
 #include <dirent.h>
+#include <sys/stat.h>
 
-#include "Si7021.h"
+#include <chrono>
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <memory>
 
-#include "Logger.h"
-#include "I2CDevComuino.h"
 #include "I2CDevCom.h"
-
+#include "I2CDevComuino.h"
+#include "Logger.h"
+#include "Si7021.h"
 
 int main(int argc, char* argv[]) {
     std::shared_ptr<TextSerialCom> TC(new TextSerialCom("/dev/ttyACM2", B9600));
@@ -23,16 +21,15 @@ int main(int argc, char* argv[]) {
     Si7021 tempsensor(i2c);
     tempsensor.init();
 
-  // Loop and measure
-    while(true)
-       {
-	 // Perform the measurement
-	 std::time_t time = std::time(nullptr);
-	 
-	 tempsensor.read();
-	 
-	 logger (logINFO)  << time << "  " << tempsensor.humidity() << " " << tempsensor.temperature();
-       } 
- return 0;
- }
+    // Loop and measure
+    while (true) {
+        // Perform the measurement
+        std::time_t time = std::time(nullptr);
+
+        tempsensor.read();
 
+        logger(logINFO) << time << "  " << tempsensor.humidity() << " "
+                        << tempsensor.temperature();
+    }
+    return 0;
+}
diff --git a/src/libDevCom/examples/ftdi_adc_example.cpp b/src/libDevCom/examples/ftdi_adc_example.cpp
index 488b8267..2a75ec4d 100644
--- a/src/libDevCom/examples/ftdi_adc_example.cpp
+++ b/src/libDevCom/examples/ftdi_adc_example.cpp
@@ -1,34 +1,31 @@
-//std/stl
-#include <iostream>
-#include <memory> // shared_ptr, unique_ptr
+// std/stl
 #include <stdint.h>
 
-//labremote
+#include <iostream>
+#include <memory>  // shared_ptr, unique_ptr
+
+// labremote
 #include "AD799X.h"
 #ifdef FTDI
 #include "FT232H.h"
 #include "I2CFTDICom.h"
 #endif
 
-int main(int argc, char* argv[])
-{
+int main(int argc, char* argv[]) {
 #ifndef FTDI_ENABLED
     std::cerr << "FTDI support is not enabled." << std::endl;
     return 1;
 #else
 
-    // this is our I2C bus primary -- on the FT232H device -- that will control communication
-    // with our I2C secondaries (the ADCs)
+    // this is our I2C bus primary -- on the FT232H device -- that will control
+    // communication with our I2C secondaries (the ADCs)
     std::shared_ptr<FT232H> ft232;
-    try
-    {
-        ft232 = std::make_shared<FT232H>(MPSSEChip::Protocol::I2C
-                                        ,MPSSEChip::Speed::FOUR_HUNDRED_KHZ
-                                        ,MPSSEChip::Endianness::MSBFirst);
+    try {
+        ft232 = std::make_shared<FT232H>(MPSSEChip::Protocol::I2C,
+                                         MPSSEChip::Speed::FOUR_HUNDRED_KHZ,
+                                         MPSSEChip::Endianness::MSBFirst);
         std::cout << "Iniialized MPSSE: " << ft232->to_string() << std::endl;
-    }
-    catch(std::exception& e)
-    {
+    } catch (std::exception& e) {
         std::cout << "Failed to initialize MPSSE: " << e.what() << std::endl;
         return 1;
     }
@@ -41,16 +38,16 @@ int main(int argc, char* argv[])
     std::shared_ptr<I2CFTDICom> com1(new I2CFTDICom(ft232, 0x22));
     std::unique_ptr<AD799X> adc1(new AD799X(2.5, AD799X::Model::AD7998, com1));
 
-    uint8_t vddd_chan = 0; // Channel 0 on ADC0 samples VDDD
-    uint8_t ntc_chan = 6; // Channel 6 on ADC1 amples the NTC
+    uint8_t vddd_chan = 0;  // Channel 0 on ADC0 samples VDDD
+    uint8_t ntc_chan = 6;   // Channel 6 on ADC1 amples the NTC
 
     std::cout << "------------------" << std::endl;
-    for(size_t i = 0; i < 10; i++)
-    {
-        std::cout << "[" << i << "] VDD = " << adc0->read(vddd_chan) << ", NTC = " << adc1->read(ntc_chan) <<  std::endl;
+    for (size_t i = 0; i < 10; i++) {
+        std::cout << "[" << i << "] VDD = " << adc0->read(vddd_chan)
+                  << ", NTC = " << adc1->read(ntc_chan) << std::endl;
     }
     std::cout << "------------------" << std::endl;
 
     return 0;
-#endif // FTDI
+#endif  // FTDI
 }
diff --git a/src/libDevCom/examples/temp_hum_monitor.cpp b/src/libDevCom/examples/temp_hum_monitor.cpp
index 6ce7a9fc..155e2871 100644
--- a/src/libDevCom/examples/temp_hum_monitor.cpp
+++ b/src/libDevCom/examples/temp_hum_monitor.cpp
@@ -1,147 +1,148 @@
+#include <ADCDevComuino.h>
+#include <DataSinkConf.h>
+#include <HIH4000.h>
+#include <IDataSink.h>
+#include <NTCSensor.h>
+#include <PtSensor.h>
+#include <TextSerialCom.h>
 #include <getopt.h>
-#include <string.h>
 #include <signal.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <chrono>
 #include <fstream>
-#include <string>
-#include <iostream>
 #include <iomanip>
-#include <thread>
-#include <chrono>
-#include <sys/stat.h> 
+#include <iostream>
 #include <map>
-
-#include <TextSerialCom.h>
-#include <ADCDevComuino.h>
-#include <NTCSensor.h>
-#include <PtSensor.h>
-#include <HIH4000.h>
-#include <DataSinkConf.h>
-#include <IDataSink.h>
+#include <string>
+#include <thread>
 
 //------ SETTINGS
 uint32_t tsleep = 1000;
-std::string configFile="config.json";
-std::string streamName="Climate";
+std::string configFile = "config.json";
+std::string streamName = "Climate";
 int rport = 0;
 //---------------
 
+bool quit = false;
+void cleanup(int signum) { quit = true; }
 
-bool quit=false;
-void cleanup(int signum)
-{ quit=true; }
-
-
-void usage(char *argv[])
-{
-  std::cout << "Usage: "<< argv[0] << " [-c config file] [-s stream name] [-p serial port] [-t sleep time (ms)]"<< std::endl;
-  std::cout << "   defaults: -c " << configFile << " -s " << streamName<< " -p " << rport << " -t " << tsleep << std::endl;
+void usage(char* argv[]) {
+    std::cout << "Usage: " << argv[0]
+              << " [-c config file] [-s stream name] [-p serial port] [-t "
+                 "sleep time (ms)]"
+              << std::endl;
+    std::cout << "   defaults: -c " << configFile << " -s " << streamName
+              << " -p " << rport << " -t " << tsleep << std::endl;
 }
-int main(int argc, char** argv)
-{
-
-  //Parse command-line  
-  if (argc < 1)
-    {
-      usage(argv);
-      return 1;
+int main(int argc, char** argv) {
+    // Parse command-line
+    if (argc < 1) {
+        usage(argv);
+        return 1;
     }
 
-  int c;
-  while (1) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"port",     required_argument, 0,  'p' },
-      {"config",   required_argument, 0,  'c' },
-      {"stream",   required_argument, 0,  's' },
-      {"tsleep",   required_argument, 0,  't' },
-      {"debug",    no_argument      , 0,  'd' },
-      {"help",     no_argument      , 0,  'h' },
-      {0,          0,                 0,  0 }
-    };
-    
-    c = getopt_long(argc, argv, "s:c:p:t:dh", long_options, &option_index);
-    if (c == -1)
-      break;
+    int c;
+    while (1) {
+        int option_index = 0;
+        static struct option long_options[] = {
+            {"port", required_argument, 0, 'p'},
+            {"config", required_argument, 0, 'c'},
+            {"stream", required_argument, 0, 's'},
+            {"tsleep", required_argument, 0, 't'},
+            {"debug", no_argument, 0, 'd'},
+            {"help", no_argument, 0, 'h'},
+            {0, 0, 0, 0}};
+
+        c = getopt_long(argc, argv, "s:c:p:t:dh", long_options, &option_index);
+        if (c == -1) break;
 
-    switch (c)
-      {
-      case 's':
-	streamName = optarg;
-	break;
-      case 'c':
-	configFile = optarg;
-	break;
-      case 'p':
-	rport = atoi(optarg);
-	break;
-      case 't':
-	tsleep = atoi(optarg);
-	break;
-      case 'd':
-	logIt::incrDebug();
-	break;
-      case 'h':
-	usage(argv);
-	return 1;
-      default:
-	std::cerr << "Invalid option '" << c << "' supplied. Aborting." << std::endl;
-	std::cerr << std::endl;
-	usage(argv);
-	return 1;
-      }
-  }
+        switch (c) {
+            case 's':
+                streamName = optarg;
+                break;
+            case 'c':
+                configFile = optarg;
+                break;
+            case 'p':
+                rport = atoi(optarg);
+                break;
+            case 't':
+                tsleep = atoi(optarg);
+                break;
+            case 'd':
+                logIt::incrDebug();
+                break;
+            case 'h':
+                usage(argv);
+                return 1;
+            default:
+                std::cerr << "Invalid option '" << c << "' supplied. Aborting."
+                          << std::endl;
+                std::cerr << std::endl;
+                usage(argv);
+                return 1;
+        }
+    }
 
-  // open serial device
-  speed_t baud=B9600;
-  std::shared_ptr<TextSerialCom> sc(new TextSerialCom("/dev/ttyACM"+std::to_string(rport), baud));
-  sc->init();
-  sc->setTermination("\r\n");
-  // somehow needed to initiate communication to Arduino
-  try{
-    sc->send("HELP");
-    std::cout << sc->receive() << std::endl;
-  } catch(...){
-    //std::cerr << "ERROR testing Arduino communication" << std::endl;
-  }
-  // create Arduino as ADC device
-  std::shared_ptr<ADCDevice> dev(new ADCDevComuino(1.,sc));
+    // open serial device
+    speed_t baud = B9600;
+    std::shared_ptr<TextSerialCom> sc(
+        new TextSerialCom("/dev/ttyACM" + std::to_string(rport), baud));
+    sc->init();
+    sc->setTermination("\r\n");
+    // somehow needed to initiate communication to Arduino
+    try {
+        sc->send("HELP");
+        std::cout << sc->receive() << std::endl;
+    } catch (...) {
+        // std::cerr << "ERROR testing Arduino communication" << std::endl;
+    }
+    // create Arduino as ADC device
+    std::shared_ptr<ADCDevice> dev(new ADCDevComuino(1., sc));
 
-  // create NTC
-  std::shared_ptr<NTCSensor> ntc(new NTCSensor(1, sc, 298.15, 10e3, 3435.0, 18e3, 5.0));
-  // create Pt1000
-  std::shared_ptr<PtSensor> pt(new PtSensor(0, dev, 1.e3, 3.9083e-3, -5.775e-7, 970.0));
-  // create HIH4000
-  std::shared_ptr<HIH4000> hum(new HIH4000(2, dev, std::static_pointer_cast<ClimateSensor>(pt)));
+    // create NTC
+    std::shared_ptr<NTCSensor> ntc(
+        new NTCSensor(1, sc, 298.15, 10e3, 3435.0, 18e3, 5.0));
+    // create Pt1000
+    std::shared_ptr<PtSensor> pt(
+        new PtSensor(0, dev, 1.e3, 3.9083e-3, -5.775e-7, 970.0));
+    // create HIH4000
+    std::shared_ptr<HIH4000> hum(
+        new HIH4000(2, dev, std::static_pointer_cast<ClimateSensor>(pt)));
 
-  // Create sink
-  DataSinkConf ds;
-  ds.setHardwareConfig(configFile);
-  std::shared_ptr<IDataSink> stream = ds.getDataStream(streamName);
+    // Create sink
+    DataSinkConf ds;
+    ds.setHardwareConfig(configFile);
+    std::shared_ptr<IDataSink> stream = ds.getDataStream(streamName);
 
-  // Register interrupt for cleanup
-  signal(SIGINT, cleanup);
+    // Register interrupt for cleanup
+    signal(SIGINT, cleanup);
 
-  // request data from selected measurement
-  while(!quit)
-    {
-      // Ambient T and H
-      hum->read();
-      stream->setTag("Sensor", "Ambient");
-      stream->startMeasurement("environment", std::chrono::system_clock::now());
-      stream->setField("temperature", hum->temperature()); // actual reading from Pt1000
-      stream->setField("humidity", hum->humidity());
-      stream->recordPoint();
-      stream->endMeasurement();
-      // module T
-      ntc->read();
-      stream->setTag("Sensor", "Module");
-      stream->startMeasurement("environment", std::chrono::system_clock::now());
-      stream->setField("temperature", ntc->temperature());
-      stream->setField("dewpoint", hum->dewPoint());
-      stream->recordPoint();
-      stream->endMeasurement();
-      std::this_thread::sleep_for(std::chrono::milliseconds(tsleep));
+    // request data from selected measurement
+    while (!quit) {
+        // Ambient T and H
+        hum->read();
+        stream->setTag("Sensor", "Ambient");
+        stream->startMeasurement("environment",
+                                 std::chrono::system_clock::now());
+        stream->setField("temperature",
+                         hum->temperature());  // actual reading from Pt1000
+        stream->setField("humidity", hum->humidity());
+        stream->recordPoint();
+        stream->endMeasurement();
+        // module T
+        ntc->read();
+        stream->setTag("Sensor", "Module");
+        stream->startMeasurement("environment",
+                                 std::chrono::system_clock::now());
+        stream->setField("temperature", ntc->temperature());
+        stream->setField("dewpoint", hum->dewPoint());
+        stream->recordPoint();
+        stream->endMeasurement();
+        std::this_thread::sleep_for(std::chrono::milliseconds(tsleep));
     }
 
-  return 0;
+    return 0;
 }
diff --git a/src/libDevCom/examples/tempsensor_monitor.cpp b/src/libDevCom/examples/tempsensor_monitor.cpp
index a7c954ba..7781ea91 100644
--- a/src/libDevCom/examples/tempsensor_monitor.cpp
+++ b/src/libDevCom/examples/tempsensor_monitor.cpp
@@ -1,11 +1,11 @@
-#include <memory>
-#include <iostream>
-#include <fstream>
-#include <cmath>
-#include <chrono>
-
-#include <sys/stat.h>
 #include <dirent.h>
+#include <sys/stat.h>
+
+#include <chrono>
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <memory>
 
 #ifdef FTDI
 #include "FT232H.h"
@@ -18,32 +18,31 @@
 
 int main(int argc, char* argv[]) {
 #ifndef FTDI
-  std::cerr << "FTDI support not enabled." << std::endl;
-  return -1;
-#else 
-  // Initialize I2C (for DAC comm)
-  std::shared_ptr<FT232H> ft232(new FT232H(MPSSEChip::Protocol::I2C
-                                            ,MPSSEChip::Speed::ONE_HUNDRED_KHZ
-                                            ,MPSSEChip::Endianness::MSBFirst));
-  std::shared_ptr<I2CCom> i2c_com(new I2CFTDICom(ft232, 0x27));
-
-  HIH6130 tempsensor(i2c_com);
-
-  // Loop and measure
-  while(true)
-    {
-      // Perform the measurement
-      std::time_t time = std::time(nullptr);
-
-      tempsensor.read();
-
-      // Save the data
-      std::cout << time << "\t" << tempsensor.status() << "\t" << tempsensor.humidity() << "\t" << tempsensor.temperature() << std::endl;
+    std::cerr << "FTDI support not enabled." << std::endl;
+    return -1;
+#else
+    // Initialize I2C (for DAC comm)
+    std::shared_ptr<FT232H> ft232(new FT232H(MPSSEChip::Protocol::I2C,
+                                             MPSSEChip::Speed::ONE_HUNDRED_KHZ,
+                                             MPSSEChip::Endianness::MSBFirst));
+    std::shared_ptr<I2CCom> i2c_com(new I2CFTDICom(ft232, 0x27));
+
+    HIH6130 tempsensor(i2c_com);
+
+    // Loop and measure
+    while (true) {
+        // Perform the measurement
+        std::time_t time = std::time(nullptr);
+
+        tempsensor.read();
+
+        // Save the data
+        std::cout << time << "\t" << tempsensor.status() << "\t"
+                  << tempsensor.humidity() << "\t" << tempsensor.temperature()
+                  << std::endl;
     }
 
 #endif
 
-  
-
-  return 0;
+    return 0;
 }
diff --git a/src/libDevCom/examples/uio.cpp b/src/libDevCom/examples/uio.cpp
index f151611b..e82aac0f 100644
--- a/src/libDevCom/examples/uio.cpp
+++ b/src/libDevCom/examples/uio.cpp
@@ -1,92 +1,81 @@
-#include <unistd.h>
 #include <string.h>
+#include <unistd.h>
 
-#include <iostream>
 #include <iomanip>
+#include <iostream>
 #include <memory>
 
-#include "UIOCom.h"
 #include "ComIOException.h"
+#include "UIOCom.h"
 
-void print_help()
-{
-  std::cout << "usage: uio [driver options] command [command parameters]" << std::endl;
-  std::cout << std::endl;
-  std::cout << "driver options" << std::endl;
-  std::cout << " -d dev: device to use (default: /dev/uio0)" << std::endl;
-  std::cout << std::endl;
-  std::cout << "commands" << std::endl;
-  std::cout << " write address data: write data to address " << std::endl;
-  std::cout << " read address: read address " << std::endl;
+void print_help() {
+    std::cout << "usage: uio [driver options] command [command parameters]"
+              << std::endl;
+    std::cout << std::endl;
+    std::cout << "driver options" << std::endl;
+    std::cout << " -d dev: device to use (default: /dev/uio0)" << std::endl;
+    std::cout << std::endl;
+    std::cout << "commands" << std::endl;
+    std::cout << " write address data: write data to address " << std::endl;
+    std::cout << " read address: read address " << std::endl;
 }
 
-int main(int argc, char* argv[])
-{
-  std::string device="/dev/uio0";
+int main(int argc, char* argv[]) {
+    std::string device = "/dev/uio0";
 
-  // Parse options
-  int opt;
-  while( (opt = getopt(argc, argv, "d:")) != -1 )
-    {
-      switch( opt )
-	{
-	case 'd':
-	  device=optarg;
-	  break;
-	case '?':  // unknown option...
-	  print_help();
-	  return 1;
-	  break;
-	}
+    // Parse options
+    int opt;
+    while ((opt = getopt(argc, argv, "d:")) != -1) {
+        switch (opt) {
+            case 'd':
+                device = optarg;
+                break;
+            case '?':  // unknown option...
+                print_help();
+                return 1;
+                break;
+        }
     }
 
-  // Determine the command
-  if(argc<=optind)
-    {
-      print_help();
-      return 1;
+    // Determine the command
+    if (argc <= optind) {
+        print_help();
+        return 1;
     }
 
-  std::string command=argv[optind];
+    std::string command = argv[optind];
 
-  try
-    {
-      // Create the communication object
-      std::shared_ptr<UIOCom> uio=std::make_shared<UIOCom>(device,0x10000);
+    try {
+        // Create the communication object
+        std::shared_ptr<UIOCom> uio = std::make_shared<UIOCom>(device, 0x10000);
 
-      // Run the commands
-      if(command=="write")
-	{
-	  // Need two more
-	  if(argc<=(optind+2))
-	    {
-	      print_help();
-	      return 1;
-	    }
+        // Run the commands
+        if (command == "write") {
+            // Need two more
+            if (argc <= (optind + 2)) {
+                print_help();
+                return 1;
+            }
 
-	  unsigned int address=std::stoul(argv[optind+1], nullptr, 0);
-	  unsigned int data=std::stoul(argv[optind+2], nullptr, 0);
+            unsigned int address = std::stoul(argv[optind + 1], nullptr, 0);
+            unsigned int data = std::stoul(argv[optind + 2], nullptr, 0);
 
-	  uio->write_reg32(address,data);
-	}
-      else if(command=="read")
-	{
-	  // Need one more
-	  if(argc<=(optind+1))
-	    {
-	      print_help();
-	      return 1;
-	    }
+            uio->write_reg32(address, data);
+        } else if (command == "read") {
+            // Need one more
+            if (argc <= (optind + 1)) {
+                print_help();
+                return 1;
+            }
 
-	  unsigned int address=std::stoul(argv[optind+1], nullptr, 0);
+            unsigned int address = std::stoul(argv[optind + 1], nullptr, 0);
 
-	  unsigned int read=uio->read_reg32(address);
-	  std::cout << "0x" << std::hex << std::setw(8) << std::setfill('0') << read << std::endl;
-	}
-    } 
-  catch(const ComIOException& e)
-    {
-      std::cout << "ERROR: " << e.what() << std::endl;
+            unsigned int read = uio->read_reg32(address);
+            std::cout << "0x" << std::hex << std::setw(8) << std::setfill('0')
+                      << read << std::endl;
+        }
+    } catch (const ComIOException& e) {
+        std::cout << "ERROR: " << e.what() << std::endl;
     }
-  return 0;
+    return 0;
 }
diff --git a/src/libDevCom/python.cpp b/src/libDevCom/python.cpp
index 1c3883b4..67fbca79 100644
--- a/src/libDevCom/python.cpp
+++ b/src/libDevCom/python.cpp
@@ -2,591 +2,352 @@
 #include <pybind11/stl.h>
 
 #include "ClimateSensor.h"
-#include "NTCSensor.h"
-#include "Si7021.h"
-#include "SHT85.h"
-#include "HIH6130.h"
-
 #include "DeviceCom.h"
+#include "HIH6130.h"
 #include "I2CCom.h"
 #include "I2CDevCom.h"
 #include "I2CDevComuino.h"
+#include "NTCSensor.h"
 #include "PCA9548ACom.h"
+#include "SHT85.h"
+#include "Si7021.h"
 #ifdef FTDI
-  #include "I2CFTDICom.h"
+#include "I2CFTDICom.h"
 #endif
 
-#include "TextSerialCom.h"
 #include "I2CCom.h"
+#include "TextSerialCom.h"
 
 namespace py = pybind11;
 
 class PyClimateSensor : public ClimateSensor {
-public:
+ public:
     using ClimateSensor::ClimateSensor;
 
-    void init() override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            ClimateSensor,
-            init
-        );
-    }
-    
+    void init() override { PYBIND11_OVERLOAD_PURE(void, ClimateSensor, init); }
+
     void reset() override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            ClimateSensor,
-            reset
-        );
-    }
-    
-    void read() override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            ClimateSensor,
-            read
-        );
-    }
-    
+        PYBIND11_OVERLOAD_PURE(void, ClimateSensor, reset);
+    }
+
+    void read() override { PYBIND11_OVERLOAD_PURE(void, ClimateSensor, read); }
+
     float temperature() const override {
-        PYBIND11_OVERLOAD_PURE(
-            float const,
-            ClimateSensor,
-            temperature
-        );
+        PYBIND11_OVERLOAD_PURE(float const, ClimateSensor, temperature);
     }
-    
+
     float humidity() const override {
-        PYBIND11_OVERLOAD_PURE(
-            float,
-            ClimateSensor,
-            humidity
-        );
+        PYBIND11_OVERLOAD_PURE(float, ClimateSensor, humidity);
     }
-    
+
     float pressure() const override {
-        PYBIND11_OVERLOAD_PURE(
-            float,
-            ClimateSensor,
-            pressure
-        );
+        PYBIND11_OVERLOAD_PURE(float, ClimateSensor, pressure);
     }
 };
 
-template <class Sensor = NTCSensor> class PySensor: public Sensor {
-public:
+template <class Sensor = NTCSensor>
+class PySensor : public Sensor {
+ public:
     using Sensor::Sensor;
 
-    void init() override {
-        PYBIND11_OVERLOAD(
-            void,
-            Sensor,
-            init
-        );
-    }
-    
-    void reset() override {
-        PYBIND11_OVERLOAD(
-            void,
-            Sensor,
-            reset
-        );
-    }
-    
-    void read() override {
-        PYBIND11_OVERLOAD(
-            void,
-            Sensor,
-            read
-        );
-    }
-    
+    void init() override { PYBIND11_OVERLOAD(void, Sensor, init); }
+
+    void reset() override { PYBIND11_OVERLOAD(void, Sensor, reset); }
+
+    void read() override { PYBIND11_OVERLOAD(void, Sensor, read); }
+
     float temperature() const override {
-        PYBIND11_OVERLOAD(
-            float const,
-            Sensor,
-            temperature
-        );
+        PYBIND11_OVERLOAD(float const, Sensor, temperature);
     }
-    
+
     float humidity() const override {
-        PYBIND11_OVERLOAD(
-            float,
-            Sensor,
-            humidity
-        );
+        PYBIND11_OVERLOAD(float, Sensor, humidity);
     }
-    
+
     float pressure() const override {
-        PYBIND11_OVERLOAD(
-            float,
-            Sensor,
-            pressure
-        );
+        PYBIND11_OVERLOAD(float, Sensor, pressure);
     }
 };
 
-template <class Sensor = SHT85> class PySensor_w_status: public Sensor {
-public:
+template <class Sensor = SHT85>
+class PySensor_w_status : public Sensor {
+ public:
     using Sensor::Sensor;
 
-    void init() override {
-        PYBIND11_OVERLOAD(
-            void,
-            Sensor,
-            init
-        );
-    }
-    
-    void reset() override {
-        PYBIND11_OVERLOAD(
-            void,
-            Sensor,
-            reset
-        );
-    }
-    
-    void read() override {
-        PYBIND11_OVERLOAD(
-            void,
-            Sensor,
-            read
-        );
-    }
-    
+    void init() override { PYBIND11_OVERLOAD(void, Sensor, init); }
+
+    void reset() override { PYBIND11_OVERLOAD(void, Sensor, reset); }
+
+    void read() override { PYBIND11_OVERLOAD(void, Sensor, read); }
+
     unsigned status() const override {
-        PYBIND11_OVERLOAD(
-            unsigned const,
-            Sensor,
-            status
-        );
+        PYBIND11_OVERLOAD(unsigned const, Sensor, status);
     }
-    
+
     float temperature() const override {
-        PYBIND11_OVERLOAD(
-            float const,
-            Sensor,
-            temperature
-        );
+        PYBIND11_OVERLOAD(float const, Sensor, temperature);
     }
-    
+
     float humidity() const override {
-        PYBIND11_OVERLOAD(
-            float,
-            Sensor,
-            humidity
-        );
+        PYBIND11_OVERLOAD(float, Sensor, humidity);
     }
-    
+
     float pressure() const override {
-        PYBIND11_OVERLOAD(
-            float,
-            Sensor,
-            pressure
-        );
+        PYBIND11_OVERLOAD(float, Sensor, pressure);
     }
 };
 
-template <class Com = DeviceCom> class PyPureVirtualCom : public Com {
-public:
+template <class Com = DeviceCom>
+class PyPureVirtualCom : public Com {
+ public:
     using Com::Com;
 
     void write_reg32(uint32_t address, uint32_t data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            write_reg32,
-            address,
-            data
-        );
+        PYBIND11_OVERLOAD_PURE(void, Com, write_reg32, address, data);
     }
 
     void write_reg16(uint32_t address, uint16_t data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            write_reg16,
-            address,
-            data
-        );
+        PYBIND11_OVERLOAD_PURE(void, Com, write_reg16, address, data);
     }
 
     void write_reg8(uint32_t address, uint8_t data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            write_reg8,
-            address,
-            data
-        );
+        PYBIND11_OVERLOAD_PURE(void, Com, write_reg8, address, data);
     }
 
     void write_reg32(uint32_t data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            write_reg32,
-            data
-        );
+        PYBIND11_OVERLOAD_PURE(void, Com, write_reg32, data);
     }
 
     void write_reg16(uint16_t data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            write_reg16,
-            data
-        );
+        PYBIND11_OVERLOAD_PURE(void, Com, write_reg16, data);
     }
 
     void write_reg8(uint8_t data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            write_reg8,
-            data
-        );
+        PYBIND11_OVERLOAD_PURE(void, Com, write_reg8, data);
     }
 
-    void write_block(uint32_t address, const std::vector<uint8_t>& data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            write_block,
-            address,
-            data
-        );
+    void write_block(uint32_t address,
+                     const std::vector<uint8_t>& data) override {
+        PYBIND11_OVERLOAD_PURE(void, Com, write_block, address, data);
     }
 
     void write_block(const std::vector<uint8_t>& data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            write_block,
-            data
-        );
+        PYBIND11_OVERLOAD_PURE(void, Com, write_block, data);
     }
 
     uint32_t read_reg32(uint32_t address) override {
-        PYBIND11_OVERLOAD_PURE(
-            uint32_t,
-            Com,
-            read_reg32,
-            address
-        );
+        PYBIND11_OVERLOAD_PURE(uint32_t, Com, read_reg32, address);
     }
 
     uint32_t read_reg24(uint32_t address) override {
-        PYBIND11_OVERLOAD_PURE(
-            uint32_t,
-            Com,
-            read_reg24,
-            address
-        );
+        PYBIND11_OVERLOAD_PURE(uint32_t, Com, read_reg24, address);
     }
 
     uint16_t read_reg16(uint32_t address) override {
-        PYBIND11_OVERLOAD_PURE(
-            uint16_t,
-            Com,
-            read_reg16,
-            address
-        );
+        PYBIND11_OVERLOAD_PURE(uint16_t, Com, read_reg16, address);
     }
 
     uint8_t read_reg8(uint32_t address) override {
-        PYBIND11_OVERLOAD_PURE(
-            uint8_t,
-            Com,
-            read_reg8,
-            address
-        );
+        PYBIND11_OVERLOAD_PURE(uint8_t, Com, read_reg8, address);
     }
 
     uint32_t read_reg32() override {
-        PYBIND11_OVERLOAD_PURE(
-            uint32_t,
-            Com,
-            read_reg32
-        );
+        PYBIND11_OVERLOAD_PURE(uint32_t, Com, read_reg32);
     }
 
     uint32_t read_reg24() override {
-        PYBIND11_OVERLOAD_PURE(
-            uint32_t,
-            Com,
-            read_reg24
-        );
+        PYBIND11_OVERLOAD_PURE(uint32_t, Com, read_reg24);
     }
 
     uint16_t read_reg16() override {
-        PYBIND11_OVERLOAD_PURE(
-            uint16_t,
-            Com,
-            read_reg16
-        );
+        PYBIND11_OVERLOAD_PURE(uint16_t, Com, read_reg16);
     }
 
     uint8_t read_reg8() override {
-        PYBIND11_OVERLOAD_PURE(
-            uint8_t,
-            Com,
-            read_reg8
-        );
+        PYBIND11_OVERLOAD_PURE(uint8_t, Com, read_reg8);
     }
 
     void read_block(uint32_t address, std::vector<uint8_t>& data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            read_block,
-            address,
-            data
-        );
+        PYBIND11_OVERLOAD_PURE(void, Com, read_block, address, data);
     }
 
     void read_block(std::vector<uint8_t>& data) override {
-        PYBIND11_OVERLOAD_PURE(
-            void,
-            Com,
-            read_block,
-            data
-        );
+        PYBIND11_OVERLOAD_PURE(void, Com, read_block, data);
     }
 };
 
-
-template <class Com = I2CDevCom> class PyCom : public Com {
-public:
+template <class Com = I2CDevCom>
+class PyCom : public Com {
+ public:
     using Com::Com;
 
     void write_reg32(uint32_t address, uint32_t data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            write_reg32,
-            address,
-            data
-        );
+        PYBIND11_OVERLOAD(void, Com, write_reg32, address, data);
     }
 
     void write_reg16(uint32_t address, uint16_t data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            write_reg16,
-            address,
-            data
-        );
+        PYBIND11_OVERLOAD(void, Com, write_reg16, address, data);
     }
 
     void write_reg8(uint32_t address, uint8_t data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            write_reg8,
-            address,
-            data
-        );
+        PYBIND11_OVERLOAD(void, Com, write_reg8, address, data);
     }
 
     void write_reg32(uint32_t data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            write_reg32,
-            data
-        );
+        PYBIND11_OVERLOAD(void, Com, write_reg32, data);
     }
 
     void write_reg16(uint16_t data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            write_reg16,
-            data
-        );
+        PYBIND11_OVERLOAD(void, Com, write_reg16, data);
     }
 
     void write_reg8(uint8_t data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            write_reg8,
-            data
-        );
+        PYBIND11_OVERLOAD(void, Com, write_reg8, data);
     }
 
-    void write_block(uint32_t address, const std::vector<uint8_t>& data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            write_block,
-            address,
-            data
-        );
+    void write_block(uint32_t address,
+                     const std::vector<uint8_t>& data) override {
+        PYBIND11_OVERLOAD(void, Com, write_block, address, data);
     }
 
     void write_block(const std::vector<uint8_t>& data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            write_block,
-            data
-        );
+        PYBIND11_OVERLOAD(void, Com, write_block, data);
     }
 
     uint32_t read_reg32(uint32_t address) override {
-        PYBIND11_OVERLOAD(
-            uint32_t,
-            Com,
-            read_reg32,
-            address
-        );
+        PYBIND11_OVERLOAD(uint32_t, Com, read_reg32, address);
     }
 
     uint32_t read_reg24(uint32_t address) override {
-        PYBIND11_OVERLOAD(
-            uint32_t,
-            Com,
-            read_reg24,
-            address
-        );
+        PYBIND11_OVERLOAD(uint32_t, Com, read_reg24, address);
     }
 
     uint16_t read_reg16(uint32_t address) override {
-        PYBIND11_OVERLOAD(
-            uint16_t,
-            Com,
-            read_reg16,
-            address
-        );
+        PYBIND11_OVERLOAD(uint16_t, Com, read_reg16, address);
     }
 
     uint8_t read_reg8(uint32_t address) override {
-        PYBIND11_OVERLOAD(
-            uint8_t,
-            Com,
-            read_reg8,
-            address
-        );
+        PYBIND11_OVERLOAD(uint8_t, Com, read_reg8, address);
     }
 
     uint32_t read_reg32() override {
-        PYBIND11_OVERLOAD(
-            uint32_t,
-            Com,
-            read_reg32
-        );
+        PYBIND11_OVERLOAD(uint32_t, Com, read_reg32);
     }
 
     uint32_t read_reg24() override {
-        PYBIND11_OVERLOAD(
-            uint32_t,
-            Com,
-            read_reg24
-        );
+        PYBIND11_OVERLOAD(uint32_t, Com, read_reg24);
     }
 
     uint16_t read_reg16() override {
-        PYBIND11_OVERLOAD(
-            uint16_t,
-            Com,
-            read_reg16
-        );
+        PYBIND11_OVERLOAD(uint16_t, Com, read_reg16);
     }
 
-    uint8_t read_reg8() override {
-        PYBIND11_OVERLOAD(
-            uint8_t,
-            Com,
-            read_reg8
-        );
-    }
+    uint8_t read_reg8() override { PYBIND11_OVERLOAD(uint8_t, Com, read_reg8); }
 
     void read_block(uint32_t address, std::vector<uint8_t>& data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            read_block,
-            address,
-            data
-        );
+        PYBIND11_OVERLOAD(void, Com, read_block, address, data);
     }
 
     void read_block(std::vector<uint8_t>& data) override {
-        PYBIND11_OVERLOAD(
-            void,
-            Com,
-            read_block,
-            data
-        );
+        PYBIND11_OVERLOAD(void, Com, read_block, data);
     }
 };
 
 void register_devcom(py::module& m) {
-  py::class_<ClimateSensor, PyClimateSensor, std::shared_ptr<ClimateSensor>>(m, "ClimateSensor")
-    .def(py::init<>())
-    .def("init", &ClimateSensor::init)
-    .def("reset", &ClimateSensor::reset)
-    .def("read", &ClimateSensor::read)
-    .def("temperature", &ClimateSensor::temperature)
-    .def("humidity", &ClimateSensor::humidity)
-    .def("pressure", &ClimateSensor::pressure)
-    .def("dewPoint", &ClimateSensor::dewPoint);
- 
-  py::class_<NTCSensor, PySensor<NTCSensor>, ClimateSensor, std::shared_ptr<NTCSensor>>(m, "NTCSensor")
-    .def(py::init<uint8_t, std::shared_ptr<TextSerialCom>, float, float, float, float, float>());
-  
-  py::class_<Si7021, PySensor<Si7021>, ClimateSensor, std::shared_ptr<Si7021>>(m, "Si7021")
-    .def(py::init<std::shared_ptr<I2CCom>>());
-  
-  py::class_<SHT85, PySensor_w_status<SHT85>, ClimateSensor, std::shared_ptr<SHT85>>(m, "SHT85")
-    .def(py::init<std::shared_ptr<I2CCom>>())
-    .def("status", &SHT85::status);
-  
-  py::class_<HIH6130, PySensor_w_status<HIH6130>, ClimateSensor, std::shared_ptr<HIH6130>>(m, "HIH6130")
-    .def(py::init<std::shared_ptr<I2CCom>>())
-    .def("status", &HIH6130::status);
-  
-  py::class_<DeviceCom, PyPureVirtualCom<DeviceCom>, std::shared_ptr<DeviceCom>>(m, "DeviceCom")
-    .def(py::init<>())
-    .def("write_reg32", (void (DeviceCom::*)(uint32_t address, uint32_t data)) &DeviceCom::write_reg32)
-    .def("write_reg16", (void (DeviceCom::*)(uint32_t address, uint16_t data)) &DeviceCom::write_reg16)
-    .def("write_reg8", (void (DeviceCom::*)(uint32_t address, uint8_t data)) &DeviceCom::write_reg8)
-    .def("write_reg32", (void (DeviceCom::*)(uint32_t data)) &DeviceCom::write_reg32)
-    .def("write_reg16", (void (DeviceCom::*)(uint16_t data)) &DeviceCom::write_reg16)
-    .def("write_reg8", (void (DeviceCom::*)(uint8_t data)) &DeviceCom::write_reg8)
-    .def("write_block", (void (DeviceCom::*)(uint32_t address, const std::vector<uint8_t>& data)) &DeviceCom::write_block)
-    .def("write_block", (void (DeviceCom::*)(const std::vector<uint8_t>& data)) &DeviceCom::write_block)
-    .def("read_reg32", (uint32_t (DeviceCom::*)(uint32_t address)) &DeviceCom::read_reg32)
-    .def("read_reg24", (uint32_t (DeviceCom::*)(uint32_t address)) &DeviceCom::read_reg24)
-    .def("read_reg16", (uint16_t (DeviceCom::*)(uint32_t address)) &DeviceCom::read_reg16)
-    .def("read_reg8", (uint8_t (DeviceCom::*)(uint32_t address)) &DeviceCom::read_reg8)
-    .def("read_reg32", (uint32_t (DeviceCom::*)()) &DeviceCom::read_reg32)
-    .def("read_reg24", (uint32_t (DeviceCom::*)()) &DeviceCom::read_reg24)
-    .def("read_reg16", (uint16_t (DeviceCom::*)()) &DeviceCom::read_reg16)
-    .def("read_reg8", (uint8_t (DeviceCom::*)()) &DeviceCom::read_reg8)
-    .def("read_block", (void (DeviceCom::*)(uint32_t address, std::vector<uint8_t>& data)) &DeviceCom::read_block)
-    .def("read_block", (void (DeviceCom::*)(std::vector<uint8_t>& data)) &DeviceCom::read_block);
-  
-  py::class_<I2CCom, PyPureVirtualCom<I2CCom>, DeviceCom, std::shared_ptr<I2CCom>>(m, "I2CCom")
-    .def(py::init<uint8_t>())
-    .def("setDeviceAddr", &I2CCom::setDeviceAddr)
-    .def("deviceAddr", &I2CCom::deviceAddr);
-  
-  py::class_<I2CDevCom, PyCom<I2CDevCom>, I2CCom, std::shared_ptr<I2CDevCom>>(m, "I2CDevCom")
-    .def(py::init<uint8_t, const std::string&>());
-  
-  py::class_<I2CDevComuino, PyCom<I2CDevComuino>, I2CCom, std::shared_ptr<I2CDevComuino>>(m, "I2CDevComuino")
-    .def(py::init<uint8_t, std::shared_ptr<TextSerialCom>>());
-  
+    py::class_<ClimateSensor, PyClimateSensor, std::shared_ptr<ClimateSensor>>(
+        m, "ClimateSensor")
+        .def(py::init<>())
+        .def("init", &ClimateSensor::init)
+        .def("reset", &ClimateSensor::reset)
+        .def("read", &ClimateSensor::read)
+        .def("temperature", &ClimateSensor::temperature)
+        .def("humidity", &ClimateSensor::humidity)
+        .def("pressure", &ClimateSensor::pressure)
+        .def("dewPoint", &ClimateSensor::dewPoint);
+
+    py::class_<NTCSensor, PySensor<NTCSensor>, ClimateSensor,
+               std::shared_ptr<NTCSensor>>(m, "NTCSensor")
+        .def(py::init<uint8_t, std::shared_ptr<TextSerialCom>, float, float,
+                      float, float, float>());
+
+    py::class_<Si7021, PySensor<Si7021>, ClimateSensor,
+               std::shared_ptr<Si7021>>(m, "Si7021")
+        .def(py::init<std::shared_ptr<I2CCom>>());
+
+    py::class_<SHT85, PySensor_w_status<SHT85>, ClimateSensor,
+               std::shared_ptr<SHT85>>(m, "SHT85")
+        .def(py::init<std::shared_ptr<I2CCom>>())
+        .def("status", &SHT85::status);
+
+    py::class_<HIH6130, PySensor_w_status<HIH6130>, ClimateSensor,
+               std::shared_ptr<HIH6130>>(m, "HIH6130")
+        .def(py::init<std::shared_ptr<I2CCom>>())
+        .def("status", &HIH6130::status);
+
+    py::class_<DeviceCom, PyPureVirtualCom<DeviceCom>,
+               std::shared_ptr<DeviceCom>>(m, "DeviceCom")
+        .def(py::init<>())
+        .def("write_reg32",
+             (void (DeviceCom::*)(uint32_t address, uint32_t data)) &
+                 DeviceCom::write_reg32)
+        .def("write_reg16",
+             (void (DeviceCom::*)(uint32_t address, uint16_t data)) &
+                 DeviceCom::write_reg16)
+        .def("write_reg8",
+             (void (DeviceCom::*)(uint32_t address, uint8_t data)) &
+                 DeviceCom::write_reg8)
+        .def("write_reg32",
+             (void (DeviceCom::*)(uint32_t data)) & DeviceCom::write_reg32)
+        .def("write_reg16",
+             (void (DeviceCom::*)(uint16_t data)) & DeviceCom::write_reg16)
+        .def("write_reg8",
+             (void (DeviceCom::*)(uint8_t data)) & DeviceCom::write_reg8)
+        .def("write_block",
+             (void (DeviceCom::*)(uint32_t address,
+                                  const std::vector<uint8_t>& data)) &
+                 DeviceCom::write_block)
+        .def("write_block",
+             (void (DeviceCom::*)(const std::vector<uint8_t>& data)) &
+                 DeviceCom::write_block)
+        .def("read_reg32",
+             (uint32_t(DeviceCom::*)(uint32_t address)) & DeviceCom::read_reg32)
+        .def("read_reg24",
+             (uint32_t(DeviceCom::*)(uint32_t address)) & DeviceCom::read_reg24)
+        .def("read_reg16",
+             (uint16_t(DeviceCom::*)(uint32_t address)) & DeviceCom::read_reg16)
+        .def("read_reg8",
+             (uint8_t(DeviceCom::*)(uint32_t address)) & DeviceCom::read_reg8)
+        .def("read_reg32", (uint32_t(DeviceCom::*)()) & DeviceCom::read_reg32)
+        .def("read_reg24", (uint32_t(DeviceCom::*)()) & DeviceCom::read_reg24)
+        .def("read_reg16", (uint16_t(DeviceCom::*)()) & DeviceCom::read_reg16)
+        .def("read_reg8", (uint8_t(DeviceCom::*)()) & DeviceCom::read_reg8)
+        .def("read_block", (void (DeviceCom::*)(uint32_t address,
+                                                std::vector<uint8_t> & data)) &
+                               DeviceCom::read_block)
+        .def("read_block", (void (DeviceCom::*)(std::vector<uint8_t> & data)) &
+                               DeviceCom::read_block);
+
+    py::class_<I2CCom, PyPureVirtualCom<I2CCom>, DeviceCom,
+               std::shared_ptr<I2CCom>>(m, "I2CCom")
+        .def(py::init<uint8_t>())
+        .def("setDeviceAddr", &I2CCom::setDeviceAddr)
+        .def("deviceAddr", &I2CCom::deviceAddr);
+
+    py::class_<I2CDevCom, PyCom<I2CDevCom>, I2CCom, std::shared_ptr<I2CDevCom>>(
+        m, "I2CDevCom")
+        .def(py::init<uint8_t, const std::string&>());
+
+    py::class_<I2CDevComuino, PyCom<I2CDevComuino>, I2CCom,
+               std::shared_ptr<I2CDevComuino>>(m, "I2CDevComuino")
+        .def(py::init<uint8_t, std::shared_ptr<TextSerialCom>>());
+
 #ifdef FTDI
-  py::class_<I2CFTDICom, PyCom<I2CFTDICom>, I2CCom, std::shared_ptr<I2CFTDICom>>(m, "I2CFTDICom")
-    .def(py::init<uint8_t>());
+    py::class_<I2CFTDICom, PyCom<I2CFTDICom>, I2CCom,
+               std::shared_ptr<I2CFTDICom>>(m, "I2CFTDICom")
+        .def(py::init<uint8_t>());
 #endif
-  
-  py::class_<PCA9548ACom, PyCom<PCA9548ACom>, I2CCom, std::shared_ptr<PCA9548ACom>>(m, "PCA9548ACom")
-    .def(py::init<uint8_t, uint8_t, std::shared_ptr<I2CCom>>());
+
+    py::class_<PCA9548ACom, PyCom<PCA9548ACom>, I2CCom,
+               std::shared_ptr<PCA9548ACom>>(m, "PCA9548ACom")
+        .def(py::init<uint8_t, uint8_t, std::shared_ptr<I2CCom>>());
 }
diff --git a/src/libEquipConf/DataSinkConf.cpp b/src/libEquipConf/DataSinkConf.cpp
index bad71fca..b5bc1c71 100644
--- a/src/libEquipConf/DataSinkConf.cpp
+++ b/src/libEquipConf/DataSinkConf.cpp
@@ -1,15 +1,12 @@
 #include "DataSinkConf.h"
 
-#include <iostream>
-#include <fstream>
 #include <algorithm>
+#include <fstream>
+#include <iostream>
 #include <string>
 
-#include "Logger.h"
-
-#include "DataSinkRegistry.h"
 #include "CombinedSink.h"
-
+#include "DataSinkRegistry.h"
 #include "Logger.h"
 
 using json = nlohmann::json;
@@ -20,134 +17,123 @@ using json = nlohmann::json;
 // Configuration
 ////////////////////
 
-DataSinkConf::DataSinkConf()
-{ }
+DataSinkConf::DataSinkConf() {}
 
-DataSinkConf::~DataSinkConf()
-{ }
+DataSinkConf::~DataSinkConf() {}
 
-DataSinkConf::DataSinkConf(const std::string& hardwareConfigFile)
-{
-  setHardwareConfig(hardwareConfigFile);
+DataSinkConf::DataSinkConf(const std::string& hardwareConfigFile) {
+    setHardwareConfig(hardwareConfigFile);
 }
 
-DataSinkConf::DataSinkConf(const json& hardwareConfig)
-{
-  setHardwareConfig(hardwareConfig);
+DataSinkConf::DataSinkConf(const json& hardwareConfig) {
+    setHardwareConfig(hardwareConfig);
 }
 
-void DataSinkConf::setHardwareConfig(const std::string& hardwareConfigFile)
-{
-  //load JSON object from file
-  std::ifstream i(hardwareConfigFile);
-  i >> m_hardwareConfig;
+void DataSinkConf::setHardwareConfig(const std::string& hardwareConfigFile) {
+    // load JSON object from file
+    std::ifstream i(hardwareConfigFile);
+    i >> m_hardwareConfig;
 }
 
-void DataSinkConf::setHardwareConfig(const json& hardwareConfig)
-{
-  //store JSON config file
-  m_hardwareConfig = hardwareConfig;
+void DataSinkConf::setHardwareConfig(const json& hardwareConfig) {
+    // store JSON config file
+    m_hardwareConfig = hardwareConfig;
 }
 
-json DataSinkConf::getDataSinkConf(const std::string& label)
-{
-  for (const auto& hw : m_hardwareConfig["datasinks"].items())
-    {
-      //check label 
-      if (hw.key() == label) return hw.value();
+json DataSinkConf::getDataSinkConf(const std::string& label) {
+    for (const auto& hw : m_hardwareConfig["datasinks"].items()) {
+        // check label
+        if (hw.key() == label) return hw.value();
     }
-  return json();
+    return json();
 }
 
-json DataSinkConf::getDataStreamConf(const std::string& label)
-{
-  for (const auto& hw : m_hardwareConfig["datastreams"].items())
-    {
-      //check label 
-      if (hw.key() == label) return hw.value();
+json DataSinkConf::getDataStreamConf(const std::string& label) {
+    for (const auto& hw : m_hardwareConfig["datastreams"].items()) {
+        // check label
+        if (hw.key() == label) return hw.value();
     }
-  return json();
+    return json();
 }
 
 ////////////////////
 // General private
 ////////////////////
 
-std::shared_ptr<IDataSink> DataSinkConf::getDataSink(const std::string& name)
-{
-  //first check if an object with the same name/type is already available (was already instantiated)
-  if (m_dataSinks.find(name) != m_dataSinks.end())
-    return m_dataSinks[name];
+std::shared_ptr<IDataSink> DataSinkConf::getDataSink(const std::string& name) {
+    // first check if an object with the same name/type is already available
+    // (was already instantiated)
+    if (m_dataSinks.find(name) != m_dataSinks.end()) return m_dataSinks[name];
 
-  //Otherwise, create the object
-  //check first if hardware configuration is available
+    // Otherwise, create the object
+    // check first if hardware configuration is available
 
-  json reqSinkConf = getDataSinkConf(name);
-  if (reqSinkConf.empty())
-    {
-      logger(logWARNING) << "Requested data sink not found in input configuration file: " << name;
-      return nullptr;
+    json reqSinkConf = getDataSinkConf(name);
+    if (reqSinkConf.empty()) {
+        logger(logWARNING)
+            << "Requested data sink not found in input configuration file: "
+            << name;
+        return nullptr;
     }
 
+    // setup sink
+    std::shared_ptr<IDataSink> ds =
+        EquipRegistry::createDataSink(reqSinkConf["sinktype"], name);
 
-  // setup sink
-  std::shared_ptr<IDataSink> ds = EquipRegistry::createDataSink(reqSinkConf["sinktype"], name);
-
-  // configure and initialize
-  ds->setConfiguration(reqSinkConf);
-  ds->init();
+    // configure and initialize
+    ds->setConfiguration(reqSinkConf);
+    ds->init();
 
-  return ds;
+    return ds;
 }
 
-std::shared_ptr<CombinedSink> DataSinkConf::getDataStream(const std::string& name)
-{
-  //first check if an object with the same name/type is already available (was already instantiated)
-  if (m_dataStreams.find(name) != m_dataStreams.end())
-    return m_dataStreams[name];
-
-  //Otherwise, create the object
-  //check first if hardware configuration is available
-
-  json reqStreamConf = getDataStreamConf(name);
-  if (reqStreamConf.empty())
-    {
-      logger(logWARNING) << "Requested data stream not found in input configuration file: " << name;
-      return nullptr;
+std::shared_ptr<CombinedSink> DataSinkConf::getDataStream(
+    const std::string& name) {
+    // first check if an object with the same name/type is already available
+    // (was already instantiated)
+    if (m_dataStreams.find(name) != m_dataStreams.end())
+        return m_dataStreams[name];
+
+    // Otherwise, create the object
+    // check first if hardware configuration is available
+
+    json reqStreamConf = getDataStreamConf(name);
+    if (reqStreamConf.empty()) {
+        logger(logWARNING)
+            << "Requested data stream not found in input configuration file: "
+            << name;
+        return nullptr;
     }
 
-
-  // setup sink
-  std::shared_ptr<CombinedSink> ds =
-    std::dynamic_pointer_cast<CombinedSink>(EquipRegistry::createDataSink(reqStreamConf.value("sinktype", "CombinedSink"), name));
-
-  // Check if combined sink
-  if(!ds)
-    {
-      logger(logWARNING) << "Requested data stream does not derive from CombinedSink: " << name;
-      return nullptr;
+    // setup sink
+    std::shared_ptr<CombinedSink> ds =
+        std::dynamic_pointer_cast<CombinedSink>(EquipRegistry::createDataSink(
+            reqStreamConf.value("sinktype", "CombinedSink"), name));
+
+    // Check if combined sink
+    if (!ds) {
+        logger(logWARNING)
+            << "Requested data stream does not derive from CombinedSink: "
+            << name;
+        return nullptr;
     }
-    
 
-  // Add sub sinks
-  auto sinks=reqStreamConf.find("sinks");
-  if(sinks==reqStreamConf.end())
-    {
-      logger(logWARNING) << "No sub-sinks defined in " << name << " combined sink.";
-    }
-  else
-    {
-      for(const auto& sink : sinks.value().items())
-	{
-	  std::shared_ptr<IDataSink> sds = getDataSink(sink.value());
-	  if(sds==nullptr) continue;
-	  ds->addSink(sds);
-	}
+    // Add sub sinks
+    auto sinks = reqStreamConf.find("sinks");
+    if (sinks == reqStreamConf.end()) {
+        logger(logWARNING) << "No sub-sinks defined in " << name
+                           << " combined sink.";
+    } else {
+        for (const auto& sink : sinks.value().items()) {
+            std::shared_ptr<IDataSink> sds = getDataSink(sink.value());
+            if (sds == nullptr) continue;
+            ds->addSink(sds);
+        }
     }
 
-  // configure and initialize
-  ds->setConfiguration(reqStreamConf);
-  ds->init();
+    // configure and initialize
+    ds->setConfiguration(reqStreamConf);
+    ds->init();
 
-  return ds;
+    return ds;
 }
diff --git a/src/libEquipConf/DataSinkConf.h b/src/libEquipConf/DataSinkConf.h
index d1f78359..ccc07dd1 100644
--- a/src/libEquipConf/DataSinkConf.h
+++ b/src/libEquipConf/DataSinkConf.h
@@ -1,32 +1,33 @@
 #ifndef DATASINKCONF__H
 #define DATASINKCONF__H
 
+#include <nlohmann/json.hpp>
 #include <string>
 #include <unordered_map>
 
-#include <nlohmann/json.hpp>
-
-#include "IDataSink.h"
 #include "CombinedSink.h"
+#include "IDataSink.h"
 
-/** \brief Factory for discovering data sink resources and instantiate/configure them.
- * 
+/** \brief Factory for discovering data sink resources and instantiate/configure
+ * them.
+ *
  * This class has Python bindings.
  *
  * Valid JSON config file contains the follow blocks:
  *  - `datasinks`: type of measurement format (i.e. ConsoleSink)
- *  - `datastreams`: instances of CombinedSink for streaming data to multiple sinks
+ *  - `datastreams`: instances of CombinedSink for streaming data to multiple
+ * sinks
  *
- * The `datastreams` block is used to define combinations of sinks declared in the `datasinks` 
- * block. The sub-sinks in a stream are specified as a list of `datasink` names under the 
- * `sinks` key.
+ * The `datastreams` block is used to define combinations of sinks declared in
+ * the `datasinks` block. The sub-sinks in a stream are specified as a list of
+ * `datasink` names under the `sinks` key.
  *
- * The streams are implemented using the CombinedSink object that then forwards the calls
- * to sub-sinks.
+ * The streams are implemented using the CombinedSink object that then forwards
+ * the calls to sub-sinks.
  *
- * It is recommended that application use data streams for saving data as they are much more
- * flexible than individual sink. They allow saving data to multiple and varied combinations
- * of destinations.
+ * It is recommended that application use data streams for saving data as they
+ * are much more flexible than individual sink. They allow saving data to
+ * multiple and varied combinations of destinations.
  *
  * An example of the hardware configuration file content is:
  * ```json
@@ -49,94 +50,97 @@
  * }
  * ```
  */
-class DataSinkConf
-{
-public:
-  /** \name Configuration
-      @{ */
-
-  //! \brief Constructor
-  DataSinkConf();
-
-  //! \brief Constructor
-  /**
-   * @param hardwareConfigFile input JSON file with list of datasink resources and options
-   */
-  DataSinkConf(const std::string& hardwareConfigFile);
-
-  //! \brief Constructor
-  /**
-   * @param hardwareConfig JSON object with list of datasink sources and options
-   */ 
-  DataSinkConf(const nlohmann::json& hardwareConfig);
-
-  ~DataSinkConf();
-
-  //! \brief Set input hardware list file
-  /**
-   * @param hardwareConfigFile input JSON file with list of datasink resources and options
-   */
-  void setHardwareConfig(const std::string& hardwareConfigFile);
-
-  //! \brief Set input hardware list file
-  /**
-   * @param hardwareConfig input JSON object with list of datasink resources and options
-   */
-  void setHardwareConfig(const nlohmann::json& hardwareConfig);
-
-  //! \brief Get sink JSON configuration 
-  /** 
-   * @param label data sink name
-   * @return data sink JSON configuration (by reference)
-   */  
-  nlohmann::json getDataSinkConf(const std::string& label);
-  
-  //! \brief Get stream JSON configuration 
-  /** 
-   * @param label data stream name
-   * @return data stream JSON configuration (by reference)
-   */  
-  nlohmann::json getDataStreamConf(const std::string& label);
-
-  /** @} */
-
-public:
-  /** \name Get data sinks/streams (by label) 
-   * @{ 
-   */
-
-  //! \brief Get IDataSink object corresponding to name
-  /**
-   * If this is the first time the data sink name is requested:
-   *  1. Create the object
-   *
-   * @param name label for the `datasink` object in JSON configuration file
-   */
-  std::shared_ptr<IDataSink> getDataSink(const std::string& name);  
-
-  //! \brief Get CombinedSink object corresponding to name
-  /** 
-   * If this is the first time the data stream is requested:
-   *  1. Create the object
-   *  2. Get and associate sinks using DataSinkConf::getDataSink
-   *
-   * @param name label for the `datastream` object in JSON configuration file
-   */
-  std::shared_ptr<CombinedSink> getDataStream(const std::string& name);  
-  
-  /** @} */
-  
-private:
-
-  /// JSON file with hardware list and options (see example input-hw.nlohmann::json file for syntax)
-  nlohmann::json m_hardwareConfig;
-
-  /// Stored handles of IDataSink pointers created
-  std::unordered_map<std::string, std::shared_ptr<IDataSink>> m_dataSinks;
-
-  /// Stored handles of CombinedSink pointers created
-  std::unordered_map<std::string, std::shared_ptr<CombinedSink>> m_dataStreams;
-
+class DataSinkConf {
+ public:
+    /** \name Configuration
+        @{ */
+
+    //! \brief Constructor
+    DataSinkConf();
+
+    //! \brief Constructor
+    /**
+     * @param hardwareConfigFile input JSON file with list of datasink resources
+     * and options
+     */
+    DataSinkConf(const std::string& hardwareConfigFile);
+
+    //! \brief Constructor
+    /**
+     * @param hardwareConfig JSON object with list of datasink sources and
+     * options
+     */
+    DataSinkConf(const nlohmann::json& hardwareConfig);
+
+    ~DataSinkConf();
+
+    //! \brief Set input hardware list file
+    /**
+     * @param hardwareConfigFile input JSON file with list of datasink resources
+     * and options
+     */
+    void setHardwareConfig(const std::string& hardwareConfigFile);
+
+    //! \brief Set input hardware list file
+    /**
+     * @param hardwareConfig input JSON object with list of datasink resources
+     * and options
+     */
+    void setHardwareConfig(const nlohmann::json& hardwareConfig);
+
+    //! \brief Get sink JSON configuration
+    /**
+     * @param label data sink name
+     * @return data sink JSON configuration (by reference)
+     */
+    nlohmann::json getDataSinkConf(const std::string& label);
+
+    //! \brief Get stream JSON configuration
+    /**
+     * @param label data stream name
+     * @return data stream JSON configuration (by reference)
+     */
+    nlohmann::json getDataStreamConf(const std::string& label);
+
+    /** @} */
+
+ public:
+    /** \name Get data sinks/streams (by label)
+     * @{
+     */
+
+    //! \brief Get IDataSink object corresponding to name
+    /**
+     * If this is the first time the data sink name is requested:
+     *  1. Create the object
+     *
+     * @param name label for the `datasink` object in JSON configuration file
+     */
+    std::shared_ptr<IDataSink> getDataSink(const std::string& name);
+
+    //! \brief Get CombinedSink object corresponding to name
+    /**
+     * If this is the first time the data stream is requested:
+     *  1. Create the object
+     *  2. Get and associate sinks using DataSinkConf::getDataSink
+     *
+     * @param name label for the `datastream` object in JSON configuration file
+     */
+    std::shared_ptr<CombinedSink> getDataStream(const std::string& name);
+
+    /** @} */
+
+ private:
+    /// JSON file with hardware list and options (see example
+    /// input-hw.nlohmann::json file for syntax)
+    nlohmann::json m_hardwareConfig;
+
+    /// Stored handles of IDataSink pointers created
+    std::unordered_map<std::string, std::shared_ptr<IDataSink>> m_dataSinks;
+
+    /// Stored handles of CombinedSink pointers created
+    std::unordered_map<std::string, std::shared_ptr<CombinedSink>>
+        m_dataStreams;
 };
 
 #endif
diff --git a/src/libEquipConf/EquipConf.cpp b/src/libEquipConf/EquipConf.cpp
index 12c8d4fa..ef9c4f97 100644
--- a/src/libEquipConf/EquipConf.cpp
+++ b/src/libEquipConf/EquipConf.cpp
@@ -1,15 +1,13 @@
 #include "EquipConf.h"
 
-#include <iostream>
-#include <fstream>
 #include <algorithm>
+#include <fstream>
+#include <iostream>
 #include <string>
 
-#include "PowerSupplyRegistry.h"
 #include "ComRegistry.h"
 #include "Logger.h"
-
-#include "Logger.h"
+#include "PowerSupplyRegistry.h"
 using json = nlohmann::json;
 
 using json = nlohmann::json;
@@ -18,151 +16,152 @@ using json = nlohmann::json;
 // Configuration
 ////////////////////
 
-EquipConf::EquipConf()
-{ }
+EquipConf::EquipConf() {}
 
-EquipConf::~EquipConf()
-{ }
+EquipConf::~EquipConf() {}
 
-EquipConf::EquipConf(const std::string& hardwareConfigFile)
-{
-  setHardwareConfig(hardwareConfigFile);
+EquipConf::EquipConf(const std::string& hardwareConfigFile) {
+    setHardwareConfig(hardwareConfigFile);
 }
 
-EquipConf::EquipConf(const json& hardwareConfig)
-{
-  setHardwareConfig(hardwareConfig);
+EquipConf::EquipConf(const json& hardwareConfig) {
+    setHardwareConfig(hardwareConfig);
 }
 
-void EquipConf::setHardwareConfig(const std::string& hardwareConfigFile)
-{
-  //load JSON object from file
-  std::ifstream i(hardwareConfigFile);
-  i >> m_hardwareConfig;
+void EquipConf::setHardwareConfig(const std::string& hardwareConfigFile) {
+    // load JSON object from file
+    std::ifstream i(hardwareConfigFile);
+    i >> m_hardwareConfig;
 }
 
-void EquipConf::setHardwareConfig(const json& hardwareConfig)
-{
-  //store JSON config file
-  m_hardwareConfig = hardwareConfig;
+void EquipConf::setHardwareConfig(const json& hardwareConfig) {
+    // store JSON config file
+    m_hardwareConfig = hardwareConfig;
 }
 
-json EquipConf::getDeviceConf(const std::string& label)
-{
-  for (const auto& hw : m_hardwareConfig["devices"].items()) {
-    //check label 
-    if (hw.key() == label) return hw.value();
-  }
-  return json();
+json EquipConf::getDeviceConf(const std::string& label) {
+    for (const auto& hw : m_hardwareConfig["devices"].items()) {
+        // check label
+        if (hw.key() == label) return hw.value();
+    }
+    return json();
 }
 
-json EquipConf::getChannelConf(const std::string& label)
-{
-  for (const auto& ch : m_hardwareConfig["channels"].items()) {
-    //check label 
-    if (ch.key() == label) return ch.value();
-  }
-  return json();
+json EquipConf::getChannelConf(const std::string& label) {
+    for (const auto& ch : m_hardwareConfig["channels"].items()) {
+        // check label
+        if (ch.key() == label) return ch.value();
+    }
+    return json();
 }
 
 ////////////////////
 // General private
 ////////////////////
 
-
 ////////////////////
 // Power-Supply
 ////////////////////
 
-std::shared_ptr<IPowerSupply> EquipConf::getPowerSupply(const std::string& name)
-{
-  //first check if an object with the same name/type is already available (was already instantiated)
-  if (m_listPowerSupply.find(name) != m_listPowerSupply.end()) {
-    return m_listPowerSupply[name];
-  }
-
-  //Otherwise, create the object
-  //check first if hardware configuration is available
-  json reqPSConf = getDeviceConf(name);
-  if (reqPSConf.empty()) {
-    logger(logWARNING) << "Requested device not found in input configuration file: " << name;
-    return nullptr;
-  }
-  if (reqPSConf["hw-type"] != "PS") {
-    logger(logWARNING) << "Requested power supply device has wrong hw-type field in configuration." << name << ", type = " << reqPSConf["hw-type"];
-    return nullptr;    
-  }
-
-  //setup device
-  std::shared_ptr<IPowerSupply> ps = EquipRegistry::createPowerSupply(reqPSConf["hw-model"], name);
-
-  // configure already the PS
-  ps->setConfiguration(reqPSConf);
-
-  // Setup communication object
-  if(!reqPSConf.contains("communication"))
-    {
-      logger(logWARNING) << "Requested device is missing communication configuration";
-      return nullptr;
+std::shared_ptr<IPowerSupply> EquipConf::getPowerSupply(
+    const std::string& name) {
+    // first check if an object with the same name/type is already available
+    // (was already instantiated)
+    if (m_listPowerSupply.find(name) != m_listPowerSupply.end()) {
+        return m_listPowerSupply[name];
+    }
+
+    // Otherwise, create the object
+    // check first if hardware configuration is available
+    json reqPSConf = getDeviceConf(name);
+    if (reqPSConf.empty()) {
+        logger(logWARNING)
+            << "Requested device not found in input configuration file: "
+            << name;
+        return nullptr;
     }
-  ps->setCom(createCommunication(reqPSConf["communication"]));
+    if (reqPSConf["hw-type"] != "PS") {
+        logger(logWARNING) << "Requested power supply device has wrong hw-type "
+                              "field in configuration."
+                           << name << ", type = " << reqPSConf["hw-type"];
+        return nullptr;
+    }
+
+    // setup device
+    std::shared_ptr<IPowerSupply> ps =
+        EquipRegistry::createPowerSupply(reqPSConf["hw-model"], name);
 
-  // Check
-  ps->checkCompatibilityList();
+    // configure already the PS
+    ps->setConfiguration(reqPSConf);
 
-  return ps;
+    // Setup communication object
+    if (!reqPSConf.contains("communication")) {
+        logger(logWARNING)
+            << "Requested device is missing communication configuration";
+        return nullptr;
+    }
+    ps->setCom(createCommunication(reqPSConf["communication"]));
+
+    // Check
+    ps->checkCompatibilityList();
+
+    return ps;
 }
 
-std::shared_ptr<PowerSupplyChannel> EquipConf::getPowerSupplyChannel(const std::string& name)
-{
-  //first check if an object with the same name/type is already available (was already instantiated)
-  if (m_listPowerSupplyChannel.find(name) != m_listPowerSupplyChannel.end())
-    return m_listPowerSupplyChannel[name];
-
-  //Otherwise, create the object
-  //check first if hardware configuration is available
-  json reqChConf = getChannelConf(name);
-  if (reqChConf.empty())
-    {
-      logger(logWARNING) << "Requested channel not found in input configuration file: " << name;
-      return nullptr;
+std::shared_ptr<PowerSupplyChannel> EquipConf::getPowerSupplyChannel(
+    const std::string& name) {
+    // first check if an object with the same name/type is already available
+    // (was already instantiated)
+    if (m_listPowerSupplyChannel.find(name) != m_listPowerSupplyChannel.end())
+        return m_listPowerSupplyChannel[name];
+
+    // Otherwise, create the object
+    // check first if hardware configuration is available
+    json reqChConf = getChannelConf(name);
+    if (reqChConf.empty()) {
+        logger(logWARNING)
+            << "Requested channel not found in input configuration file: "
+            << name;
+        return nullptr;
     }
 
-  if (reqChConf["hw-type"] != "PS")
-    {
-      logger(logWARNING) << "Requested power supply channel has wrong hw-type field in configuration." << name << ", type = " << reqChConf["hw-type"];
-      return nullptr;
+    if (reqChConf["hw-type"] != "PS") {
+        logger(logWARNING) << "Requested power supply channel has wrong "
+                              "hw-type field in configuration."
+                           << name << ", type = " << reqChConf["hw-type"];
+        return nullptr;
     }
 
-  // Get physical power supply
-  std::shared_ptr<IPowerSupply> ps = getPowerSupply(reqChConf["device"]);
-  if(ps==nullptr)
-    {
-      logger(logWARNING) << "Cannot fetch requested power supply: " <<  reqChConf["device"];
-      return nullptr;
-    }    
+    // Get physical power supply
+    std::shared_ptr<IPowerSupply> ps = getPowerSupply(reqChConf["device"]);
+    if (ps == nullptr) {
+        logger(logWARNING) << "Cannot fetch requested power supply: "
+                           << reqChConf["device"];
+        return nullptr;
+    }
 
-  // Other settings
-  unsigned ch = reqChConf["channel"];
+    // Other settings
+    unsigned ch = reqChConf["channel"];
 
-  // Create!
-  std::shared_ptr<PowerSupplyChannel> theChannel = std::make_shared<PowerSupplyChannel>(name, ps, ch);
+    // Create!
+    std::shared_ptr<PowerSupplyChannel> theChannel =
+        std::make_shared<PowerSupplyChannel>(name, ps, ch);
 
-  //configure already the PS
-  if(reqChConf.contains("program"))
-    theChannel->setProgram(reqChConf["program"]);
+    // configure already the PS
+    if (reqChConf.contains("program"))
+        theChannel->setProgram(reqChConf["program"]);
 
-  return theChannel;
+    return theChannel;
 }
 
-std::shared_ptr<ICom> EquipConf::createCommunication(const json& config) const
-{
-  if (!config.contains("protocol"))
-    throw std::runtime_error("Communicaiton block is missing protocol definition.");
+std::shared_ptr<ICom> EquipConf::createCommunication(const json& config) const {
+    if (!config.contains("protocol"))
+        throw std::runtime_error(
+            "Communicaiton block is missing protocol definition.");
 
-  std::shared_ptr<ICom> com=EquipRegistry::createCom(config["protocol"]);
-  com->setConfiguration(config);
-  com->init();
+    std::shared_ptr<ICom> com = EquipRegistry::createCom(config["protocol"]);
+    com->setConfiguration(config);
+    com->init();
 
-  return com;
+    return com;
 }
diff --git a/src/libEquipConf/EquipConf.h b/src/libEquipConf/EquipConf.h
index e38f3959..625fa768 100644
--- a/src/libEquipConf/EquipConf.h
+++ b/src/libEquipConf/EquipConf.h
@@ -1,112 +1,121 @@
 #ifndef EQUIPCONF__H
 #define EQUIPCONF__H
 
+#include <nlohmann/json.hpp>
 #include <string>
 #include <unordered_map>
 
-#include <nlohmann/json.hpp>
-
+#include "ICom.h"
 #include "IPowerSupply.h"
 #include "PowerSupplyChannel.h"
 
-#include "ICom.h"
-
-/** \brief Factory for discovering hardware resources and instantiate/configure controllers. 
+/** \brief Factory for discovering hardware resources and instantiate/configure
+ * controllers.
  *
  * Valid JSON hardware config file is made up of two blocks:
  *  - devices: physical devices registered in a registry
- *  - channels: logical channels 
+ *  - channels: logical channels
  */
-class EquipConf
-{
-public:
-  /** Configuration @{ */
-  
-  /** Constructor */
-  EquipConf();
-
-  /** Constructor
-   * @param hardwareConfigFile input JSON file with list of hardware resources and options
-   */
-  EquipConf(const std::string& hardwareConfigFile);
-
-  /** Constructor
-   * @param hardwareConfig JSON object with list of hardware sources and options
-   */ 
-  EquipConf(const nlohmann::json& hardwareConfig);
-
-  ~EquipConf();
-
-  /** Set input hardware list file
-   * @param hardwareConfigFile input JSON file with list of hardware resources and options
-   */
-  void setHardwareConfig(const std::string& hardwareConfigFile);
-
-  /** Set input hardware list file
-   * @param hardwareConfig input JSON object with list of hardware resources and options
-   */
-  void setHardwareConfig(const nlohmann::json& hardwareConfig);
-
-  /** Get device JSON configuration 
-      @param label device name
-      @return device JSON configuration (by reference)
-   */  
-  nlohmann::json getDeviceConf(const std::string& label);
-
-  /** Get channel JSON configuration 
-      @param label channel name
-      @return channel JSON configuration (by reference)
-   */  
-  nlohmann::json getChannelConf(const std::string& label);
-  
-  /** @} */
-
-public:
-  /** Get (or create) hardware handles (by label) 
-   * @{ 
-   */
-
-  /** Get Power-Supply object corresponding to name
-   *
-   * If this is the first time the power supply name is requested:
-   *  1. Create the object
-   *  2. Call IPowerSupply::connect()
-   *  3. Call IPowerSupply::checkCompatibilityList()
-   *
-   * @param name label for the hardware object in JSON configuration file (*not* the model)
-   */
-  std::shared_ptr<IPowerSupply> getPowerSupply(const std::string& name);  
-
-  /** Get Power-Supply channel object; if it was not instantiated yet, create the object.
-   *
-   * The power supply itself will also be instiated following `getPowerSupply`.
-   *
-   * @param name label for the channel object in JSON configuration file
-   */
-  std::shared_ptr<PowerSupplyChannel> getPowerSupplyChannel(const std::string& name);  
-
-  /** @} */
-  
-private:
-
-  /// JSON file with hardware list and options (see example input-hw.nlohmann::json file for syntax)
-  nlohmann::json m_hardwareConfig;
-
-  /// Stored handles of IPowerSupply pointers created
-  std::unordered_map<std::string, std::shared_ptr<IPowerSupply>> m_listPowerSupply;
-
-  /// Stored handles of PowerSupplyChannel pointers created
-  std::unordered_map<std::string, std::shared_ptr<PowerSupplyChannel>> m_listPowerSupplyChannel;
-
-  /** \brief Create and initialize a ICom object based on JSON settings
-   *
-   * The `ComRegistry` is used to look up the `ICom` class
-   * corresponding to the "protocol" field of the config object.
-   * If no such class exists, an exception is thrown.
-   *
-   * \param communication JSON object containing
-   */
-  std::shared_ptr<ICom> createCommunication(const nlohmann::json& config) const;
+class EquipConf {
+ public:
+    /** Configuration @{ */
+
+    /** Constructor */
+    EquipConf();
+
+    /** Constructor
+     * @param hardwareConfigFile input JSON file with list of hardware resources
+     * and options
+     */
+    EquipConf(const std::string& hardwareConfigFile);
+
+    /** Constructor
+     * @param hardwareConfig JSON object with list of hardware sources and
+     * options
+     */
+    EquipConf(const nlohmann::json& hardwareConfig);
+
+    ~EquipConf();
+
+    /** Set input hardware list file
+     * @param hardwareConfigFile input JSON file with list of hardware resources
+     * and options
+     */
+    void setHardwareConfig(const std::string& hardwareConfigFile);
+
+    /** Set input hardware list file
+     * @param hardwareConfig input JSON object with list of hardware resources
+     * and options
+     */
+    void setHardwareConfig(const nlohmann::json& hardwareConfig);
+
+    /** Get device JSON configuration
+        @param label device name
+        @return device JSON configuration (by reference)
+     */
+    nlohmann::json getDeviceConf(const std::string& label);
+
+    /** Get channel JSON configuration
+        @param label channel name
+        @return channel JSON configuration (by reference)
+     */
+    nlohmann::json getChannelConf(const std::string& label);
+
+    /** @} */
+
+ public:
+    /** Get (or create) hardware handles (by label)
+     * @{
+     */
+
+    /** Get Power-Supply object corresponding to name
+     *
+     * If this is the first time the power supply name is requested:
+     *  1. Create the object
+     *  2. Call IPowerSupply::connect()
+     *  3. Call IPowerSupply::checkCompatibilityList()
+     *
+     * @param name label for the hardware object in JSON configuration file
+     * (*not* the model)
+     */
+    std::shared_ptr<IPowerSupply> getPowerSupply(const std::string& name);
+
+    /** Get Power-Supply channel object; if it was not instantiated yet, create
+     * the object.
+     *
+     * The power supply itself will also be instiated following
+     * `getPowerSupply`.
+     *
+     * @param name label for the channel object in JSON configuration file
+     */
+    std::shared_ptr<PowerSupplyChannel> getPowerSupplyChannel(
+        const std::string& name);
+
+    /** @} */
+
+ private:
+    /// JSON file with hardware list and options (see example
+    /// input-hw.nlohmann::json file for syntax)
+    nlohmann::json m_hardwareConfig;
+
+    /// Stored handles of IPowerSupply pointers created
+    std::unordered_map<std::string, std::shared_ptr<IPowerSupply>>
+        m_listPowerSupply;
+
+    /// Stored handles of PowerSupplyChannel pointers created
+    std::unordered_map<std::string, std::shared_ptr<PowerSupplyChannel>>
+        m_listPowerSupplyChannel;
+
+    /** \brief Create and initialize a ICom object based on JSON settings
+     *
+     * The `ComRegistry` is used to look up the `ICom` class
+     * corresponding to the "protocol" field of the config object.
+     * If no such class exists, an exception is thrown.
+     *
+     * \param communication JSON object containing
+     */
+    std::shared_ptr<ICom> createCommunication(
+        const nlohmann::json& config) const;
 };
 
 #endif
diff --git a/src/libEquipConf/python.cpp b/src/libEquipConf/python.cpp
old mode 100755
new mode 100644
index d7b61bd2..3a61e5d9
--- a/src/libEquipConf/python.cpp
+++ b/src/libEquipConf/python.cpp
@@ -1,34 +1,39 @@
-#include "pybind11_json/pybind11_json.hpp"
-#include "nlohmann/json.hpp"
 #include <pybind11/pybind11.h>
 #include <pybind11/stl.h>
 
-#include "EquipConf.h"
 #include "DataSinkConf.h"
+#include "EquipConf.h"
+#include "nlohmann/json.hpp"
+#include "pybind11_json/pybind11_json.hpp"
 
 namespace py = pybind11;
 namespace nl = nlohmann;
 
-void register_equipconf(py::module& m){
-  py::class_<EquipConf>(m, "EquipConf")
-    .def(py::init<>())
-    .def(py::init<const std::string &>())
-    .def(py::init<const nl::json &>())
-    .def("setHardwareConfig", (void (EquipConf::*)(const std::string&)) &EquipConf::setHardwareConfig)
-    .def("setHardwareConfig", (void (EquipConf::*)(const nl::json&)) &EquipConf::setHardwareConfig)
-    .def("getDeviceConf", &EquipConf::getDeviceConf)
-    .def("getChannelConf", &EquipConf::getChannelConf)
-    .def("getPowerSupply", &EquipConf::getPowerSupply)
-    .def("getPowerSupplyChannel", &EquipConf::getPowerSupplyChannel);
-    
-  py::class_<DataSinkConf>(m, "DataSinkConf")
-    .def(py::init<>())
-    .def(py::init<const std::string &>())
-    .def(py::init<const nl::json &>())
-    .def("setHardwareConfig", (void (DataSinkConf::*)(const std::string&)) &DataSinkConf::setHardwareConfig)
-    .def("setHardwareConfig", (void (DataSinkConf::*)(const nl::json&)) &DataSinkConf::setHardwareConfig)
-    .def("getDataSinkConf", &DataSinkConf::getDataSinkConf)
-    .def("getDataSink", &DataSinkConf::getDataSink)
-    .def("getDataStreamConf", &DataSinkConf::getDataStreamConf)
-    .def("getDataStream", &DataSinkConf::getDataStream);
+void register_equipconf(py::module &m) {
+    py::class_<EquipConf>(m, "EquipConf")
+        .def(py::init<>())
+        .def(py::init<const std::string &>())
+        .def(py::init<const nl::json &>())
+        .def("setHardwareConfig", (void (EquipConf::*)(const std::string &)) &
+                                      EquipConf::setHardwareConfig)
+        .def("setHardwareConfig", (void (EquipConf::*)(const nl::json &)) &
+                                      EquipConf::setHardwareConfig)
+        .def("getDeviceConf", &EquipConf::getDeviceConf)
+        .def("getChannelConf", &EquipConf::getChannelConf)
+        .def("getPowerSupply", &EquipConf::getPowerSupply)
+        .def("getPowerSupplyChannel", &EquipConf::getPowerSupplyChannel);
+
+    py::class_<DataSinkConf>(m, "DataSinkConf")
+        .def(py::init<>())
+        .def(py::init<const std::string &>())
+        .def(py::init<const nl::json &>())
+        .def("setHardwareConfig",
+             (void (DataSinkConf::*)(const std::string &)) &
+                 DataSinkConf::setHardwareConfig)
+        .def("setHardwareConfig", (void (DataSinkConf::*)(const nl::json &)) &
+                                      DataSinkConf::setHardwareConfig)
+        .def("getDataSinkConf", &DataSinkConf::getDataSinkConf)
+        .def("getDataSink", &DataSinkConf::getDataSink)
+        .def("getDataStreamConf", &DataSinkConf::getDataStreamConf)
+        .def("getDataStream", &DataSinkConf::getDataStream);
 }
diff --git a/src/libGalil/arrays.cpp b/src/libGalil/arrays.cpp
old mode 100755
new mode 100644
index 76e06b29..3af87d70
--- a/src/libGalil/arrays.cpp
+++ b/src/libGalil/arrays.cpp
@@ -1,398 +1,382 @@
 /*! \file arrays.c
-*
-* Function calls for uploading and downloading arrays with CSV files.
-*
-*/
+ *
+ * Function calls for uploading and downloading arrays with CSV files.
+ *
+ */
 
 #include "gclibo.h"
-#define _CRT_SECURE_NO_WARNINGS //use traditional C calls like strncpy()
-#include <stdlib.h> //atoi, atof
-#include <string.h> //strcpy
-#include <stdio.h> //fopen
-#include <math.h> //log()
-
+#define _CRT_SECURE_NO_WARNINGS  // use traditional C calls like strncpy()
+#include <math.h>                //log()
+#include <stdio.h>               //fopen
+#include <stdlib.h>              //atoi, atof
+#include <string.h>              //strcpy
 
 //! Structure to create a linked list for array data.
-struct H_ArrayData
-{
-	char name[16]; //copy of array name
-	char* data; //pointer to the ASCII array data
-	int len; //length of data
-	int elements; //found data elements for properly dimensioning on download
-	int index; //access index into data for write/read operations
-
-	struct H_ArrayData* next; //pointer to next ArrayNode in the list
-
-	//The following fields are only valid on the head node
-	struct H_ArrayData * tail; //if this node is the head node, last ptr will be maintained for faster tail insertion
-	int count; //if this node is the head node, count will be maintained for total number of arrays
-	//note, head node also holds array data
+struct H_ArrayData {
+    char name[16];  // copy of array name
+    char* data;     // pointer to the ASCII array data
+    int len;        // length of data
+    int elements;   // found data elements for properly dimensioning on download
+    int index;      // access index into data for write/read operations
+
+    struct H_ArrayData* next;  // pointer to next ArrayNode in the list
+
+    // The following fields are only valid on the head node
+    struct H_ArrayData* tail;  // if this node is the head node, last ptr will
+                               // be maintained for faster tail insertion
+    int count;  // if this node is the head node, count will be maintained for
+                // total number of arrays
+    // note, head node also holds array data
 };
 typedef struct H_ArrayData ArrayNode;
 
 //! Function to initialize the memory of a new node
-void H_InitArrayNode(ArrayNode* node)
-{
-	node->count = 0;
-	node->data = 0;
-	node->index = 0;
-	node->len = 0;
-	node->name[0] = 0;
-	node->next = 0; //null indicates end of list
-	node->tail = 0;
-	node->elements = 0;
-	//could memset to zero...
+void H_InitArrayNode(ArrayNode* node) {
+    node->count = 0;
+    node->data = 0;
+    node->index = 0;
+    node->len = 0;
+    node->name[0] = 0;
+    node->next = 0;  // null indicates end of list
+    node->tail = 0;
+    node->elements = 0;
+    // could memset to zero...
 }
 
 //! Add an ArrayData node to the linked list.
-GReturn H_AddArray(ArrayNode* head, char* name, char* data)
-{
-	ArrayNode* node; //the node to fill with data
-	if (head->count == 0) //no need to malloc, just fill the head
-		node = head;
-	else
-	{
-		node = (ArrayNode*) malloc(sizeof(ArrayNode));
-		if (node) //malloc ok
-			H_InitArrayNode(node);
-		else
-			return G_BAD_FULL_MEMORY; //malloc failed
-	}
-
-	node->data = data; //copy pointer
-	strcpy(node->name, name); //copy name array
-	node->len = strlen(node->data); //output of GArrayUpload is null terminated.
-
-	head->count++; //count the node we just made
-	head->tail->next = node; //link the new node. If node == head this breaks the last-node-next-null guarantee
-	node->next = 0; //enforce the last-node-next-null guarantee
-	head->tail = node; //update head's tail pointer
-	
-	return G_NO_ERROR;
+GReturn H_AddArray(ArrayNode* head, char* name, char* data) {
+    ArrayNode* node;       // the node to fill with data
+    if (head->count == 0)  // no need to malloc, just fill the head
+        node = head;
+    else {
+        node = (ArrayNode*)malloc(sizeof(ArrayNode));
+        if (node)  // malloc ok
+            H_InitArrayNode(node);
+        else
+            return G_BAD_FULL_MEMORY;  // malloc failed
+    }
+
+    node->data = data;         // copy pointer
+    strcpy(node->name, name);  // copy name array
+    node->len =
+        strlen(node->data);  // output of GArrayUpload is null terminated.
+
+    head->count++;            // count the node we just made
+    head->tail->next = node;  // link the new node. If node == head this breaks
+                              // the last-node-next-null guarantee
+    node->next = 0;           // enforce the last-node-next-null guarantee
+    head->tail = node;        // update head's tail pointer
+
+    return G_NO_ERROR;
 }
 
-//! Frees all memory downsteam of node. After passing list head to this function, all memory is freed and the head node is invalid.
-void H_FreeArrays(ArrayNode* node)
-{
-	if (node == 0) return; //recursive exit condition
-	free(node->data); //free this node's data
-	H_FreeArrays(node->next); //let downstream nodes recursvely free their data
-	free(node->next); //free the struct this node points to
-	//no need to free node, the head is declared on the stack
+//! Frees all memory downsteam of node. After passing list head to this
+//! function, all memory is freed and the head node is invalid.
+void H_FreeArrays(ArrayNode* node) {
+    if (node == 0) return;     // recursive exit condition
+    free(node->data);          // free this node's data
+    H_FreeArrays(node->next);  // let downstream nodes recursvely free their
+                               // data
+    free(node->next);          // free the struct this node points to
+    // no need to free node, the head is declared on the stack
 }
 
 //! Uplaods a particular array and adds it to the linked list.
-GReturn H_UploadArrayToList(GCon g, ArrayNode* head, char* name)
-{
-	GReturn rc = G_NO_ERROR; //return code
-	char* array_buf; //buffer to hold array as it's uploaded
-	if (!(array_buf = (char*) malloc(MAXARRAY))) //allocate memory for single array upload
-		return G_BAD_FULL_MEMORY;
-
-	if ((rc = GArrayUpload(g, name, G_BOUNDS, G_BOUNDS, G_CR, array_buf, MAXARRAY)) != G_NO_ERROR) //get this array's data
-		return rc;
-
-	return H_AddArray(head, name, array_buf); //push the data into the array linked list
+GReturn H_UploadArrayToList(GCon g, ArrayNode* head, char* name) {
+    GReturn rc = G_NO_ERROR;  // return code
+    char* array_buf;          // buffer to hold array as it's uploaded
+    if (!(array_buf = (char*)malloc(
+              MAXARRAY)))  // allocate memory for single array upload
+        return G_BAD_FULL_MEMORY;
+
+    if ((rc = GArrayUpload(g, name, G_BOUNDS, G_BOUNDS, G_CR, array_buf,
+                           MAXARRAY)) != G_NO_ERROR)  // get this array's data
+        return rc;
+
+    return H_AddArray(head, name,
+                      array_buf);  // push the data into the array linked list
 }
 
 //! Creates a buffer on the heap to write data, and adds it to the linked list.
-GReturn H_CreateArrayNode(ArrayNode* head, char* name)
-{
-	char* array_buf; //buffer to hold array data
-	if (!(array_buf = (char*) malloc(MAXARRAY))) //allocate memory for single array upload
-		return G_BAD_FULL_MEMORY;
-	array_buf[0] = 0; //null terminate so len is correct when added
-	return H_AddArray(head, name, array_buf); //push the data into the array linked list
+GReturn H_CreateArrayNode(ArrayNode* head, char* name) {
+    char* array_buf;  // buffer to hold array data
+    if (!(array_buf = (char*)malloc(
+              MAXARRAY)))  // allocate memory for single array upload
+        return G_BAD_FULL_MEMORY;
+    array_buf[0] = 0;  // null terminate so len is correct when added
+    return H_AddArray(head, name,
+                      array_buf);  // push the data into the array linked list
 }
 
 //! Adds an array element to an array node.
-GReturn H_ArrayAddElement(ArrayNode* node, GCStringIn element)
-{
-	int len = strlen(element);
-	if ((len + node->index + 1) >= MAXARRAY) //+1 for \r
-		return G_BAD_FULL_MEMORY;
-
-	strcpy(node->data + node->index, element); //copy the data to the array
-	node->index += len;
-	node->data[node->index++] = '\r'; //delim
-	node->data[node->index] = 0; //null terminate
-	node->len = node->index; //maintain len field	
-	node->elements++; //count the element just added
-	return G_NO_ERROR;
+GReturn H_ArrayAddElement(ArrayNode* node, GCStringIn element) {
+    int len = strlen(element);
+    if ((len + node->index + 1) >= MAXARRAY)  //+1 for \r
+        return G_BAD_FULL_MEMORY;
+
+    strcpy(node->data + node->index, element);  // copy the data to the array
+    node->index += len;
+    node->data[node->index++] = '\r';  // delim
+    node->data[node->index] = 0;       // null terminate
+    node->len = node->index;           // maintain len field
+    node->elements++;                  // count the element just added
+    return G_NO_ERROR;
 }
 
-//!Walks through the array linked list, downloading each.
+//! Walks through the array linked list, downloading each.
 /*!
-*  \warning This function will call DA and DM which modifies the controllers' array table.
-*  This should NOT be done while running record array (see RA/RC/RD) or while using the
-*  MODBUS array sharing feature (see ME). To prevent any possibility of array table issues,
-*  dimension all the arrays used in the applications with the appropriate lengths before use
-*  and comment out the *array table modification* section below.
-*/
-GReturn H_DownloadArraysFromList(GCon g, ArrayNode* head)
-{
-	ArrayNode* node = head;
-	GReturn rc = G_NO_ERROR;
-	char command[32]; //buffer for holding command calls
-	while ((node != 0) && (rc == G_NO_ERROR))
-	{
-
-		//*** Start array table modification
-		//    Deallocate the array in case it's the wrong size.
-		sprintf(command, "DA %s[]", node->name);
-		if ((rc = GCmd(g, command)) != G_NO_ERROR)
-			return rc;
-
-		//    Dimension the array with the correct length.
-		sprintf(command, "DM %s[%i]", node->name, node->elements);
-		if ((rc = GCmd(g, command)) != G_NO_ERROR)
-			return rc;
-		//*** End array table modification
-
-		rc = GArrayDownload(g, node->name, G_BOUNDS, G_BOUNDS, node->data); //download the array
-		node = node->next;
-	}
-	return rc;
+ *  \warning This function will call DA and DM which modifies the controllers'
+ * array table. This should NOT be done while running record array (see
+ * RA/RC/RD) or while using the MODBUS array sharing feature (see ME). To
+ * prevent any possibility of array table issues, dimension all the arrays used
+ * in the applications with the appropriate lengths before use and comment out
+ * the *array table modification* section below.
+ */
+GReturn H_DownloadArraysFromList(GCon g, ArrayNode* head) {
+    ArrayNode* node = head;
+    GReturn rc = G_NO_ERROR;
+    char command[32];  // buffer for holding command calls
+    while ((node != 0) && (rc == G_NO_ERROR)) {
+        //*** Start array table modification
+        //    Deallocate the array in case it's the wrong size.
+        sprintf(command, "DA %s[]", node->name);
+        if ((rc = GCmd(g, command)) != G_NO_ERROR) return rc;
+
+        //    Dimension the array with the correct length.
+        sprintf(command, "DM %s[%i]", node->name, node->elements);
+        if ((rc = GCmd(g, command)) != G_NO_ERROR) return rc;
+        //*** End array table modification
+
+        rc = GArrayDownload(g, node->name, G_BOUNDS, G_BOUNDS,
+                            node->data);  // download the array
+        node = node->next;
+    }
+    return rc;
 }
 
 //! After filling the array list, this function is called to write out the CSV.
-GReturn H_WriteArrayCsv(ArrayNode* head, GCStringIn file_path)
-{
-	if (head->count == 0) //nothing to do
-		return G_NO_ERROR;
-
-	FILE *file; //file pointer
-	size_t bytes; //length of data to write
-	size_t bytes_written; //bytes actually written to file
-	int colcount = 0; //column counter, used to prevent a trailing colon
-	int data_left = head->count; //counter for number of arrays that still have data left to be written
-	ArrayNode* node = head; //pointer to an array node in the list
-
-	if (!(file = fopen(file_path, "wb"))) //open file for writing, binary mode
-		return G_BAD_FILE;
-
-	//write the header
-	do
-	{
-		bytes = strlen(node->name);
-		bytes_written = fwrite(node->name, 1, bytes, file);
-		colcount++;
-
-		if (colcount != head->count) //write a comma if it's not the last column
-		{
-			bytes_written += fwrite(",", 1, 1, file);
-			bytes++;
-		}
-		else //write a carriage return
-		{
-			bytes_written += fwrite("\r", 1, 1, file);
-			bytes++;
-		}
-
-		if (bytes_written != bytes) //ensure we wrote what we wanted
-		{
-			fclose(file);
-			return G_BAD_FILE;
-		}
-		node = node->next;
-	} while (node != 0);
-
-
-	//now write the data
-	while (data_left) //continue writing rows as long as arrays have data to write
-	{
-		node = head;
-		colcount = 0;
-		do //write one row
-		{
-			bytes_written = 0;
-			bytes = 0;
-			if (node->index != node->len) //data available
-			{
-				while ((node->data[node->index] != '\r') //search for the carriage return delim
-					&& (node->index < node->len)) //unless we reach the end
-				{
-					if (node->data[node->index] != ' ') //don't keep spaces
-					{
-						bytes_written += fwrite(node->data + node->index, 1, 1, file);
-						bytes++;
-					}
-					node->index++;
-				}
-
-				if (node->index == node->len) //reached the end of this data
-					data_left--; //decrement counter to indicate one less array with data to write
-
-				node->index++; //jump over \r delim
-			}
-
-			colcount++; //count the cell we just filled
-			if (colcount != head->count) //write a comma if it's not the last column
-			{
-				bytes_written += fwrite(",", 1, 1, file);
-				bytes++;
-			}
-			else //write a carriage return, even on the last line
-			{
-				bytes_written += fwrite("\r", 1, 1, file);
-				bytes++;
-			}
-
-			//check for write failure
-			if (bytes_written != bytes)
-			{
-				fclose(file);
-				return G_BAD_FILE;
-			}
-
-			node = node->next;
-		} while (node != 0);
-	} //while (data_left)
-
-	fclose(file);
-	return G_NO_ERROR;
+GReturn H_WriteArrayCsv(ArrayNode* head, GCStringIn file_path) {
+    if (head->count == 0)  // nothing to do
+        return G_NO_ERROR;
+
+    FILE* file;            // file pointer
+    size_t bytes;          // length of data to write
+    size_t bytes_written;  // bytes actually written to file
+    int colcount = 0;      // column counter, used to prevent a trailing colon
+    int data_left = head->count;  // counter for number of arrays that still
+                                  // have data left to be written
+    ArrayNode* node = head;       // pointer to an array node in the list
+
+    if (!(file = fopen(file_path, "wb")))  // open file for writing, binary mode
+        return G_BAD_FILE;
+
+    // write the header
+    do {
+        bytes = strlen(node->name);
+        bytes_written = fwrite(node->name, 1, bytes, file);
+        colcount++;
+
+        if (colcount !=
+            head->count)  // write a comma if it's not the last column
+        {
+            bytes_written += fwrite(",", 1, 1, file);
+            bytes++;
+        } else  // write a carriage return
+        {
+            bytes_written += fwrite("\r", 1, 1, file);
+            bytes++;
+        }
+
+        if (bytes_written != bytes)  // ensure we wrote what we wanted
+        {
+            fclose(file);
+            return G_BAD_FILE;
+        }
+        node = node->next;
+    } while (node != 0);
+
+    // now write the data
+    while (data_left)  // continue writing rows as long as arrays have data to
+                       // write
+    {
+        node = head;
+        colcount = 0;
+        do  // write one row
+        {
+            bytes_written = 0;
+            bytes = 0;
+            if (node->index != node->len)  // data available
+            {
+                while ((node->data[node->index] !=
+                        '\r')  // search for the carriage return delim
+                       && (node->index < node->len))  // unless we reach the end
+                {
+                    if (node->data[node->index] != ' ')  // don't keep spaces
+                    {
+                        bytes_written +=
+                            fwrite(node->data + node->index, 1, 1, file);
+                        bytes++;
+                    }
+                    node->index++;
+                }
+
+                if (node->index == node->len)  // reached the end of this data
+                    data_left--;  // decrement counter to indicate one less
+                                  // array with data to write
+
+                node->index++;  // jump over \r delim
+            }
+
+            colcount++;  // count the cell we just filled
+            if (colcount !=
+                head->count)  // write a comma if it's not the last column
+            {
+                bytes_written += fwrite(",", 1, 1, file);
+                bytes++;
+            } else  // write a carriage return, even on the last line
+            {
+                bytes_written += fwrite("\r", 1, 1, file);
+                bytes++;
+            }
+
+            // check for write failure
+            if (bytes_written != bytes) {
+                fclose(file);
+                return G_BAD_FILE;
+            }
+
+            node = node->next;
+        } while (node != 0);
+    }  // while (data_left)
+
+    fclose(file);
+    return G_NO_ERROR;
 }
 
-
-GReturn GCALL GArrayDownloadFile(GCon g, GCStringIn file_path)
-{
-	FILE *file;
-	GReturn rc = G_NO_ERROR;
-	char name[32]; //buffer for holding name of array
-	int n; //index into name
-	char element[32]; //buffer for holding ascii array element value
-	int e; //index into element
-	char c; //char currently being read
-
-	//Linked list to hold array data as it's organized for download
-	ArrayNode head; //first element (list head) lives on this stack
-	ArrayNode* node; //current node
-	H_InitArrayNode(&head);
-	head.tail = &head; //circular reference
-
-	if (!(file = fopen(file_path, "rb"))) //open file for reading, binary mode
-		return G_BAD_FILE;
-
-	//read out header, making a new ArrayNode for each 
-	n = 0;
-	c = 0;
-	while (fread(&c, 1, 1, file))
-	{
-		if ((c == ',') || (c == '\r'))
-		{
-			if (n)
-			{
-				name[n] = 0; //null terminate
-				n = 0; // next time start filling name from start
-				H_CreateArrayNode(&head, name);
-			}
-
-			if (c == '\r') //end of line
-				break; //done reading headers
-		}
-		else
-		{
-			name[n++] = c;
-		}
-	}
-
-	//read each line of the file, pushing each cell into its corresponding ArrayNode
-	node = &head;
-	e = 0;
-	while (fread(&c, 1, 1, file))
-	{
-		if ((c == ',') || (c == '\r'))
-		{
-			if (e) //if anything read into element
-			{
-				element[e] = 0; //null terminate
-				H_ArrayAddElement(node, element);
-				e = 0; //start writing at start of element on next pass
-			}
-			node = node->next; //go to the next array
-			if (node == 0) node = &head; //wrap around to front
-		}
-		else
-		{
-			element[e++] = c;
-		}
-	}
-
-
-
-	fclose(file); //done with file
-
-	//By here, all the array data is in the linked-list starting at head, just download it
-	rc = H_DownloadArraysFromList(g, &head);
-	H_FreeArrays(&head); // don't forget to free memory
-	return rc;
+GReturn GCALL GArrayDownloadFile(GCon g, GCStringIn file_path) {
+    FILE* file;
+    GReturn rc = G_NO_ERROR;
+    char name[32];     // buffer for holding name of array
+    int n;             // index into name
+    char element[32];  // buffer for holding ascii array element value
+    int e;             // index into element
+    char c;            // char currently being read
+
+    // Linked list to hold array data as it's organized for download
+    ArrayNode head;   // first element (list head) lives on this stack
+    ArrayNode* node;  // current node
+    H_InitArrayNode(&head);
+    head.tail = &head;  // circular reference
+
+    if (!(file = fopen(file_path, "rb")))  // open file for reading, binary mode
+        return G_BAD_FILE;
+
+    // read out header, making a new ArrayNode for each
+    n = 0;
+    c = 0;
+    while (fread(&c, 1, 1, file)) {
+        if ((c == ',') || (c == '\r')) {
+            if (n) {
+                name[n] = 0;  // null terminate
+                n = 0;        // next time start filling name from start
+                H_CreateArrayNode(&head, name);
+            }
+
+            if (c == '\r')  // end of line
+                break;      // done reading headers
+        } else {
+            name[n++] = c;
+        }
+    }
+
+    // read each line of the file, pushing each cell into its corresponding
+    // ArrayNode
+    node = &head;
+    e = 0;
+    while (fread(&c, 1, 1, file)) {
+        if ((c == ',') || (c == '\r')) {
+            if (e)  // if anything read into element
+            {
+                element[e] = 0;  // null terminate
+                H_ArrayAddElement(node, element);
+                e = 0;  // start writing at start of element on next pass
+            }
+            node = node->next;            // go to the next array
+            if (node == 0) node = &head;  // wrap around to front
+        } else {
+            element[e++] = c;
+        }
+    }
+
+    fclose(file);  // done with file
+
+    // By here, all the array data is in the linked-list starting at head, just
+    // download it
+    rc = H_DownloadArraysFromList(g, &head);
+    H_FreeArrays(&head);  // don't forget to free memory
+    return rc;
 }
 
-
-GReturn GCALL GArrayUploadFile(GCon g, GCStringIn file_path, GCStringIn names)
-{
-
-	GReturn rc = G_NO_ERROR; //return code
-	long bytes; //strlen placeholder
-	char array_names[1024]; //buffer to hold copy of names, or response to list arrays LA
-	char name[32]; //buffer to hold a single array name
-	int i, n; //indices
-	char c; //holder for the char currently being read
-	int bracket = 0; //increments when [ seen on a line, [ marks the end of the array name
-
-	//Linked list to hold array data
-	ArrayNode head; //first element (list head) lives on this stack
-	H_InitArrayNode(&head);
-	head.tail = &head; //circular reference
-
-	if (names == 0) //check for null pointer in arg
-		bytes = 0;
-	else
-		bytes = strlen(strcpy(array_names, names));
-
-	if (bytes == 0) //null or "", need to get the arrays from the controller
-	{
-		if ((rc = GCmdT(g, "LA", array_names, sizeof(array_names), 0)) != G_NO_ERROR) //Trimming command, get names from List Arrays (LA)
-			return rc; //no mallocs yet, so we can exit without free
-
-		bytes = strlen(array_names); //count the response
-	}
-
-	n = 0; //n is name[] index
-	for (i = 0; i < bytes; i++)
-	{
-		c = array_names[i];
-
-		if (c == '[')
-			bracket++; //[ marks the end of the array name
-		
-		if ((c != ' ') && (c != '\r') && (c != '\n') && !bracket)
-		{
-			name[n++] = array_names[i]; //keep the char
-		}
-		
-		
-		if ((c == ' ') || (c == '\r') || (i == bytes - 1))
-		{
-			if (n) //if we have anything in name
-			{
-				name[n] = 0; // null terminate name
-				n = 0; // next time start filling name from start
-				bracket = 0; //forget any brackets we've seen
-
-				if ((rc = H_UploadArrayToList(g, &head, name)) != G_NO_ERROR) //Add data to list
-				{
-					H_FreeArrays(&head); // don't forget to free memory
-					return rc;
-				}
-			}
-			continue;
-		}
-
-	}
-
-	//By here, all the array data is in the linked-list starting at head.
-	rc = H_WriteArrayCsv(&head, file_path);
-	H_FreeArrays(&head); // don't forget to free memory
-	return rc;
+GReturn GCALL GArrayUploadFile(GCon g, GCStringIn file_path, GCStringIn names) {
+    GReturn rc = G_NO_ERROR;  // return code
+    long bytes;               // strlen placeholder
+    char array_names[1024];   // buffer to hold copy of names, or response to
+                              // list arrays LA
+    char name[32];            // buffer to hold a single array name
+    int i, n;                 // indices
+    char c;                   // holder for the char currently being read
+    int bracket = 0;  // increments when [ seen on a line, [ marks the end of
+                      // the array name
+
+    // Linked list to hold array data
+    ArrayNode head;  // first element (list head) lives on this stack
+    H_InitArrayNode(&head);
+    head.tail = &head;  // circular reference
+
+    if (names == 0)  // check for null pointer in arg
+        bytes = 0;
+    else
+        bytes = strlen(strcpy(array_names, names));
+
+    if (bytes == 0)  // null or "", need to get the arrays from the controller
+    {
+        if ((rc = GCmdT(g, "LA", array_names, sizeof(array_names), 0)) !=
+            G_NO_ERROR)  // Trimming command, get names from List Arrays (LA)
+            return rc;   // no mallocs yet, so we can exit without free
+
+        bytes = strlen(array_names);  // count the response
+    }
+
+    n = 0;  // n is name[] index
+    for (i = 0; i < bytes; i++) {
+        c = array_names[i];
+
+        if (c == '[') bracket++;  //[ marks the end of the array name
+
+        if ((c != ' ') && (c != '\r') && (c != '\n') && !bracket) {
+            name[n++] = array_names[i];  // keep the char
+        }
+
+        if ((c == ' ') || (c == '\r') || (i == bytes - 1)) {
+            if (n)  // if we have anything in name
+            {
+                name[n] = 0;  // null terminate name
+                n = 0;        // next time start filling name from start
+                bracket = 0;  // forget any brackets we've seen
+
+                if ((rc = H_UploadArrayToList(g, &head, name)) !=
+                    G_NO_ERROR)  // Add data to list
+                {
+                    H_FreeArrays(&head);  // don't forget to free memory
+                    return rc;
+                }
+            }
+            continue;
+        }
+    }
+
+    // By here, all the array data is in the linked-list starting at head.
+    rc = H_WriteArrayCsv(&head, file_path);
+    H_FreeArrays(&head);  // don't forget to free memory
+    return rc;
 }
diff --git a/src/libGalil/gclib.h b/src/libGalil/gclib.h
old mode 100755
new mode 100644
index d971a1f1..253dc9a2
--- a/src/libGalil/gclib.h
+++ b/src/libGalil/gclib.h
@@ -1,12 +1,12 @@
 /*! \file gclib.h
-*
-* Defines the interface for the Galil C Library (GCLIB).
-*
-*/
+ *
+ * Defines the interface for the Galil C Library (GCLIB).
+ *
+ */
 #ifndef I_D48432D9_1FA3_4C7D_B44C_05F8B9000ADF
 #define I_D48432D9_1FA3_4C7D_B44C_05F8B9000ADF
 
-//set library visibility for gcc and msvc
+// set library visibility for gcc and msvc
 #if BUILDING_GCLIB && HAVE_VISIBILITY
 #define GCLIB_DLL_EXPORTED __attribute__((__visibility__("default")))
 #elif BUILDING_GCLIB && defined _MSC_VER
@@ -17,513 +17,693 @@
 #define GCLIB_DLL_EXPORTED
 #endif
 
-#include "gclib_record.h" // Galil data record structs and unions.
-#include "gclib_errors.h" // GReturn error code values and strings.
+#include "gclib_errors.h"  // GReturn error code values and strings.
+#include "gclib_record.h"  // Galil data record structs and unions.
 
 #ifdef _WIN32
-#define GCALL __stdcall //!< Specify calling convention for Windows.
+#define GCALL __stdcall  //!< Specify calling convention for Windows.
 #else
 #define GCALL
 #endif
 
-//#define G_USE_GCOMPOUND //!< GCompound() is not part of the standard gclib release. Contact Galil Applications for a special build, http://galil.com/contact.
+//#define G_USE_GCOMPOUND //!< GCompound() is not part of the standard gclib
+//release. Contact Galil Applications for a special build,
+//http://galil.com/contact.
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-	//Constants for function arguments
-#define G_DR 1 //!< Value for GRecord() `method` variable for acquiring a data record via DR mode.
-#define G_QR 0 //!< Value for GRecord() `method` variable for acquiring a data record via QR mode.
-#define G_BOUNDS -1 //!< For functions that take range options, e.g. GArrayUpload(), use this value for full range.
-#define G_CR 0 //!< For GArrayUpload(), use this value in the delim field to delimit with carriage returns.
-#define G_COMMA 1 //!< For GArrayUpload(), use this value in the delim field to delimit with commas.
-
-	//Constants for GUtility()
-#define G_UTIL_TIMEOUT 1 //!< GUtility(), Access to timeout.
-#define G_UTIL_TIMEOUT_OVERRIDE 2 //!< GUtility(), read/write access to timeout override.
-#define G_USE_INITIAL_TIMEOUT -1 //!< GUtility(), for timeout override. Set `G_UTIL_TIMEOUT_OVERRIDE` to this value to use initial GOpen() timeout (`--timeout`).
-#define G_UTIL_VERSION 128 //!< GUtility(), get a library version string.
-#define G_UTIL_INFO 129 //!< GUtility(), get a connection info string.
-#define G_UTIL_SLEEP 130 //!< GUtility(), specify an interval to sleep.
-#define G_UTIL_ADDRESSES 131 //!< GUtility(), get a list of available connections.
-#define G_UTIL_IPREQUEST 132 //!< GUtility(), get a list of hardware requesting IPs.
-#define G_UTIL_ASSIGN 133 //!< GUtility(), assign IP addresses via Boot-P reply.
-#define G_UTIL_DEVICE_INITIALIZE 134  //!< GUtility(), sends CF, CW, EO etc. to initialize the connection. Useful after RS or other reset.	
-#define G_UTIL_PING 135 //!< GUtility(), uses ICMP ping to determine if an IP address is reachable and assigned.
+// Constants for function arguments
+#define G_DR \
+    1  //!< Value for GRecord() `method` variable for acquiring a data record
+       //!< via DR mode.
+#define G_QR \
+    0  //!< Value for GRecord() `method` variable for acquiring a data record
+       //!< via QR mode.
+#define G_BOUNDS \
+    -1  //!< For functions that take range options, e.g. GArrayUpload(), use
+        //!< this value for full range.
+#define G_CR \
+    0  //!< For GArrayUpload(), use this value in the delim field to delimit
+       //!< with carriage returns.
+#define G_COMMA \
+    1  //!< For GArrayUpload(), use this value in the delim field to delimit
+       //!< with commas.
+
+// Constants for GUtility()
+#define G_UTIL_TIMEOUT 1  //!< GUtility(), Access to timeout.
+#define G_UTIL_TIMEOUT_OVERRIDE \
+    2  //!< GUtility(), read/write access to timeout override.
+#define G_USE_INITIAL_TIMEOUT \
+    -1  //!< GUtility(), for timeout override. Set `G_UTIL_TIMEOUT_OVERRIDE` to
+        //!< this value to use initial GOpen() timeout (`--timeout`).
+#define G_UTIL_VERSION 128  //!< GUtility(), get a library version string.
+#define G_UTIL_INFO 129  //!< GUtility(), get a connection info string.
+#define G_UTIL_SLEEP 130  //!< GUtility(), specify an interval to sleep.
+#define G_UTIL_ADDRESSES \
+    131  //!< GUtility(), get a list of available connections.
+#define G_UTIL_IPREQUEST \
+    132  //!< GUtility(), get a list of hardware requesting IPs.
+#define G_UTIL_ASSIGN \
+    133  //!< GUtility(), assign IP addresses via Boot-P reply.
+#define G_UTIL_DEVICE_INITIALIZE \
+    134  //!< GUtility(), sends CF, CW, EO etc. to initialize the connection.
+         //!< Useful after RS or other reset.
+#define G_UTIL_PING \
+    135  //!< GUtility(), uses ICMP ping to determine if an IP address is
+         //!< reachable and assigned.
 
 #define G_UTIL_GCAPS_HOST 256
-#define G_UTIL_GCAPS_VERSION 257 //!< GUtility(), get the version of the @ref gcaps server.
-#define G_UTIL_GCAPS_KEEPALIVE 258 //!< GUtility(), @ref gcaps server keepalive.
-#define G_UTIL_GCAPS_ADDRESSES 259 //!< GUtility(), get a list of available connections from the @ref gcaps server.
-#define G_UTIL_GCAPS_IPREQUEST 260 //!< GUtility(), get a list of hardware requesting IPs from the @ref gcaps server.
-#define G_UTIL_GCAPS_ASSIGN 261 //!< GUtility(), assign IP addresses via Boot-P reply from the @ref gcaps server.
-#define G_UTIL_GCAPS_PING 262 //!< GUtility(), uses ICMP ping to determine if an IP address is reachable and assigned. Ping sent from the @ref gcaps server.
-
-	
-	//Convenience constants
-#define G_SMALL_BUFFER 1024 //!< Most reads/writes to Galil are small. This value will easily hold most, e.g. TH, TZ, etc.
-#define G_HUGE_BUFFER 524288 //!< Most reads/writes to Galil hardware are small. This value will hold the largest array or program upload/download possible.
-
-	typedef int GReturn; //!< Every function returns a value of type GReturn. See gclib_errors.h for possible values.
-	typedef void* GCon; //!< Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
-	typedef unsigned int GSize; //!< Size of buffers, etc.
-	typedef int GOption; //!< Option integer for various formatting, etc.
-	typedef char* GCStringOut; //!< C-string output from the library. Implies null-termination.
-	typedef const char* GCStringIn; //!< C-string input to the library.  Implies null-termination.
-	typedef char* GBufOut; //!< Data output from the library. No null-termination implied. Returned values may be null-terminated, see function documentation for details.
-	typedef const char* GBufIn; //!< Data input to the library. No null-termination, function will have a GSize to indicate bytes to write .
-	typedef unsigned char GStatus; //!< Interrupt status byte.
-	typedef void* GMemory; //!< Pointer to untyped memory for use in GUtility().
-
-	//! Open a connection to a Galil Controller.
-	GCLIB_DLL_EXPORTED GReturn GCALL GOpen(GCStringIn address, GCon* g);
-	/*!<
-	*  \param address Null-terminated address string. See table below.
-	*  \param g Pointer to user's `GCon` variable. On success, the library will fill the user's variable with the handle to use for the rest of the connection. A valid `g` value is nonzero.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  `address` switch     | Meaning                                                         | Arguments `(default), other options`  | Examples
-	*  ---------------------|-----------------------------------------------------------------|---------------------------------------|-----------------
-	*  `--address`          | **Simple address to hardware**                                  | *IP address*, *PCI*, *COM port*       | `--address COM1`
-	*  `-a`                 | shorthand for `--address`                                       |  See *Address Ranges* below           | `-a GALILPCI1`
-	*  {no switch}          | `--address` is implicit for any lone token                      |                                       | `192.168.0.42`
-	*  `--baud`             | **Baud rate**                                                   | (`115200`), *valid baud...*           | `COM2 --baud 19200`
-	*  `-b`                 | shorthand for `--baud`                                          |                                       | `COM3 -b 38400`
-	*  `--command`          | **Command-and-response socket protocol**                        |  (`TCP`), `UDP`                       | `192.168.0.42 --command TCP`
-	*  `-c`                 | shorthand for `--command`                                       |                                       | `192.168.0.42 -c UDP`
-	*  `--direct`           | **Connect directly to hardware instead of via** @ref gcaps      |                                       | `-a GALILPCI2 --direct`
-	*  `-d`                 | shorthand for `--direct`                                        |                                       | `GALILPCI2 -d`
-	*  `--handshake`        | **Serial Handshake mode**                                       | (`HARDWARE`), `NONE`                  | `COM1 --handshake NONE`
-	*  `--p1`               | **Primary port for command-and-response traffic**               | (`23`), *valid port number*           | `192.168.0.42 --p1 5000`
-	*  `--p2`               | **Secondary port for unsolicited traffic**                      | (`60007`), *valid port number*        | `192.168.0.42 --p2 5000`
-	*  `--subscribe`        | **Subscribe to messages, data records, and/or interrupts**      | (`NONE`), `MG`, `DR`, `EI`, `ALL`     | `192.168.0.42 --subscribe MG`
-	*  `-s`                 | shorthand for `--subscribe`                                     |                                       | `192.168.0.42 -s DR -s EI`
-	*  `--timeout`          | **timeout in ms**                                               | (`5000`), *0-65535*                   | `192.168.0.42 --timeout 5000`
-	*  `-t`                 | shorthand for `--timeout`                                       |                                       | `GALILPCI2 -t 500`
-	*  `--unsolicited`      | **Unsolicited socket protocol**                                 | (`UDP`), `TCP`, `NONE`                | `192.168.0.42 --unsolicited TCP`
-	*  `-u`                 | shorthand for `--unsolicited`                                   |                                       | `192.168.1.42 -u NONE`
-	*
-	*
-	*
-	*  Operating System     |  Address Range                     | Notes
-	*  ---------------------|------------------------------------|------------------------------
-	*  Windows              | `COM1` - `COM256`                  | RS232 and USB-to-serial
-	*  Linux                | `/dev/ttyS0` - `/dev/ttyS255`      | RS232
-	*  Linux                | `/dev/ttyUSB0` - `/dev/ttyUSB255`  | USB-to-serial, e.g. DMC-4103
-	*  Windows              | `GALILPCI1` - `GALILPCI8`          | PCI 
-	*  Linux                | `/dev/galilpci0` - `/dev/galilpci7`| PCI 
-	*
-	*  See x_examples.cpp for an example.
-	*
-	*  When connecting to a network device, if the command-and-response socket is opened successfully but the unsolicited socket fails, GOpen() will still
-	*  complete successfully. This allows connection to a Galil controller when only one Ethernet handle is available. Unsolicited traffic will not be accessible
-	*  in this case.
-	*/
-
-
-	//! Closes a connection to a Galil Controller.
-	GCLIB_DLL_EXPORTED GReturn GCALL GClose(GCon g);
-	/*!<
-	* \attention
-	*  *gclib* requires that `GClose()` be called whenever a program is finished with a controller.
-	*  This includes when a program closes. A rule of thumb is that for every `GOpen()` call on a given connection,
-	*  a `GClose()` call should be found on every code path. Failing to call GClose() may cause controller resources
-	*  to not be released or can hang the process if there are outstanding asynchronous operations. The latter can
-	*  occur, for example, if a call to GRead() times out and the process exits without calling GClose(). In this case, 
-	*  GRead() still has an outstanding asynchronous read pending. GClose() will terminate this operation allowing the process 
-	*  to exit correctly.
-	*
-	*  \param g Connection's handle.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_examples.cpp for an example.
-	*/
-
-
-	//! Performs a read on the connection.
-	GCLIB_DLL_EXPORTED GReturn GCALL GRead(GCon g, GBufOut buffer, GSize buffer_len, GSize* bytes_read);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param buffer The user's read buffer.
-	*  \param buffer_len The length of the user's read buffer.
-	*  \param bytes_read Pointer to a GSize which will be filled with the number of bytes read upon return.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  \warning This function is deprecated and will be removed in a future gclib version. Please contact Galil
-	*  for needs not covered by the other gclib functions.
-	*
-	*  Unsolicited messages may be returned in the read data. 
-	*  The high bit of each message byte will be set unless the user changes the CW setting.
-	*  Interrupts and Data Records are always filtered from a read.
-	*
-	*  See x_gread_gwrite.cpp for an example.
-	*/
-
-
-	//! Performs a write on the connection.
-	GCLIB_DLL_EXPORTED GReturn GCALL GWrite(GCon g, GBufIn buffer, GSize buffer_len);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param buffer The user's write buffer. To send a Galil command, a terminating carriage return is usually required.
-	*  \param buffer_len The length of the data in the buffer.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*          If G_NO_ERROR is returned, all bytes were written.
-	*
-	*  \warning This function is deprecated and will be removed in a future gclib version. Please contact Galil
-	*  for needs not covered by the other gclib functions.
-	*
-	*  See x_gread_gwrite.cpp for an example.
-	*/
-
-
-	//! Performs a *command-and-response* transaction on the connection.
-	GCLIB_DLL_EXPORTED GReturn GCALL GCommand(GCon g, GCStringIn command, GBufOut buffer, GSize buffer_len, GSize* bytes_returned);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param command Null-terminated command string to send to the controller. The library will append a carriage return to the command string.
-	*  \param buffer Buffer for the response. Will be filled with the response from the controller.
-	*  The data will be null terminated unless function returns `G_BAD_LOST_DATA` due to the buffer being too small to hold the data.
-	*  \param buffer_len The size of the response buffer.
-	*  \param bytes_returned The size of the data returned from the controller. This does not include null termination.
-	*  This argument may be null if the value is not desired.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_gcommand.cpp for an example.
-	*/
-
-
-	//! Downloads a program to the controller's program buffer.
-	GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload(GCon g, GCStringIn program, GCStringIn preprocessor);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param program Null-terminated program for download.
-	*  \param preprocessor Options string for preprocessing the program before sending it to the controller.
-  *         Null allows the library to use defaults for the download.
-  *         See the \ref preprocessor documentation for options.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-  *
-	*  See x_programs.cpp for an example.
-	*/
-
-
-	//! Uploads a program from the controller's program buffer.
-	GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload(GCon g, GBufOut buffer, GSize buffer_len);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param buffer Buffer to receive the controller's program. The data will be null terminated unless function returns `G_BAD_LOST_DATA` due to the buffer being too small to hold the data.
-	*  \param buffer_len The length of the receive buffer.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_programs.cpp for an example.
-	*/
-
-
-	//! Downloads array data to a pre-dimensioned array in the controller's array table.
-	GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownload(GCon g, const GCStringIn array_name, GOption first, GOption last, GCStringIn buffer);
-	/*!<
-	*  \warning The array must already exist on the controller and be sufficient dimension to hold the desired array data, e.g. via `DM`.
-	*
-	*  \param g Connection's handle.
-	*  \param array_name Null-terminated string containing the name of the array to download. Must match the array name used in `DM`.
-	*  \param first The first element of the array for sub-array downloads. `G_BOUNDS` to omit.
-	*  \param last The last element of the array for sub-array downloads. `G_BOUNDS` to omit.
-	*  \param buffer Buffer containing the null-terminated data to be sent to the controller. The array data may be separated with *carriage return*, *carriage return + line feed*, or a *comma*. No spaces.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_arrays.cpp for an example.
-	*/
-
-
-	//! Uploads array data from the controller's array table.
-	GCLIB_DLL_EXPORTED GReturn GCALL GArrayUpload(GCon g, const GCStringIn array_name, GOption first, GOption last, GOption delim, GBufOut buffer, GSize buffer_len);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param array_name Null-terminated string containing the name of the array to upload.
-	*  \param first The first element of the array for sub-array uploads. `G_BOUNDS` to omit.
-	*  \param last The last element of the array for sub-array uploads. `G_BOUNDS` to omit.
-	*  \param delim Sets the delimeter between array elements in the returned data, `G_CR` specifies carriage return, `G_COMMA` specifies comma.
-	*  \param buffer Buffer to receive the uploaded data. The data will be null terminated unless function returns `G_BAD_LOST_DATA` due to the buffer being too small to hold the data.
-	*  \param buffer_len The length of the receive buffer.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_arrays.cpp for an example.
-	*/
-
-
-	//! Provides a fresh copy of the controller's data record. Data is cast into a union, GDataRecord.
-	GCLIB_DLL_EXPORTED GReturn GCALL GRecord(GCon g, union GDataRecord* record, GOption method);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param record A pointer to the user's DataRecord union to hold the copy.
-	*  \param method Determines the method for acquiring the data.
-	*         * `G_QR`: QR is used via command-and-response.
-	*         * `G_DR`: DR is used for asynchronous acquisition.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  When using `G_DR`, the asynchronous data record must already be set up.
-	*    * `-s DR` must be used in the GOpen() `address` string to subscribe to records. The driver will automatically set the second argument of `DR`, where applicable.
-	*    * `GRecordRate()` should be issued to set `DR` to an appropriate interval, n. The interval must be no faster than the rate at which  GRecord() is called.
-	*
-	*  GRecord() will block until the data record is received, or the transaction times out.
-	*
-	*  \note If this function is called with a timeout of zero and the G_DR method, a non-blocking read is performed. 
-	*  If a data record has been processed since the last time the function was called,
-	*  this data will be returned. If there is not a processed data reecord, but there is data waiting in the socket or PCI FIFO, one read will be performed to process the waiting
-	*  data. If new data is still not found after these two attempts, G_GCLIB_NON_BLOCKING_READ_EMPTY will be returned.
-	*
-	*  See x_grecord.cpp for an example.
-	*  See x_nonblocking.cpp for an example of non-blocking usage.
-	*/
-
-
-	//! Provides access to unsolicited messages from the controller.
-	GCLIB_DLL_EXPORTED GReturn GCALL GMessage(GCon g, GCStringOut buffer, GSize buffer_len);
-	/*!<
-	*  To use this function, `-s MG` must be used in the GOpen() `address` string to subscribe to messages.
-	*  Unsolicited bytes must be flagged by the high-bit setting, `CW 1`. The driver will automatically set this when subscribing to messages. The user should not overwrite this setting.
-	*
-	*  Unsolicited messages are data generated by the controller that are not in response to a command, a data record, or an interrupt. Examples follow.
-	*  -# Data generated by the `MG` command from embedded code. `MG` sent from the host is solicited.
-	*  -# Any command in an embedded program that returns data, e.g. `TP`, `RP`, `var=?`
-	*  -# A run time error in an embedded program, e.g. `?55 i=var`
-	*
-	*  \note Messages are unframed byte streams. There is no guarantee that the user will get complete messages or single messages in a call to GMessage().
-	*
-	*  \param g Connection's handle.
-	*  \param buffer The buffer to write the message data. The buffer will be null terminated.
-	*  \param buffer_len The length of the user's buffer.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  GMessage() will block until a message is received, or the function times out. 
-	*
-	*  \note If this function is called with a timeout of zero, a non-blocking read is performed. If message data has been processed since the last time the function was called,
-	*  this data will be returned. If there is no processed message data, but there is data waiting in the socket or PCI FIFO, one read will be performed to process the waiting
-	*  data. If new data is still not found after these two attempts, G_GCLIB_NON_BLOCKING_READ_EMPTY will be returned.
-	*
-	*  \warning When sending message streams through @ref gcaps, the following non-printable bytes are illegal, `$00-$07` and `$10-$17`. These bytes may be routed to a third party 
-	*  device such as am HMI or display panel. See MG and CF.
-	*
-	*  See x_gmessage.cpp for an example.
-	*  See x_nonblocking.cpp for an example of non-blocking usage.
-	*/
-
-
-	//! Provides access to PCI and UDP interrupts from the controller.
-	GCLIB_DLL_EXPORTED GReturn GCALL GInterrupt(GCon g, GStatus* status_byte);
-	/*!<
-	*  Interrupts can be generated automatically by the firmware on important events via `EI` (Enable Interrupt) or by the user in embedded DMC code via `UI` (User Interrupt).
-	*  To use this function, `-s EI` must be used in the GOpen() address string to subscribe to interrupts.
-	*
-	*  \param g  Connection's handle.
-	*  \param status_byte A pointer to a GStatus to receive the status byte.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  GInterrupt() will block until an interrupt is received, or the function times out.  
-	*
-	*  \note If this function is called with a timeout of zero, a non-blocking read is performed. If interrupt data is waiting in the interrupt queue,
-	*  the oldest byte will be popped off the queue. If there is no interrupt data queued, but there is data waiting in the socket or PCI FIFO, one read will be performed to process the waiting
-	*  data. If new data is still not found after these two attempts, G_GCLIB_NON_BLOCKING_READ_EMPTY will be returned.
-	*
-	*  See x_ginterrupt.cpp for an example.
-	*  See x_nonblocking.cpp for an example of non-blocking usage.
-	*/
-
-
-	//! Upgrade firmware.
-	GCLIB_DLL_EXPORTED GReturn GCALL GFirmwareDownload(GCon g, GCStringIn filepath);
-	/*!<
-	*  \param g  Connection's handle.
-	*  \param filepath The full file path to the Galil-supplied firmware hex file. See http://www.galil.com/downloads/firmware
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  \code{.cpp}
-	*  ec(GInfo(g, buf, sizeof(buf))); //get conntroller info
-	*  cout << buf << '\n'; //print the info
-	*  ec(GFirmwareDownload(g, "F:/1806.dmc/dmc-1806-r11a.hex"));
-	*  ec(GInfo(g, buf, sizeof(buf))); //get the info again
-	*  cout << buf << '\n';
-	*  // example output:
-	*  // GALILPCI1, DMC1846 Rev 1.1a-CM, 4232
-	*  // GALILPCI1, DMC1846 Rev 1.1a, 4232
-	*  \endcode
-	*/
-
-
-	//! Provides read/write access to driver settings and convenience features based on the request variable.
-	GCLIB_DLL_EXPORTED GReturn GCALL GUtility(GCon g, GOption request, GMemory memory1, GMemory memory2);
-	/*!<
-	*
-	*  \note The open source library, gclibo.h, has wrappers for most of these utilities.
-	*
-	*  \param g Connection's handle.
-	*  \param request Defines the request. Input/Output and type of memory are implicit in the value of request. The following lists the supported request values.
-	*
-	*    * @ref G_UTIL_TIMEOUT Read initial timeout value, as specified in GOpen() via `--timeout` switch. 
-	*      * `memory1` is output and must be an `unsigned short*`. 
-	*      * `memory2` is ignored, use null.
-	*
-	*    * @ref G_UTIL_TIMEOUT_OVERRIDE See GTimeout(). Write/Read override timeout value. 
-	*      * `memory1` is input. If nonnull, value must be a `short*` holding the override, in milliseconds, for the timeout. 
-	*         Write `G_USE_INITIAL_TIMEOUT` to use initial timeout. If null, no write occurs. 
-	*      * `memory2` is output. If nonnul, value must be a `short*` which will be filled with the current override.
-	*        `G_USE_INITIAL_TIMEOUT` indicates initial timeout used. If null, no read occurs. `memory2` is processed before 'memory1`.
-	*
-	*    * @ref G_UTIL_VERSION See GVersion(). Returns the library version. A valid connection (g) is not necessary, i.e. g may be null.
-	*      * `memory1` is output, and must be a `char*`. Data will be null terminated, even if the data must be truncated to do so. 
-	*      * `memory2` is input and must be an `unsigned int*` holding the length of the buffer in `memory1`.
-	*
-	*    * @ref G_UTIL_INFO See GInfo(). Returns information about the connection.
-	*      * `memory1` is output and must be a `char*`. Data will be null terminated, even if the data must be truncated to do so.
-	*      * `memory2` is input and must be an `unsigned int*` holding the length of the buffer in `memory1`.
-	*
-	*    * @ref G_UTIL_SLEEP See GSleep(). Platform-independent, non-busy, sleep. A valid connection (g) is not necessary, i.e. g may be null.
-	*      * `memory1` is input and must be an `unsigned int*`, units are milliseconds. 
-	*      * `memory2` is ignored, use null.
-	*
-	*    * @ref G_UTIL_ADDRESSES see GAddresses(). Provides a \\n delimited listing of all available IP addresses, PCI addresses, and COM ports.
-	*      A valid connection (g) is not necessary, i.e. g may be null. The suffix `-d` will be appended to each address to indicate
-	*      these addresses are available via direct connection. See `G_UTIL_GCAPS_ADDRESSES` for addresses through @ref gcaps.
-	*      * `memory1` is output and must be a `char*`. Data will be null terminated, even if the data must be truncated to do so. 
-	*      * `memory2` is input and must be an `unsigned int*` holding the length of the buffer in `memory1`.
-	*
-	*    * @ref G_UTIL_IPREQUEST see GIpRequests(). Listens and returns a \\n delimited listing of Galil MAC addresses sending BOOT-P or DHCP requests.
-	*      The function will listen, and block, for roughly 5 seconds. A valid connection (g) is not necessary, i.e. g may be null.
-	*      * `memory1` is output and must be a `char*`. Data will be null terminated, even if the data must be truncated to do so.
-	*      * `memory2` is input and must be an `unsigned int*` holding the length of the buffer in `memory1`.
-	*
-	*    * @ref G_UTIL_ASSIGN see GAssign(). Provides a method to assign an IP address given a Galil MAC address.
-	*      A valid connection (g) is not necessary, i.e. g may be null.
-	*      * `memory1` is input and must be a `char*` containing the null terminated address that is to be assigned. e.g. `"192.168.0.43"`.
-	*      * `memory2` is input and must be a `char*` containing the null terminated controller MAC address. e.g. `"00:50:4C:20:01:23"`.
-	*
-	*    * @ref G_UTIL_DEVICE_INITIALIZE Provides a method to reinitialize a connection after a reset, e.g. an RS command. 
-	*      Depending on the device type, the appropriate commands will be sent to
-	*      configure the communication bus for optimal performance.
-	*      * `memory1` is ignored, use null.
-	*      * `memory2` is ignored, use null.
-	*
-	*    * @ref G_UTIL_PING Uses ICMP ping to determine if an IP address is reachable and assigned.
-	*      A valid connection (g) is not necessary, i.e. g may be null.
-	*      * `memory1` is input and must be a `char*` containing the null terminated address that is to be pinged. e.g. `"192.168.0.43"`.
-	*      * `memory2` is output and must be an `int*`. The value will be set to zero if the ping times out, and nonzero if a ping reply is returned.
-	*
-	*    ###The following request values are for use with a @ref gcaps server.
-	*
-	*    * @ref G_UTIL_GCAPS_VERSION see GVersion(). Returns the @ref gcaps server version. A valid connection (g) is not necessary, i.e. g may be null. 
-	*      This operation will connect to the server to determine the version. 
-	*      * `memory1` is output and must be a `char*`. Data will be null terminated, even if the data must be truncated to do so.
-	*      * `memory2` is input and must be an `unsigned int*` holding the length of the buffer in `memory1`.
-	*
-	*    * @ref G_UTIL_GCAPS_KEEPALIVE Provides a method for kicking the @ref gcaps server. After a default period of 10 minutes of inactivity, 
-	*      @ref gcaps will disconnect the gclib client. To prevent a disconnect, communicate with the hardware or call `G_UTIL_GCAPS_KEEPALIVE`
-	*      within the timeout period to reset the timer. The current interval can be optionally read and overwritten, however, the keep alive signal
-	*      is only sent if `memory1` and `memory2` are both null.
-	*      * `memory1` is output. If nonnull, value must be an `unsinged int*` which will be filled with the current @ref gcaps timeout, in ms.
-	*      * `memory2` is input. If nonnull, value must be an `unsinged int*` holding the new @ref gcaps timeout, in ms, for connection `g`.
-	*
-	*    * @ref G_UTIL_GCAPS_ADDRESSES see GAddresses(). Provides a \\n delimited listing of all available IP addresses, PCI addresses,
-	*      and COM ports as available from the @ref gcaps server. A valid connection (g) is not necessary, i.e. g may be null.
-	*      * `memory1` is output and must be a `char*`. Data will be null terminated, even if the data must be truncated to do so.
-	*      * `memory2` is input and must be an `unsigned int*` holding the length of the buffer in `memory1`.
-	*
-	*    * @ref G_UTIL_GCAPS_IPREQUEST see GIpRequests(). Connects to @ref gcaps and returns a \\n delimited listing of Galil MAC addresses sending BOOT-P or DHCP requests.
-	*      The function will block for roughly 5 seconds. A valid connection (g) is not necessary, i.e. g may be null.
-	*      * `memory1` is output and must be a `char*`. Data will be null terminated, even if the data must be truncated to do so.
-	*      * `memory2` is input and must be an `unsigned int*` holding the length of the buffer in `memory1`.
-	*
-	*    * @ref G_UTIL_GCAPS_ASSIGN see GAssign(). Provides a method to assign an IP address through @ref gcaps given a Galil MAC address.
-	*      A valid connection (g) is not necessary, i.e. g may be null.
-	*      * `memory1` is input and must be a `char*` containing the null terminated address that is to be assigned. e.g. `"192.168.0.43"`.
-	*      * `memory2` is input and must be a `char*` containing the null terminated controller MAC address. e.g. `"00:50:4C:20:01:23"`.
-	*	
-	*    * @ref G_UTIL_GCAPS_PING Uses ICMP ping to determine if an IP address is reachable and assigned. Ping sent from the @ref gcaps server.
-	*      A valid connection (g) is not necessary, i.e. g may be null.
-	*      * `memory1` is input and must be a `char*` containing the null terminated address that is to be pinged. e.g. `"192.168.0.43"`.
-	*      * `memory2` is output and must be an `int*`. The value will be set to zero if the ping times out, and nonzero if a ping reply is returned.
-	*
-	*  \param memory1 An untyped pointer to data required for request. The data type is defined by the request variable.
-	*  \param memory2 An untyped pointer to data required for request. The data type is defined by the request variable.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See the following functions from gclibo, the open source portion, for implementation of several GUtility() requests.:
-	*    * GAddresses()
-	*    * GAssign()
-	*    * GInfo()
-	*    * GIpRequests()
-	*    * GSleep()
-	*    * GTimeout()
-	*    * GVersion()
-	*	
-	*/
-
+#define G_UTIL_GCAPS_VERSION \
+    257  //!< GUtility(), get the version of the @ref gcaps server.
+#define G_UTIL_GCAPS_KEEPALIVE \
+    258  //!< GUtility(), @ref gcaps server keepalive.
+#define G_UTIL_GCAPS_ADDRESSES \
+    259  //!< GUtility(), get a list of available connections from the @ref
+         //!< gcaps server.
+#define G_UTIL_GCAPS_IPREQUEST \
+    260  //!< GUtility(), get a list of hardware requesting IPs from the @ref
+         //!< gcaps server.
+#define G_UTIL_GCAPS_ASSIGN \
+    261  //!< GUtility(), assign IP addresses via Boot-P reply from the @ref
+         //!< gcaps server.
+#define G_UTIL_GCAPS_PING \
+    262  //!< GUtility(), uses ICMP ping to determine if an IP address is
+         //!< reachable and assigned. Ping sent from the @ref gcaps server.
+
+// Convenience constants
+#define G_SMALL_BUFFER \
+    1024  //!< Most reads/writes to Galil are small. This value will easily hold
+          //!< most, e.g. TH, TZ, etc.
+#define G_HUGE_BUFFER \
+    524288  //!< Most reads/writes to Galil hardware are small. This value will
+            //!< hold the largest array or program upload/download possible.
+
+typedef int GReturn;  //!< Every function returns a value of type GReturn. See
+                      //!< gclib_errors.h for possible values.
+typedef void* GCon;   //!< Connection handle. Unique for each connection in
+                      //!< process. Assigned a non-zero value in GOpen().
+typedef unsigned int GSize;  //!< Size of buffers, etc.
+typedef int GOption;         //!< Option integer for various formatting, etc.
+typedef char* GCStringOut;   //!< C-string output from the library. Implies
+                             //!< null-termination.
+typedef const char*
+    GCStringIn;  //!< C-string input to the library.  Implies null-termination.
+typedef char* GBufOut;  //!< Data output from the library. No null-termination
+                        //!< implied. Returned values may be null-terminated,
+                        //!< see function documentation for details.
+typedef const char*
+    GBufIn;  //!< Data input to the library. No null-termination, function will
+             //!< have a GSize to indicate bytes to write .
+typedef unsigned char GStatus;  //!< Interrupt status byte.
+typedef void* GMemory;  //!< Pointer to untyped memory for use in GUtility().
+
+//! Open a connection to a Galil Controller.
+GCLIB_DLL_EXPORTED GReturn GCALL GOpen(GCStringIn address, GCon* g);
+/*!<
+ *  \param address Null-terminated address string. See table below.
+ *  \param g Pointer to user's `GCon` variable. On success, the library will
+ * fill the user's variable with the handle to use for the rest of the
+ * connection. A valid `g` value is nonzero.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  `address` switch     | Meaning | Arguments `(default), other options`  |
+ * Examples
+ *  ---------------------|-----------------------------------------------------------------|---------------------------------------|-----------------
+ *  `--address`          | **Simple address to hardware** | *IP address*, *PCI*,
+ * *COM port*       | `--address COM1`
+ *  `-a`                 | shorthand for `--address` |  See *Address Ranges*
+ * below           | `-a GALILPCI1` {no switch}          | `--address` is
+ * implicit for any lone token                      | | `192.168.0.42`
+ *  `--baud`             | **Baud rate** | (`115200`), *valid baud...* | `COM2
+ * --baud 19200`
+ *  `-b`                 | shorthand for `--baud` | | `COM3 -b 38400`
+ *  `--command`          | **Command-and-response socket protocol** |  (`TCP`),
+ * `UDP`                       | `192.168.0.42 --command TCP`
+ *  `-c`                 | shorthand for `--command` | | `192.168.0.42 -c UDP`
+ *  `--direct`           | **Connect directly to hardware instead of via** @ref
+ * gcaps      |                                       | `-a GALILPCI2 --direct`
+ *  `-d`                 | shorthand for `--direct` | | `GALILPCI2 -d`
+ *  `--handshake`        | **Serial Handshake mode** | (`HARDWARE`), `NONE` |
+ * `COM1 --handshake NONE`
+ *  `--p1`               | **Primary port for command-and-response traffic** |
+ * (`23`), *valid port number*           | `192.168.0.42 --p1 5000`
+ *  `--p2`               | **Secondary port for unsolicited traffic** |
+ * (`60007`), *valid port number*        | `192.168.0.42 --p2 5000`
+ *  `--subscribe`        | **Subscribe to messages, data records, and/or
+ * interrupts**      | (`NONE`), `MG`, `DR`, `EI`, `ALL`     | `192.168.0.42
+ * --subscribe MG`
+ *  `-s`                 | shorthand for `--subscribe` | | `192.168.0.42 -s DR
+ * -s EI`
+ *  `--timeout`          | **timeout in ms** | (`5000`), *0-65535* |
+ * `192.168.0.42 --timeout 5000`
+ *  `-t`                 | shorthand for `--timeout` | | `GALILPCI2 -t 500`
+ *  `--unsolicited`      | **Unsolicited socket protocol** | (`UDP`), `TCP`,
+ * `NONE`                | `192.168.0.42 --unsolicited TCP`
+ *  `-u`                 | shorthand for `--unsolicited` | | `192.168.1.42 -u
+ * NONE`
+ *
+ *
+ *
+ *  Operating System     |  Address Range                     | Notes
+ *  ---------------------|------------------------------------|------------------------------
+ *  Windows              | `COM1` - `COM256`                  | RS232 and
+ * USB-to-serial Linux                | `/dev/ttyS0` - `/dev/ttyS255`      |
+ * RS232 Linux                | `/dev/ttyUSB0` - `/dev/ttyUSB255`  |
+ * USB-to-serial, e.g. DMC-4103 Windows              | `GALILPCI1` - `GALILPCI8`
+ * | PCI Linux                | `/dev/galilpci0` - `/dev/galilpci7`| PCI
+ *
+ *  See x_examples.cpp for an example.
+ *
+ *  When connecting to a network device, if the command-and-response socket is
+ * opened successfully but the unsolicited socket fails, GOpen() will still
+ *  complete successfully. This allows connection to a Galil controller when
+ * only one Ethernet handle is available. Unsolicited traffic will not be
+ * accessible in this case.
+ */
+
+//! Closes a connection to a Galil Controller.
+GCLIB_DLL_EXPORTED GReturn GCALL GClose(GCon g);
+/*!<
+ * \attention
+ *  *gclib* requires that `GClose()` be called whenever a program is finished
+ * with a controller. This includes when a program closes. A rule of thumb is
+ * that for every `GOpen()` call on a given connection, a `GClose()` call should
+ * be found on every code path. Failing to call GClose() may cause controller
+ * resources to not be released or can hang the process if there are outstanding
+ * asynchronous operations. The latter can occur, for example, if a call to
+ * GRead() times out and the process exits without calling GClose(). In this
+ * case, GRead() still has an outstanding asynchronous read pending. GClose()
+ * will terminate this operation allowing the process to exit correctly.
+ *
+ *  \param g Connection's handle.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_examples.cpp for an example.
+ */
+
+//! Performs a read on the connection.
+GCLIB_DLL_EXPORTED GReturn GCALL GRead(GCon g, GBufOut buffer, GSize buffer_len,
+                                       GSize* bytes_read);
+/*!<
+ *  \param g Connection's handle.
+ *  \param buffer The user's read buffer.
+ *  \param buffer_len The length of the user's read buffer.
+ *  \param bytes_read Pointer to a GSize which will be filled with the number of
+ * bytes read upon return.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  \warning This function is deprecated and will be removed in a future gclib
+ * version. Please contact Galil for needs not covered by the other gclib
+ * functions.
+ *
+ *  Unsolicited messages may be returned in the read data.
+ *  The high bit of each message byte will be set unless the user changes the CW
+ * setting. Interrupts and Data Records are always filtered from a read.
+ *
+ *  See x_gread_gwrite.cpp for an example.
+ */
+
+//! Performs a write on the connection.
+GCLIB_DLL_EXPORTED GReturn GCALL GWrite(GCon g, GBufIn buffer,
+                                        GSize buffer_len);
+/*!<
+ *  \param g Connection's handle.
+ *  \param buffer The user's write buffer. To send a Galil command, a
+ * terminating carriage return is usually required. \param buffer_len The length
+ * of the data in the buffer.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values. If G_NO_ERROR is returned, all bytes were written.
+ *
+ *  \warning This function is deprecated and will be removed in a future gclib
+ * version. Please contact Galil for needs not covered by the other gclib
+ * functions.
+ *
+ *  See x_gread_gwrite.cpp for an example.
+ */
+
+//! Performs a *command-and-response* transaction on the connection.
+GCLIB_DLL_EXPORTED GReturn GCALL GCommand(GCon g, GCStringIn command,
+                                          GBufOut buffer, GSize buffer_len,
+                                          GSize* bytes_returned);
+/*!<
+ *  \param g Connection's handle.
+ *  \param command Null-terminated command string to send to the controller. The
+ * library will append a carriage return to the command string. \param buffer
+ * Buffer for the response. Will be filled with the response from the
+ * controller. The data will be null terminated unless function returns
+ * `G_BAD_LOST_DATA` due to the buffer being too small to hold the data. \param
+ * buffer_len The size of the response buffer. \param bytes_returned The size of
+ * the data returned from the controller. This does not include null
+ * termination. This argument may be null if the value is not desired.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_gcommand.cpp for an example.
+ */
+
+//! Downloads a program to the controller's program buffer.
+GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload(GCon g, GCStringIn program,
+                                                  GCStringIn preprocessor);
+/*!<
+ *  \param g Connection's handle.
+ *  \param program Null-terminated program for download.
+ *  \param preprocessor Options string for preprocessing the program before
+ * sending it to the controller. Null allows the library to use defaults for the
+ * download. See the \ref preprocessor documentation for options.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *
+ *  See x_programs.cpp for an example.
+ */
+
+//! Uploads a program from the controller's program buffer.
+GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload(GCon g, GBufOut buffer,
+                                                GSize buffer_len);
+/*!<
+ *  \param g Connection's handle.
+ *  \param buffer Buffer to receive the controller's program. The data will be
+ * null terminated unless function returns `G_BAD_LOST_DATA` due to the buffer
+ * being too small to hold the data. \param buffer_len The length of the receive
+ * buffer.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_programs.cpp for an example.
+ */
+
+//! Downloads array data to a pre-dimensioned array in the controller's array
+//! table.
+GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownload(GCon g,
+                                                const GCStringIn array_name,
+                                                GOption first, GOption last,
+                                                GCStringIn buffer);
+/*!<
+ *  \warning The array must already exist on the controller and be sufficient
+ * dimension to hold the desired array data, e.g. via `DM`.
+ *
+ *  \param g Connection's handle.
+ *  \param array_name Null-terminated string containing the name of the array to
+ * download. Must match the array name used in `DM`. \param first The first
+ * element of the array for sub-array downloads. `G_BOUNDS` to omit. \param last
+ * The last element of the array for sub-array downloads. `G_BOUNDS` to omit.
+ *  \param buffer Buffer containing the null-terminated data to be sent to the
+ * controller. The array data may be separated with *carriage return*, *carriage
+ * return + line feed*, or a *comma*. No spaces.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_arrays.cpp for an example.
+ */
+
+//! Uploads array data from the controller's array table.
+GCLIB_DLL_EXPORTED GReturn GCALL GArrayUpload(GCon g,
+                                              const GCStringIn array_name,
+                                              GOption first, GOption last,
+                                              GOption delim, GBufOut buffer,
+                                              GSize buffer_len);
+/*!<
+ *  \param g Connection's handle.
+ *  \param array_name Null-terminated string containing the name of the array to
+ * upload. \param first The first element of the array for sub-array uploads.
+ * `G_BOUNDS` to omit. \param last The last element of the array for sub-array
+ * uploads. `G_BOUNDS` to omit. \param delim Sets the delimeter between array
+ * elements in the returned data, `G_CR` specifies carriage return, `G_COMMA`
+ * specifies comma. \param buffer Buffer to receive the uploaded data. The data
+ * will be null terminated unless function returns `G_BAD_LOST_DATA` due to the
+ * buffer being too small to hold the data. \param buffer_len The length of the
+ * receive buffer.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_arrays.cpp for an example.
+ */
+
+//! Provides a fresh copy of the controller's data record. Data is cast into a
+//! union, GDataRecord.
+GCLIB_DLL_EXPORTED GReturn GCALL GRecord(GCon g, union GDataRecord* record,
+                                         GOption method);
+/*!<
+ *  \param g Connection's handle.
+ *  \param record A pointer to the user's DataRecord union to hold the copy.
+ *  \param method Determines the method for acquiring the data.
+ *         * `G_QR`: QR is used via command-and-response.
+ *         * `G_DR`: DR is used for asynchronous acquisition.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  When using `G_DR`, the asynchronous data record must already be set up.
+ *    * `-s DR` must be used in the GOpen() `address` string to subscribe to
+ * records. The driver will automatically set the second argument of `DR`, where
+ * applicable.
+ *    * `GRecordRate()` should be issued to set `DR` to an appropriate interval,
+ * n. The interval must be no faster than the rate at which  GRecord() is
+ * called.
+ *
+ *  GRecord() will block until the data record is received, or the transaction
+ * times out.
+ *
+ *  \note If this function is called with a timeout of zero and the G_DR method,
+ * a non-blocking read is performed. If a data record has been processed since
+ * the last time the function was called, this data will be returned. If there
+ * is not a processed data reecord, but there is data waiting in the socket or
+ * PCI FIFO, one read will be performed to process the waiting data. If new data
+ * is still not found after these two attempts, G_GCLIB_NON_BLOCKING_READ_EMPTY
+ * will be returned.
+ *
+ *  See x_grecord.cpp for an example.
+ *  See x_nonblocking.cpp for an example of non-blocking usage.
+ */
+
+//! Provides access to unsolicited messages from the controller.
+GCLIB_DLL_EXPORTED GReturn GCALL GMessage(GCon g, GCStringOut buffer,
+                                          GSize buffer_len);
+/*!<
+ *  To use this function, `-s MG` must be used in the GOpen() `address` string
+ * to subscribe to messages. Unsolicited bytes must be flagged by the high-bit
+ * setting, `CW 1`. The driver will automatically set this when subscribing to
+ * messages. The user should not overwrite this setting.
+ *
+ *  Unsolicited messages are data generated by the controller that are not in
+ * response to a command, a data record, or an interrupt. Examples follow.
+ *  -# Data generated by the `MG` command from embedded code. `MG` sent from the
+ * host is solicited.
+ *  -# Any command in an embedded program that returns data, e.g. `TP`, `RP`,
+ * `var=?`
+ *  -# A run time error in an embedded program, e.g. `?55 i=var`
+ *
+ *  \note Messages are unframed byte streams. There is no guarantee that the
+ * user will get complete messages or single messages in a call to GMessage().
+ *
+ *  \param g Connection's handle.
+ *  \param buffer The buffer to write the message data. The buffer will be null
+ * terminated. \param buffer_len The length of the user's buffer.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  GMessage() will block until a message is received, or the function times
+ * out.
+ *
+ *  \note If this function is called with a timeout of zero, a non-blocking read
+ * is performed. If message data has been processed since the last time the
+ * function was called, this data will be returned. If there is no processed
+ * message data, but there is data waiting in the socket or PCI FIFO, one read
+ * will be performed to process the waiting data. If new data is still not found
+ * after these two attempts, G_GCLIB_NON_BLOCKING_READ_EMPTY will be returned.
+ *
+ *  \warning When sending message streams through @ref gcaps, the following
+ * non-printable bytes are illegal, `$00-$07` and `$10-$17`. These bytes may be
+ * routed to a third party device such as am HMI or display panel. See MG and
+ * CF.
+ *
+ *  See x_gmessage.cpp for an example.
+ *  See x_nonblocking.cpp for an example of non-blocking usage.
+ */
+
+//! Provides access to PCI and UDP interrupts from the controller.
+GCLIB_DLL_EXPORTED GReturn GCALL GInterrupt(GCon g, GStatus* status_byte);
+/*!<
+ *  Interrupts can be generated automatically by the firmware on important
+ * events via `EI` (Enable Interrupt) or by the user in embedded DMC code via
+ * `UI` (User Interrupt). To use this function, `-s EI` must be used in the
+ * GOpen() address string to subscribe to interrupts.
+ *
+ *  \param g  Connection's handle.
+ *  \param status_byte A pointer to a GStatus to receive the status byte.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  GInterrupt() will block until an interrupt is received, or the function
+ * times out.
+ *
+ *  \note If this function is called with a timeout of zero, a non-blocking read
+ * is performed. If interrupt data is waiting in the interrupt queue, the oldest
+ * byte will be popped off the queue. If there is no interrupt data queued, but
+ * there is data waiting in the socket or PCI FIFO, one read will be performed
+ * to process the waiting data. If new data is still not found after these two
+ * attempts, G_GCLIB_NON_BLOCKING_READ_EMPTY will be returned.
+ *
+ *  See x_ginterrupt.cpp for an example.
+ *  See x_nonblocking.cpp for an example of non-blocking usage.
+ */
+
+//! Upgrade firmware.
+GCLIB_DLL_EXPORTED GReturn GCALL GFirmwareDownload(GCon g, GCStringIn filepath);
+/*!<
+ *  \param g  Connection's handle.
+ *  \param filepath The full file path to the Galil-supplied firmware hex file.
+ * See http://www.galil.com/downloads/firmware
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  \code{.cpp}
+ *  ec(GInfo(g, buf, sizeof(buf))); //get conntroller info
+ *  cout << buf << '\n'; //print the info
+ *  ec(GFirmwareDownload(g, "F:/1806.dmc/dmc-1806-r11a.hex"));
+ *  ec(GInfo(g, buf, sizeof(buf))); //get the info again
+ *  cout << buf << '\n';
+ *  // example output:
+ *  // GALILPCI1, DMC1846 Rev 1.1a-CM, 4232
+ *  // GALILPCI1, DMC1846 Rev 1.1a, 4232
+ *  \endcode
+ */
+
+//! Provides read/write access to driver settings and convenience features based
+//! on the request variable.
+GCLIB_DLL_EXPORTED GReturn GCALL GUtility(GCon g, GOption request,
+                                          GMemory memory1, GMemory memory2);
+/*!<
+ *
+ *  \note The open source library, gclibo.h, has wrappers for most of these
+ * utilities.
+ *
+ *  \param g Connection's handle.
+ *  \param request Defines the request. Input/Output and type of memory are
+ * implicit in the value of request. The following lists the supported request
+ * values.
+ *
+ *    * @ref G_UTIL_TIMEOUT Read initial timeout value, as specified in GOpen()
+ * via `--timeout` switch.
+ *      * `memory1` is output and must be an `unsigned short*`.
+ *      * `memory2` is ignored, use null.
+ *
+ *    * @ref G_UTIL_TIMEOUT_OVERRIDE See GTimeout(). Write/Read override timeout
+ * value.
+ *      * `memory1` is input. If nonnull, value must be a `short*` holding the
+ * override, in milliseconds, for the timeout. Write `G_USE_INITIAL_TIMEOUT` to
+ * use initial timeout. If null, no write occurs.
+ *      * `memory2` is output. If nonnul, value must be a `short*` which will be
+ * filled with the current override. `G_USE_INITIAL_TIMEOUT` indicates initial
+ * timeout used. If null, no read occurs. `memory2` is processed before
+ * 'memory1`.
+ *
+ *    * @ref G_UTIL_VERSION See GVersion(). Returns the library version. A valid
+ * connection (g) is not necessary, i.e. g may be null.
+ *      * `memory1` is output, and must be a `char*`. Data will be null
+ * terminated, even if the data must be truncated to do so.
+ *      * `memory2` is input and must be an `unsigned int*` holding the length
+ * of the buffer in `memory1`.
+ *
+ *    * @ref G_UTIL_INFO See GInfo(). Returns information about the connection.
+ *      * `memory1` is output and must be a `char*`. Data will be null
+ * terminated, even if the data must be truncated to do so.
+ *      * `memory2` is input and must be an `unsigned int*` holding the length
+ * of the buffer in `memory1`.
+ *
+ *    * @ref G_UTIL_SLEEP See GSleep(). Platform-independent, non-busy, sleep. A
+ * valid connection (g) is not necessary, i.e. g may be null.
+ *      * `memory1` is input and must be an `unsigned int*`, units are
+ * milliseconds.
+ *      * `memory2` is ignored, use null.
+ *
+ *    * @ref G_UTIL_ADDRESSES see GAddresses(). Provides a \\n delimited listing
+ * of all available IP addresses, PCI addresses, and COM ports. A valid
+ * connection (g) is not necessary, i.e. g may be null. The suffix `-d` will be
+ * appended to each address to indicate these addresses are available via direct
+ * connection. See `G_UTIL_GCAPS_ADDRESSES` for addresses through @ref gcaps.
+ *      * `memory1` is output and must be a `char*`. Data will be null
+ * terminated, even if the data must be truncated to do so.
+ *      * `memory2` is input and must be an `unsigned int*` holding the length
+ * of the buffer in `memory1`.
+ *
+ *    * @ref G_UTIL_IPREQUEST see GIpRequests(). Listens and returns a \\n
+ * delimited listing of Galil MAC addresses sending BOOT-P or DHCP requests. The
+ * function will listen, and block, for roughly 5 seconds. A valid connection
+ * (g) is not necessary, i.e. g may be null.
+ *      * `memory1` is output and must be a `char*`. Data will be null
+ * terminated, even if the data must be truncated to do so.
+ *      * `memory2` is input and must be an `unsigned int*` holding the length
+ * of the buffer in `memory1`.
+ *
+ *    * @ref G_UTIL_ASSIGN see GAssign(). Provides a method to assign an IP
+ * address given a Galil MAC address. A valid connection (g) is not necessary,
+ * i.e. g may be null.
+ *      * `memory1` is input and must be a `char*` containing the null
+ * terminated address that is to be assigned. e.g. `"192.168.0.43"`.
+ *      * `memory2` is input and must be a `char*` containing the null
+ * terminated controller MAC address. e.g. `"00:50:4C:20:01:23"`.
+ *
+ *    * @ref G_UTIL_DEVICE_INITIALIZE Provides a method to reinitialize a
+ * connection after a reset, e.g. an RS command. Depending on the device type,
+ * the appropriate commands will be sent to configure the communication bus for
+ * optimal performance.
+ *      * `memory1` is ignored, use null.
+ *      * `memory2` is ignored, use null.
+ *
+ *    * @ref G_UTIL_PING Uses ICMP ping to determine if an IP address is
+ * reachable and assigned. A valid connection (g) is not necessary, i.e. g may
+ * be null.
+ *      * `memory1` is input and must be a `char*` containing the null
+ * terminated address that is to be pinged. e.g. `"192.168.0.43"`.
+ *      * `memory2` is output and must be an `int*`. The value will be set to
+ * zero if the ping times out, and nonzero if a ping reply is returned.
+ *
+ *    ###The following request values are for use with a @ref gcaps server.
+ *
+ *    * @ref G_UTIL_GCAPS_VERSION see GVersion(). Returns the @ref gcaps server
+ * version. A valid connection (g) is not necessary, i.e. g may be null. This
+ * operation will connect to the server to determine the version.
+ *      * `memory1` is output and must be a `char*`. Data will be null
+ * terminated, even if the data must be truncated to do so.
+ *      * `memory2` is input and must be an `unsigned int*` holding the length
+ * of the buffer in `memory1`.
+ *
+ *    * @ref G_UTIL_GCAPS_KEEPALIVE Provides a method for kicking the @ref gcaps
+ * server. After a default period of 10 minutes of inactivity,
+ *      @ref gcaps will disconnect the gclib client. To prevent a disconnect,
+ * communicate with the hardware or call `G_UTIL_GCAPS_KEEPALIVE` within the
+ * timeout period to reset the timer. The current interval can be optionally
+ * read and overwritten, however, the keep alive signal is only sent if
+ * `memory1` and `memory2` are both null.
+ *      * `memory1` is output. If nonnull, value must be an `unsinged int*`
+ * which will be filled with the current @ref gcaps timeout, in ms.
+ *      * `memory2` is input. If nonnull, value must be an `unsinged int*`
+ * holding the new @ref gcaps timeout, in ms, for connection `g`.
+ *
+ *    * @ref G_UTIL_GCAPS_ADDRESSES see GAddresses(). Provides a \\n delimited
+ * listing of all available IP addresses, PCI addresses, and COM ports as
+ * available from the @ref gcaps server. A valid connection (g) is not
+ * necessary, i.e. g may be null.
+ *      * `memory1` is output and must be a `char*`. Data will be null
+ * terminated, even if the data must be truncated to do so.
+ *      * `memory2` is input and must be an `unsigned int*` holding the length
+ * of the buffer in `memory1`.
+ *
+ *    * @ref G_UTIL_GCAPS_IPREQUEST see GIpRequests(). Connects to @ref gcaps
+ * and returns a \\n delimited listing of Galil MAC addresses sending BOOT-P or
+ * DHCP requests. The function will block for roughly 5 seconds. A valid
+ * connection (g) is not necessary, i.e. g may be null.
+ *      * `memory1` is output and must be a `char*`. Data will be null
+ * terminated, even if the data must be truncated to do so.
+ *      * `memory2` is input and must be an `unsigned int*` holding the length
+ * of the buffer in `memory1`.
+ *
+ *    * @ref G_UTIL_GCAPS_ASSIGN see GAssign(). Provides a method to assign an
+ * IP address through @ref gcaps given a Galil MAC address. A valid connection
+ * (g) is not necessary, i.e. g may be null.
+ *      * `memory1` is input and must be a `char*` containing the null
+ * terminated address that is to be assigned. e.g. `"192.168.0.43"`.
+ *      * `memory2` is input and must be a `char*` containing the null
+ * terminated controller MAC address. e.g. `"00:50:4C:20:01:23"`.
+ *
+ *    * @ref G_UTIL_GCAPS_PING Uses ICMP ping to determine if an IP address is
+ * reachable and assigned. Ping sent from the @ref gcaps server. A valid
+ * connection (g) is not necessary, i.e. g may be null.
+ *      * `memory1` is input and must be a `char*` containing the null
+ * terminated address that is to be pinged. e.g. `"192.168.0.43"`.
+ *      * `memory2` is output and must be an `int*`. The value will be set to
+ * zero if the ping times out, and nonzero if a ping reply is returned.
+ *
+ *  \param memory1 An untyped pointer to data required for request. The data
+ * type is defined by the request variable. \param memory2 An untyped pointer to
+ * data required for request. The data type is defined by the request variable.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See the following functions from gclibo, the open source portion, for
+ * implementation of several GUtility() requests.:
+ *    * GAddresses()
+ *    * GAssign()
+ *    * GInfo()
+ *    * GIpRequests()
+ *    * GSleep()
+ *    * GTimeout()
+ *    * GVersion()
+ *
+ */
 
 #ifdef G_USE_GCOMPOUND
-	//! Transact multiple commands in a single, compound format.
-	GCLIB_DLL_EXPORTED GReturn GCALL GCompound(GCon g, GCStringIn buffer);
-	/*!<
-	*  gclib's standard GCommand() call sends one single command per transaction.
-	*  Compound commands separated by semicolons are broken up into individual command
-	*  calls. This has a number of benefits, not least increased safety.
-	*
-	*  In rare cases, buffered modes of motion such as PVT, Linear Interpolation,
-	*  Vector mode, and Contour mode, can benefit from sending multiple commands
-	*  in a single transaction. GCompound() provides for this capability.
-	*
-	*  If the string in `buffer` is larger than the hardware or communication
-	*  bus maximum write size, GCompound will break the buffer into multiple
-	*  transactions. Maximum write sizes will be used for each transaction.
-	*
-	*  It is the user's responsibility to ensure the following.
-	*  1. The motion characteristics require such packing. Only high bandwidth
-	*     motion requires this function. Galil recommends using the standard
-	*     GCommand(), or the even simpler GCmd(), for most buffering applications.
-	*
-	*  2. The commands used are "colon-response" commands only. I.E. no commands
-	*     that return data. `PV`, `LI`, `VP`, and `CD` are the commands typically
-	*     used by this function.
-	*
-	*  3. The controller's mode of motion segment buffer has sufficient space
-	*     to accept all the commands sent by this function. Although any error (?)
-	*     will result in function failure, commands following the error that are 
-	*     packed in the buffer may still be executed, possibly generating more
-	*     errors or incorrect motion profiles.
-	*
-	*  4. The commands are properly formatted, ranged, and will not result in a run-time error.
-	*     Although any error (?) will result in function failure, commands following
-	*     the error that are packed in the buffer may still be executed, possibly generating
-	*     more errors or incorrect motion profiles.
-	*
-	*  \param g Connection's handle.
-	*  \param buffer The user's command buffer as a null-terminated string.
-	*   Commands must be separated by semicolons. **The last command must have
-	*   a trailing semicolon**. Do not terminate with a carriage return. GCompound() 
-	*   may send the buffer in chunks, depending on the hardware or communication
-	*   bus maximum write size.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  \note GCompound() is not part of the standard gclib release. Contact Galil Applications for a special build, http://galil.com/contact.
-	*/
+//! Transact multiple commands in a single, compound format.
+GCLIB_DLL_EXPORTED GReturn GCALL GCompound(GCon g, GCStringIn buffer);
+/*!<
+ *  gclib's standard GCommand() call sends one single command per transaction.
+ *  Compound commands separated by semicolons are broken up into individual
+ * command calls. This has a number of benefits, not least increased safety.
+ *
+ *  In rare cases, buffered modes of motion such as PVT, Linear Interpolation,
+ *  Vector mode, and Contour mode, can benefit from sending multiple commands
+ *  in a single transaction. GCompound() provides for this capability.
+ *
+ *  If the string in `buffer` is larger than the hardware or communication
+ *  bus maximum write size, GCompound will break the buffer into multiple
+ *  transactions. Maximum write sizes will be used for each transaction.
+ *
+ *  It is the user's responsibility to ensure the following.
+ *  1. The motion characteristics require such packing. Only high bandwidth
+ *     motion requires this function. Galil recommends using the standard
+ *     GCommand(), or the even simpler GCmd(), for most buffering applications.
+ *
+ *  2. The commands used are "colon-response" commands only. I.E. no commands
+ *     that return data. `PV`, `LI`, `VP`, and `CD` are the commands typically
+ *     used by this function.
+ *
+ *  3. The controller's mode of motion segment buffer has sufficient space
+ *     to accept all the commands sent by this function. Although any error (?)
+ *     will result in function failure, commands following the error that are
+ *     packed in the buffer may still be executed, possibly generating more
+ *     errors or incorrect motion profiles.
+ *
+ *  4. The commands are properly formatted, ranged, and will not result in a
+ * run-time error. Although any error (?) will result in function failure,
+ * commands following the error that are packed in the buffer may still be
+ * executed, possibly generating more errors or incorrect motion profiles.
+ *
+ *  \param g Connection's handle.
+ *  \param buffer The user's command buffer as a null-terminated string.
+ *   Commands must be separated by semicolons. **The last command must have
+ *   a trailing semicolon**. Do not terminate with a carriage return.
+ * GCompound() may send the buffer in chunks, depending on the hardware or
+ * communication bus maximum write size.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  \note GCompound() is not part of the standard gclib release. Contact Galil
+ * Applications for a special build, http://galil.com/contact.
+ */
 #endif
 
 #ifdef __cplusplus
-} //extern "C"
+}  // extern "C"
 #endif
 
-#endif //I_D48432D9_1FA3_4C7D_B44C_05F8B9000ADF
+#endif  // I_D48432D9_1FA3_4C7D_B44C_05F8B9000ADF
diff --git a/src/libGalil/gclib_errors.h b/src/libGalil/gclib_errors.h
old mode 100755
new mode 100644
index f6625a2c..a0a12b6e
--- a/src/libGalil/gclib_errors.h
+++ b/src/libGalil/gclib_errors.h
@@ -1,75 +1,119 @@
 /*! \file gclib_errors.h
-*
-* Defines values for the Galil C Library return codes and error strings.
-*
-*/
+ *
+ * Defines values for the Galil C Library return codes and error strings.
+ *
+ */
 #ifndef I_0DD3687F_47D0_454B_ADB2_CBAB0ED46FCE
 #define I_0DD3687F_47D0_454B_ADB2_CBAB0ED46FCE
 
-#define G_NO_ERROR 0  //!< Return value if function succeeded. 
+#define G_NO_ERROR 0  //!< Return value if function succeeded.
 #define G_NO_ERROR_S "no error"
 
-#define G_GCLIB_ERROR -1 //!< General library error. Indicates internal API caught an unexpected error. Contact Galil support if this error is returned, softwaresupport@galil.com.
+#define G_GCLIB_ERROR \
+    -1  //!< General library error. Indicates internal API caught an unexpected
+        //!< error. Contact Galil support if this error is returned,
+        //!< softwaresupport@galil.com.
 #define G_GCLIB_ERROR_S "gclib unexpected error"
 
-#define G_GCLIB_UTILITY_ERROR -2 //!< An invalid request value was specified to GUtility.
-#define G_GCLIB_UTILITY_ERROR_S "invalid request value or bad arguments were specified to GUtility()"
-
-#define G_GCLIB_UTILITY_IP_TAKEN -3 //!< The IP cannot be assigned because ping returned a reply. 
-#define G_GCLIB_UTILITY_IP_TAKEN_S "ip address is already taken by a device on the network"
-
-#define G_GCLIB_NON_BLOCKING_READ_EMPTY -4 //!< GMessage, GInterrupt, and GRecord can be called with a zero timeout. If there wasn't data waiting in memory, this error is returned.
-#define G_GCLIB_NON_BLOCKING_READ_EMPTY_S "data was not waiting for a zero-timeout read"
-
-#define G_TIMEOUT -1100 //!< Operation timed out. Timeout is set by the --timeout option in GOpen() and can be overriden by GSetting().
+#define G_GCLIB_UTILITY_ERROR \
+    -2  //!< An invalid request value was specified to GUtility.
+#define G_GCLIB_UTILITY_ERROR_S \
+    "invalid request value or bad arguments were specified to GUtility()"
+
+#define G_GCLIB_UTILITY_IP_TAKEN \
+    -3  //!< The IP cannot be assigned because ping returned a reply.
+#define G_GCLIB_UTILITY_IP_TAKEN_S \
+    "ip address is already taken by a device on the network"
+
+#define G_GCLIB_NON_BLOCKING_READ_EMPTY \
+    -4  //!< GMessage, GInterrupt, and GRecord can be called with a zero
+        //!< timeout. If there wasn't data waiting in memory, this error is
+        //!< returned.
+#define G_GCLIB_NON_BLOCKING_READ_EMPTY_S \
+    "data was not waiting for a zero-timeout read"
+
+#define G_TIMEOUT \
+    -1100  //!< Operation timed out. Timeout is set by the --timeout option in
+           //!< GOpen() and can be overriden by GSetting().
 #define G_TIMEOUT_S "device timed out"
 
-#define G_OPEN_ERROR -1101 //!< Device could not be opened. E.G. Serial port or PCI device already open.
+#define G_OPEN_ERROR \
+    -1101  //!< Device could not be opened. E.G. Serial port or PCI device
+           //!< already open.
 #define G_OPEN_ERROR_S "device failed to open"
 
-#define G_INVALID_PREPROCESSOR_OPTIONS -1204 //!< GProgramDownload was called with a bad preprocessor directive.
-#define G_INVALID_PREPROCESSOR_OPTIONS_S "preprocessor did not recognize options"
+#define G_INVALID_PREPROCESSOR_OPTIONS \
+    -1204  //!< GProgramDownload was called with a bad preprocessor directive.
+#define G_INVALID_PREPROCESSOR_OPTIONS_S \
+    "preprocessor did not recognize options"
 
-#define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND -1106 //!< GCommand() was called with an illegal command, e.g. ED, DL or QD.
-#define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND_S "illegal command passed to command call"
+#define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND \
+    -1106  //!< GCommand() was called with an illegal command, e.g. ED, DL or
+           //!< QD.
+#define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND_S \
+    "illegal command passed to command call"
 
-#define G_DATA_RECORD_ERROR -1107 //!< Data record error, e.g. DR attempted on serial connection.
+#define G_DATA_RECORD_ERROR \
+    -1107  //!< Data record error, e.g. DR attempted on serial connection.
 #define G_DATA_RECORD_ERROR_S "data record error"
 
-#define G_UNSUPPORTED_FUNCTION -1109 //!< Function cannot be called on this bus. E.G. GInterrupt() on serial.
-#define G_UNSUPPORTED_FUNCTION_S "function not supported on this communication bus"
-
-#define G_FIRMWARE_LOAD_NOT_SUPPORTED -1110 //!< Firmware is not supported on this bus, e.g. Ethernet for the DMC-21x3 series.
-#define G_FIRMWARE_LOAD_NOT_SUPPORTED_S "firmware cannot be loaded on this communication bus to this hardware"
-
-#define G_ARRAY_NOT_DIMENSIONED -1200 //!< Array operation was called on an array that was not in the controller's array table, see LA command.
-#define G_ARRAY_NOT_DIMENSIONED_S "array not dimensioned on controller or wrong size"
-
-#define G_ILLEGAL_DATA_IN_PROGRAM -1202 //!< Data to download not valid, e.g. \ in data.
+#define G_UNSUPPORTED_FUNCTION \
+    -1109  //!< Function cannot be called on this bus. E.G. GInterrupt() on
+           //!< serial.
+#define G_UNSUPPORTED_FUNCTION_S \
+    "function not supported on this communication bus"
+
+#define G_FIRMWARE_LOAD_NOT_SUPPORTED \
+    -1110  //!< Firmware is not supported on this bus, e.g. Ethernet for the
+           //!< DMC-21x3 series.
+#define G_FIRMWARE_LOAD_NOT_SUPPORTED_S \
+    "firmware cannot be loaded on this communication bus to this hardware"
+
+#define G_ARRAY_NOT_DIMENSIONED \
+    -1200  //!< Array operation was called on an array that was not in the
+           //!< controller's array table, see LA command.
+#define G_ARRAY_NOT_DIMENSIONED_S \
+    "array not dimensioned on controller or wrong size"
+
+#define G_ILLEGAL_DATA_IN_PROGRAM \
+    -1202  //!< Data to download not valid, e.g. \ in data.
 #define G_ILLEGAL_DATA_IN_PROGRAM_S "illegal ASCII character in program"
 
-#define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT -1203 //!< Program preprocessor could not compress the program within the user's constraints.
-#define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT_S "program cannot be compressed to fit on the controller"
+#define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT \
+    -1203  //!< Program preprocessor could not compress the program within the
+           //!< user's constraints.
+#define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT_S \
+    "program cannot be compressed to fit on the controller"
 
-#define G_BAD_RESPONSE_QUESTION_MARK -10000 //!< Operation received a ?, indicating controller has a TC error.
+#define G_BAD_RESPONSE_QUESTION_MARK \
+    -10000  //!< Operation received a ?, indicating controller has a TC error.
 #define G_BAD_RESPONSE_QUESTION_MARK_S "question mark returned by controller"
 
-#define G_BAD_VALUE_RANGE -10002 //!< Bad value or range, e.g. GCon *g* variable passed to function was bad.
+#define G_BAD_VALUE_RANGE \
+    -10002  //!< Bad value or range, e.g. GCon *g* variable passed to function
+            //!< was bad.
 #define G_BAD_VALUE_RANGE_S "value passed to function was bad or out of range"
 
-#define G_BAD_FULL_MEMORY -10003 //!< Not enough memory for an operation, e.g. all connections allowed for a process already taken.
-#define G_BAD_FULL_MEMORY_S "operation could not complete because of a memory error"
+#define G_BAD_FULL_MEMORY \
+    -10003  //!< Not enough memory for an operation, e.g. all connections
+            //!< allowed for a process already taken.
+#define G_BAD_FULL_MEMORY_S \
+    "operation could not complete because of a memory error"
 
-#define G_BAD_LOST_DATA -10004 //!< Lost data, e.g. GCommand() response buffer was too small for the controller's response.
+#define G_BAD_LOST_DATA \
+    -10004  //!< Lost data, e.g. GCommand() response buffer was too small for
+            //!< the controller's response.
 #define G_BAD_LOST_DATA_S "data was lost due to buffer or fifo limitations"
 
-#define G_BAD_FILE -10005 //!< Bad file path, bad file contents, or bad write.
+#define G_BAD_FILE -10005  //!< Bad file path, bad file contents, or bad write.
 #define G_BAD_FILE_S "file was not found, contents are invalid, or write failed"
 
-#define G_BAD_ADDRESS -10006 //!< Bad address
+#define G_BAD_ADDRESS -10006  //!< Bad address
 #define G_BAD_ADDRESS_S "a bad address was specified in open"
 
-#define G_GCAPS_OPEN_ERROR -20000 //!< gcaps connection couldn't open. Server is not running or is not reachable.
+#define G_GCAPS_OPEN_ERROR \
+    -20000  //!< gcaps connection couldn't open. Server is not running or is not
+            //!< reachable.
 #define G_GCAPS_OPEN_ERROR_S "gcaps connection could not be opened"
 
-#endif //I_0DD3687F_47D0_454B_ADB2_CBAB0ED46FCE
+#endif  // I_0DD3687F_47D0_454B_ADB2_CBAB0ED46FCE
diff --git a/src/libGalil/gclib_record.h b/src/libGalil/gclib_record.h
old mode 100755
new mode 100644
index 78d9b90f..d2e8d94f
--- a/src/libGalil/gclib_record.h
+++ b/src/libGalil/gclib_record.h
@@ -1,401 +1,413 @@
 /*! \file gclib_record.h
-*  Defines a union for data records.
-*  Each supported controller has a struct member in the union with named record types.
-*  Offsets into the data record can also be used by referencing the member `byte_array`.
-*/
+ *  Defines a union for data records.
+ *  Each supported controller has a struct member in the union with named record
+ * types. Offsets into the data record can also be used by referencing the
+ * member `byte_array`.
+ */
 
 #ifndef I_210405D9_D9EF_484F_8258_BB29A1BBA217
 #define I_210405D9_D9EF_484F_8258_BB29A1BBA217
 
-
-//typedefs to keep the layout of the structs clean and matching the Galil user manual docs
-typedef unsigned char UB; //unsigned byte
-typedef unsigned short UW; //unsigned word
-typedef short SW; //signed word
-typedef int SL; //signed long
-typedef unsigned int UL; //unsigned long
-
+// typedefs to keep the layout of the structs clean and matching the Galil user
+// manual docs
+typedef unsigned char UB;   // unsigned byte
+typedef unsigned short UW;  // unsigned word
+typedef short SW;           // signed word
+typedef int SL;             // signed long
+typedef unsigned int UL;    // unsigned long
 
 #if defined(_MSC_VER) || defined(__GNUC__) || defined(__BORLANDC__)
 #define PACKOK
 #endif
 
-
 #ifdef PACKOK
 #pragma pack(1)
 #else
 #error "Need to set structure packing for compiler"
 #endif
 
-
-#define GALILDATARECORDMAXLENGTH 512 //!< Max size for any Galil data record, equal to dual port ram size of PCI.
-
-//! Data record struct for DMC-4000 controllers, including 4000, 4200, 4103, and 500x0.
-struct GDataRecord4000
-{
-
-	/*Offset   type name        description*/
-
-	/*00*/	    UB	header_0; //!<1st Byte of Header.
-	/*01*/	    UB	header_1; //!<2nd Byte of Header.
-	/*02*/	    UB	header_2; //!<3rd Byte of Header.
-	/*03*/	    UB	header_3; //!<4th Byte of Header.
-
-	/*04-05*/  	UW	sample_number; //!<sample number.
-
-	/*06*/	    UB	input_bank_0; //!<general input bank 0 (inputs 1-8).
-	/*07*/	    UB	input_bank_1; //!<general input bank 1 (inputs 9-16).
-	/*08*/	    UB	input_bank_2; //!<general input bank 2 (inputs 17-24).
-	/*09*/	    UB	input_bank_3; //!<general input bank 3 (inputs 25-32).
-	/*10*/    	UB	input_bank_4; //!<general input bank 4 (inputs 33-40).
-	/*11*/	    UB	input_bank_5; //!<general input bank 5 (inputs 41-48).
-	/*12*/	    UB	input_bank_6; //!<general input bank 6 (inputs 49-56).
-	/*13*/   	UB	input_bank_7; //!<general input bank 7 (inputs 57-64).
-	/*14*/   	UB	input_bank_8; //!<general input bank 8 (inputs 65-72).
-	/*15*/	    UB	input_bank_9; //!<general input bank 9 (inputs 73-80).
-
-	/*16*/    	UB	output_bank_0; //!<general output bank 0 (outputs 1-8).
-	/*17*/	    UB	output_bank_1; //!<general output bank 1 (outputs 9-16).
-	/*18*/   	UB	output_bank_2; //!<general output bank 2 (outputs 17-24).
-	/*19*/	    UB	output_bank_3; //!<general output bank 3 (outputs 25-32).
-	/*20*/   	UB	output_bank_4; //!<general output bank 4 (outputs 33-40).
-	/*21*/	    UB	output_bank_5; //!<general output bank 5 (outputs 41-48).
-	/*22*/	    UB	output_bank_6; //!<general output bank 6 (outputs 49-56).
-	/*23*/	    UB	output_bank_7; //!<general output bank 7 (outputs 57-64).
-	/*24*/  	UB	output_bank_8; //!<general output bank 8 (outputs 65-72).
-	/*25*/  	UB	output_bank_9; //!<general output bank 9 (outputs 73-80).
-
-	/*26-27*/	SW  reserved_0; //!<Reserved.
-	/*28-29*/	SW 	reserved_2; //!<Reserved.
-	/*30-31*/	SW 	reserved_4; //!<Reserved.
-	/*32-33*/	SW	reserved_6; //!<Reserved.
-	/*34-35*/	SW	reserved_8; //!<Reserved.
-	/*36-37*/	SW	reserved_10; //!<Reserved.
-	/*38-39*/	SW	reserved_12; //!<Reserved.
-	/*40-41*/	SW	reserved_14; //!<Reserved.
-
-	/*42*/	    UB	ethernet_status_a; //!<Ethernet Handle A Status.
-	/*43*/   	UB	ethernet_status_b; //!<Ethernet Handle B Status.
-	/*44*/	    UB	ethernet_status_c; //!<Ethernet Handle C Status.
-	/*45*/   	UB	ethernet_status_d; //!<Ethernet Handle D Status.
-	/*46*/  	UB	ethernet_status_e; //!<Ethernet Handle E Status.
-	/*47*/	    UB	ethernet_status_f; //!<Ethernet Handle F Status.
-	/*48*/  	UB	ethernet_status_g; //!<Ethernet Handle G Status.
-	/*49*/  	UB	ethernet_status_h; //!<Ethernet Handle H Status.
-
-	/*50*/	    UB	error_code; //!<error code.
-	/*51*/  	UB	thread_status; //!<thread status
-	/*52-55*/	UL	amplifier_status; //!<Amplifier Status.
-
-	/*56-59*/	UL	contour_segment_count; //!<Segment Count for Contour Mode.
-	/*60-61*/	UW	contour_buffer_available; //!<Buffer space remaining, Contour Mode.
-
-	/*62-63*/	UW	s_plane_segment_count; //!<segment count of coordinated move for S plane.
-	/*64-65*/	UW	s_plane_move_status; //!<coordinated move status for S plane.
-	/*66-69*/	SL	s_distance; //!<distance traveled in coordinated move for S plane.
-	/*70-71*/	UW	s_plane_buffer_available; //!<Buffer space remaining, S Plane.
-
-	/*72-73*/	UW	t_plane_segment_count; //!<segment count of coordinated move for T plane.
-	/*74-75*/	UW	t_plane_move_status; //!<Coordinated move status for T plane.
-	/*76-79*/	SL	t_distance; //!<distance traveled in coordinated move for T plane.
-	/*80-81*/	UW	t_plane_buffer_available; //!<Buffer space remaining, T Plane.
-
-	/*82-83*/	UW	axis_a_status; //!<A axis status.
-	/*84*/	    UB	axis_a_switches; //!<A axis switches.
-	/*85*/	    UB	axis_a_stop_code; //!<A axis stop code.
-	/*86-89*/	SL	axis_a_reference_position; //!<A axis reference position.
-	/*90-93*/	SL	axis_a_motor_position; //!<A axis motor position.
-	/*94-97*/	SL	axis_a_position_error; //!<A axis position error.
-	/*98-101*/	SL	axis_a_aux_position; //!<A axis auxiliary position.
-	/*102-105*/	SL	axis_a_velocity; //!<A axis velocity.
-	/*106-109*/	SL 	axis_a_torque; //!<A axis torque.
-	/*110-111*/	UW  axis_a_analog_in; //!<A axis analog input.
-	/*112*/	    UB	axis_a_halls; //!<A Hall Input Status.
-	/*113*/  	UB	axis_a_reserved; //!<Reserved.
-	/*114-117*/	SL	axis_a_variable; //!<A User-defined variable (ZA).
-
-	/*118-119*/	UW	axis_b_status; //!<B axis status.
-	/*120*/	    UB	axis_b_switches; //!<B axis switches.
-	/*121*/	    UB	axis_b_stop_code; //!<B axis stop code.
-	/*122-125*/	SL	axis_b_reference_position; //!<B axis reference position.
-	/*126-129*/	SL	axis_b_motor_position; //!<B axis motor position.
-	/*130-133*/	SL	axis_b_position_error; //!<B axis position error.
-	/*134-137*/	SL	axis_b_aux_position; //!<B axis auxiliary position.
-	/*138-141*/	SL	axis_b_velocity; //!<B axis velocity.
-	/*142-145*/	SL	axis_b_torque; //!<B axis torque.
-	/*146-147*/	UW  axis_b_analog_in; //!<B axis analog input.
-	/*148*/   	UB	axis_b_halls; //!<B Hall Input Status.
-	/*149*/	    UB	axis_b_reserved; //!<Reserved.
-	/*150-153*/	SL	axis_b_variable; //!<B User-defined variable (ZA).
-
-	/*154-155*/	UW	axis_c_status; //!<C axis status.
-	/*156*/  	UB	axis_c_switches; //!<C axis switches.
-	/*157*/ 	UB	axis_c_stop_code; //!<C axis stop code.
-	/*158-161*/	SL	axis_c_reference_position; //!<C axis reference position.
-	/*162-165*/	SL	axis_c_motor_position; //!<C axis motor position.
-	/*166-169*/	SL	axis_c_position_error; //!<C axis position error.
-	/*170-173*/	SL	axis_c_aux_position; //!<C axis auxiliary position.
-	/*174-177*/	SL	axis_c_velocity; //!<C axis velocity.
-	/*178-181*/	SL	axis_c_torque; //!<C axis torque.
-	/*182-183*/	UW 	axis_c_analog_in; //!<C axis analog input.
-	/*184*/	    UB	axis_c_halls; //!<C Hall Input Status.
-	/*185*/	    UB	axis_c_reserved; //!<Reserved.
-	/*186-189*/	SL	axis_c_variable; //!<C User-defined variable (ZA).
-
-	/*190-191*/	UW	axis_d_status; //!<D axis status.
-	/*192*/	    UB	axis_d_switches; //!<D axis switches.
-	/*193*/  	UB	axis_d_stop_code; //!<D axis stop code.
-	/*194-197*/	SL	axis_d_reference_position; //!<D axis reference position.
-	/*198-201*/	SL	axis_d_motor_position; //!<D axis motor position.
-	/*202-205*/	SL	axis_d_position_error; //!<D axis position error.
-	/*206-209*/	SL	axis_d_aux_position; //!<D axis auxiliary position.
-	/*210-213*/	SL	axis_d_velocity; //!<D axis velocity.
-	/*214-217*/	SL	axis_d_torque; //!<D axis torque.
-	/*218-219*/ UW  axis_d_analog_in; //!<D axis analog input.
-	/*220*/  	UB	axis_d_halls; //!<D Hall Input Status.
-	/*221*/ 	UB	axis_d_reserved; //!<Reserved.
-	/*222-225*/	SL	axis_d_variable; //!<D User-defined variable (ZA).
-
-	/*226-227*/	UW	axis_e_status; //!<E axis status.
-	/*228*/	    UB	axis_e_switches; //!<E axis switches.
-	/*229*/	    UB	axis_e_stop_code; //!<E axis stop code.
-	/*230-233*/	SL	axis_e_reference_position; //!<E axis reference position.
-	/*234-237*/	SL	axis_e_motor_position; //!<E axis motor position.
-	/*238-241*/	SL	axis_e_position_error; //!<E axis position error.
-	/*242-245*/	SL	axis_e_aux_position; //!<E axis auxiliary position.
-	/*246-249*/	SL	axis_e_velocity; //!<E axis velocity.
-	/*250-253*/	SL	axis_e_torque; //!<E axis torque.
-	/*254-255*/	UW  axis_e_analog_in; //!<E axis analog input.
-	/*256*/  	UB	axis_e_halls; //!<E Hall Input Status.
-	/*257*/	    UB	axis_e_reserved; //!<Reserved.
-	/*258-261*/	SL	axis_e_variable; //!<E User-defined variable (ZA).
-
-	/*262-263*/	UW	axis_f_status; //!<F axis status.
-	/*264*/	    UB	axis_f_switches; //!<F axis switches.
-	/*265*/	    UB	axis_f_stop_code; //!<F axis stop code.
-	/*266-269*/	SL	axis_f_reference_position; //!<F axis reference position.
-	/*270-273*/	SL	axis_f_motor_position; //!<F axis motor position.
-	/*274-277*/	SL	axis_f_position_error; //!<F axis position error.
-	/*278-281*/	SL	axis_f_aux_position; //!<F axis auxiliary position.
-	/*282-285*/	SL	axis_f_velocity; //!<F axis velocity.
-	/*286-289*/	SL	axis_f_torque; //!<F axis torque.
-	/*290-291*/	UW	axis_f_analog_in; //!<F axis analog input.
-	/*292*/	    UB	axis_f_halls; //!<F Hall Input Status.
-	/*293*/	    UB	axis_f_reserved; //!<Reserved.
-	/*294-297*/	SL	axis_f_variable; //!<F User-defined variable (ZA).
-
-	/*298-299*/	UW	axis_g_status; //!<G axis status.
-	/*300*/  	UB	axis_g_switches; //!<G axis switches.
-	/*301*/ 	UB	axis_g_stop_code; //!<G axis stop code.
-	/*302-305*/	SL	axis_g_reference_position; //!<G axis reference position.
-	/*306-309*/	SL	axis_g_motor_position; //!<G axis motor position.
-	/*310-313*/	SL	axis_g_position_error; //!<G axis position error.
-	/*314-317*/	SL	axis_g_aux_position; //!<G axis auxiliary position.
-	/*318-321*/	SL	axis_g_velocity; //!<G axis velocity.
-	/*322-325*/	SL	axis_g_torque; //!<G axis torque.
-	/*326-327*/ UW  axis_g_analog_in; //!<G axis analog input.
-	/*328*/	    UB	axis_g_halls; //!<G Hall Input Status.
-	/*329*/	    UB	axis_g_reserved; //!<Reserved.
-	/*330-333*/	SL	axis_g_variable; //!<G User-defined variable (ZA).
-
-	/*334-335*/	UW	axis_h_status; //!<H axis status.
-	/*336*/  	UB	axis_h_switches; //!<H axis switches.
-	/*337*/	    UB	axis_h_stop_code; //!<H axis stop code.
-	/*338-341*/	SL	axis_h_reference_position; //!<H axis reference position.
-	/*342-345*/	SL	axis_h_motor_position; //!<H axis motor position.
-	/*346-349*/	SL	axis_h_position_error; //!<H axis position error.
-	/*350-353*/	SL	axis_h_aux_position; //!<H axis auxiliary position.
-	/*354-357*/	SL	axis_h_velocity; //!<H axis velocity.
-	/*358-361*/	SL	axis_h_torque; //!<H axis torque.
-	/*362-363*/	UW  axis_h_analog_in; //!<H axis analog input.
-	/*364*/	    UB	axis_h_halls; //!<H Hall Input Status.
-	/*365*/  	UB	axis_h_reserved; //!<Reserved.
-	/*366-369*/	SL	axis_h_variable; //!<H User-defined variable (ZA).
-}; //DataRecord4000
-
-//! Data record struct for DMC-52000 controller. Same as DMC-4000, with bank indicator added at byte 40.
-struct GDataRecord52000
-{
-
-	/*Offset   type name        description*/
-
-	/*00*/	    UB	header_0; //!<1st Byte of Header.
-	/*01*/	    UB	header_1; //!<2nd Byte of Header.
-	/*02*/	    UB	header_2; //!<3rd Byte of Header.
-	/*03*/	    UB	header_3; //!<4th Byte of Header.
-
-	/*04-05*/  	UW	sample_number; //!<sample number.
-
-	/*06*/	    UB	input_bank_0; //!<general input bank 0 (inputs 1-8).
-	/*07*/	    UB	input_bank_1; //!<general input bank 1 (inputs 9-16).
-	/*08*/	    UB	input_bank_2; //!<general input bank 2 (inputs 17-24).
-	/*09*/	    UB	input_bank_3; //!<general input bank 3 (inputs 25-32).
-	/*10*/    	UB	input_bank_4; //!<general input bank 4 (inputs 33-40).
-	/*11*/	    UB	input_bank_5; //!<general input bank 5 (inputs 41-48).
-	/*12*/	    UB	input_bank_6; //!<general input bank 6 (inputs 49-56).
-	/*13*/   	UB	input_bank_7; //!<general input bank 7 (inputs 57-64).
-	/*14*/   	UB	input_bank_8; //!<general input bank 8 (inputs 65-72).
-	/*15*/	    UB	input_bank_9; //!<general input bank 9 (inputs 73-80).
-
-	/*16*/    	UB	output_bank_0; //!<general output bank 0 (outputs 1-8).
-	/*17*/	    UB	output_bank_1; //!<general output bank 1 (outputs 9-16).
-	/*18*/   	UB	output_bank_2; //!<general output bank 2 (outputs 17-24).
-	/*19*/	    UB	output_bank_3; //!<general output bank 3 (outputs 25-32).
-	/*20*/   	UB	output_bank_4; //!<general output bank 4 (outputs 33-40).
-	/*21*/	    UB	output_bank_5; //!<general output bank 5 (outputs 41-48).
-	/*22*/	    UB	output_bank_6; //!<general output bank 6 (outputs 49-56).
-	/*23*/	    UB	output_bank_7; //!<general output bank 7 (outputs 57-64).
-	/*24*/  	UB	output_bank_8; //!<general output bank 8 (outputs 65-72).
-	/*25*/  	UB	output_bank_9; //!<general output bank 9 (outputs 73-80).
-
-	/*26-27*/	SW  reserved_0; //!<Reserved.
-	/*28-29*/	SW 	reserved_2; //!<Reserved.
-	/*30-31*/	SW 	reserved_4; //!<Reserved.
-	/*32-33*/	SW	reserved_6; //!<Reserved.
-	/*34-35*/	SW	reserved_8; //!<Reserved.
-	/*36-37*/	SW	reserved_10; //!<Reserved.
-	/*38-39*/	SW	reserved_12; //!<Reserved.
-	/*40*/      UB  ethercat_bank; //!< EtherCAT Bank Indicator.
-	/*41*/   	UB	reserved_14; //!<Reserved.
-
-	/*42*/	    UB	ethernet_status_a; //!<Ethernet Handle A Status.
-	/*43*/   	UB	ethernet_status_b; //!<Ethernet Handle B Status.
-	/*44*/	    UB	ethernet_status_c; //!<Ethernet Handle C Status.
-	/*45*/   	UB	ethernet_status_d; //!<Ethernet Handle D Status.
-	/*46*/  	UB	ethernet_status_e; //!<Ethernet Handle E Status.
-	/*47*/	    UB	ethernet_status_f; //!<Ethernet Handle F Status.
-	/*48*/  	UB	ethernet_status_g; //!<Ethernet Handle G Status.
-	/*49*/  	UB	ethernet_status_h; //!<Ethernet Handle H Status.
-
-	/*50*/	    UB	error_code; //!<error code.
-	/*51*/  	UB	thread_status; //!<thread status
-	/*52-55*/	UL	amplifier_status; //!<Amplifier Status.
-
-	/*56-59*/	UL	contour_segment_count; //!<Segment Count for Contour Mode.
-	/*60-61*/	UW	contour_buffer_available; //!<Buffer space remaining, Contour Mode.
-
-	/*62-63*/	UW	s_plane_segment_count; //!<segment count of coordinated move for S plane.
-	/*64-65*/	UW	s_plane_move_status; //!<coordinated move status for S plane.
-	/*66-69*/	SL	s_distance; //!<distance traveled in coordinated move for S plane.
-	/*70-71*/	UW	s_plane_buffer_available; //!<Buffer space remaining, S Plane.
-
-	/*72-73*/	UW	t_plane_segment_count; //!<segment count of coordinated move for T plane.
-	/*74-75*/	UW	t_plane_move_status; //!<Coordinated move status for T plane.
-	/*76-79*/	SL	t_distance; //!<distance traveled in coordinated move for T plane.
-	/*80-81*/	UW	t_plane_buffer_available; //!<Buffer space remaining, T Plane.
-
-	/*82-83*/	UW	axis_a_status; //!<A axis status.
-	/*84*/	    UB	axis_a_switches; //!<A axis switches.
-	/*85*/	    UB	axis_a_stop_code; //!<A axis stop code.
-	/*86-89*/	SL	axis_a_reference_position; //!<A axis reference position.
-	/*90-93*/	SL	axis_a_motor_position; //!<A axis motor position.
-	/*94-97*/	SL	axis_a_position_error; //!<A axis position error.
-	/*98-101*/	SL	axis_a_aux_position; //!<A axis auxiliary position.
-	/*102-105*/	SL	axis_a_velocity; //!<A axis velocity.
-	/*106-109*/	SL 	axis_a_torque; //!<A axis torque.
-	/*110-111*/	UW  axis_a_analog_in; //!<A axis analog input.
-	/*112*/	    UB	axis_a_halls; //!<A Hall Input Status.
-	/*113*/  	UB	axis_a_reserved; //!<Reserved.
-	/*114-117*/	SL	axis_a_variable; //!<A User-defined variable (ZA).
-
-	/*118-119*/	UW	axis_b_status; //!<B axis status.
-	/*120*/	    UB	axis_b_switches; //!<B axis switches.
-	/*121*/	    UB	axis_b_stop_code; //!<B axis stop code.
-	/*122-125*/	SL	axis_b_reference_position; //!<B axis reference position.
-	/*126-129*/	SL	axis_b_motor_position; //!<B axis motor position.
-	/*130-133*/	SL	axis_b_position_error; //!<B axis position error.
-	/*134-137*/	SL	axis_b_aux_position; //!<B axis auxiliary position.
-	/*138-141*/	SL	axis_b_velocity; //!<B axis velocity.
-	/*142-145*/	SL	axis_b_torque; //!<B axis torque.
-	/*146-147*/	UW  axis_b_analog_in; //!<B axis analog input.
-	/*148*/   	UB	axis_b_halls; //!<B Hall Input Status.
-	/*149*/	    UB	axis_b_reserved; //!<Reserved.
-	/*150-153*/	SL	axis_b_variable; //!<B User-defined variable (ZA).
-
-	/*154-155*/	UW	axis_c_status; //!<C axis status.
-	/*156*/  	UB	axis_c_switches; //!<C axis switches.
-	/*157*/ 	UB	axis_c_stop_code; //!<C axis stop code.
-	/*158-161*/	SL	axis_c_reference_position; //!<C axis reference position.
-	/*162-165*/	SL	axis_c_motor_position; //!<C axis motor position.
-	/*166-169*/	SL	axis_c_position_error; //!<C axis position error.
-	/*170-173*/	SL	axis_c_aux_position; //!<C axis auxiliary position.
-	/*174-177*/	SL	axis_c_velocity; //!<C axis velocity.
-	/*178-181*/	SL	axis_c_torque; //!<C axis torque.
-	/*182-183*/	UW 	axis_c_analog_in; //!<C axis analog input.
-	/*184*/	    UB	axis_c_halls; //!<C Hall Input Status.
-	/*185*/	    UB	axis_c_reserved; //!<Reserved.
-	/*186-189*/	SL	axis_c_variable; //!<C User-defined variable (ZA).
-
-	/*190-191*/	UW	axis_d_status; //!<D axis status.
-	/*192*/	    UB	axis_d_switches; //!<D axis switches.
-	/*193*/  	UB	axis_d_stop_code; //!<D axis stop code.
-	/*194-197*/	SL	axis_d_reference_position; //!<D axis reference position.
-	/*198-201*/	SL	axis_d_motor_position; //!<D axis motor position.
-	/*202-205*/	SL	axis_d_position_error; //!<D axis position error.
-	/*206-209*/	SL	axis_d_aux_position; //!<D axis auxiliary position.
-	/*210-213*/	SL	axis_d_velocity; //!<D axis velocity.
-	/*214-217*/	SL	axis_d_torque; //!<D axis torque.
-	/*218-219*/ UW  axis_d_analog_in; //!<D axis analog input.
-	/*220*/  	UB	axis_d_halls; //!<D Hall Input Status.
-	/*221*/ 	UB	axis_d_reserved; //!<Reserved.
-	/*222-225*/	SL	axis_d_variable; //!<D User-defined variable (ZA).
-
-	/*226-227*/	UW	axis_e_status; //!<E axis status.
-	/*228*/	    UB	axis_e_switches; //!<E axis switches.
-	/*229*/	    UB	axis_e_stop_code; //!<E axis stop code.
-	/*230-233*/	SL	axis_e_reference_position; //!<E axis reference position.
-	/*234-237*/	SL	axis_e_motor_position; //!<E axis motor position.
-	/*238-241*/	SL	axis_e_position_error; //!<E axis position error.
-	/*242-245*/	SL	axis_e_aux_position; //!<E axis auxiliary position.
-	/*246-249*/	SL	axis_e_velocity; //!<E axis velocity.
-	/*250-253*/	SL	axis_e_torque; //!<E axis torque.
-	/*254-255*/	UW  axis_e_analog_in; //!<E axis analog input.
-	/*256*/  	UB	axis_e_halls; //!<E Hall Input Status.
-	/*257*/	    UB	axis_e_reserved; //!<Reserved.
-	/*258-261*/	SL	axis_e_variable; //!<E User-defined variable (ZA).
-
-	/*262-263*/	UW	axis_f_status; //!<F axis status.
-	/*264*/	    UB	axis_f_switches; //!<F axis switches.
-	/*265*/	    UB	axis_f_stop_code; //!<F axis stop code.
-	/*266-269*/	SL	axis_f_reference_position; //!<F axis reference position.
-	/*270-273*/	SL	axis_f_motor_position; //!<F axis motor position.
-	/*274-277*/	SL	axis_f_position_error; //!<F axis position error.
-	/*278-281*/	SL	axis_f_aux_position; //!<F axis auxiliary position.
-	/*282-285*/	SL	axis_f_velocity; //!<F axis velocity.
-	/*286-289*/	SL	axis_f_torque; //!<F axis torque.
-	/*290-291*/	UW	axis_f_analog_in; //!<F axis analog input.
-	/*292*/	    UB	axis_f_halls; //!<F Hall Input Status.
-	/*293*/	    UB	axis_f_reserved; //!<Reserved.
-	/*294-297*/	SL	axis_f_variable; //!<F User-defined variable (ZA).
-
-	/*298-299*/	UW	axis_g_status; //!<G axis status.
-	/*300*/  	UB	axis_g_switches; //!<G axis switches.
-	/*301*/ 	UB	axis_g_stop_code; //!<G axis stop code.
-	/*302-305*/	SL	axis_g_reference_position; //!<G axis reference position.
-	/*306-309*/	SL	axis_g_motor_position; //!<G axis motor position.
-	/*310-313*/	SL	axis_g_position_error; //!<G axis position error.
-	/*314-317*/	SL	axis_g_aux_position; //!<G axis auxiliary position.
-	/*318-321*/	SL	axis_g_velocity; //!<G axis velocity.
-	/*322-325*/	SL	axis_g_torque; //!<G axis torque.
-	/*326-327*/ UW  axis_g_analog_in; //!<G axis analog input.
-	/*328*/	    UB	axis_g_halls; //!<G Hall Input Status.
-	/*329*/	    UB	axis_g_reserved; //!<Reserved.
-	/*330-333*/	SL	axis_g_variable; //!<G User-defined variable (ZA).
-
-	/*334-335*/	UW	axis_h_status; //!<H axis status.
-	/*336*/  	UB	axis_h_switches; //!<H axis switches.
-	/*337*/	    UB	axis_h_stop_code; //!<H axis stop code.
-	/*338-341*/	SL	axis_h_reference_position; //!<H axis reference position.
-	/*342-345*/	SL	axis_h_motor_position; //!<H axis motor position.
-	/*346-349*/	SL	axis_h_position_error; //!<H axis position error.
-	/*350-353*/	SL	axis_h_aux_position; //!<H axis auxiliary position.
-	/*354-357*/	SL	axis_h_velocity; //!<H axis velocity.
-	/*358-361*/	SL	axis_h_torque; //!<H axis torque.
-	/*362-363*/	UW  axis_h_analog_in; //!<H axis analog input.
-	/*364*/	    UB	axis_h_halls; //!<H Hall Input Status.
-	/*365*/  	UB	axis_h_reserved; //!<Reserved.
-	/*366-369*/	SL	axis_h_variable; //!<H User-defined variable (ZA).
-}; //DataRecord52000
+#define GALILDATARECORDMAXLENGTH \
+    512  //!< Max size for any Galil data record, equal to dual port ram size of
+         //!< PCI.
+
+//! Data record struct for DMC-4000 controllers, including 4000, 4200, 4103, and
+//! 500x0.
+struct GDataRecord4000 {
+    /*Offset   type name        description*/
+
+    /*00*/ UB header_0;  //!< 1st Byte of Header.
+    /*01*/ UB header_1;  //!< 2nd Byte of Header.
+    /*02*/ UB header_2;  //!< 3rd Byte of Header.
+    /*03*/ UB header_3;  //!< 4th Byte of Header.
+
+    /*04-05*/ UW sample_number;  //!< sample number.
+
+    /*06*/ UB input_bank_0;  //!< general input bank 0 (inputs 1-8).
+    /*07*/ UB input_bank_1;  //!< general input bank 1 (inputs 9-16).
+    /*08*/ UB input_bank_2;  //!< general input bank 2 (inputs 17-24).
+    /*09*/ UB input_bank_3;  //!< general input bank 3 (inputs 25-32).
+    /*10*/ UB input_bank_4;  //!< general input bank 4 (inputs 33-40).
+    /*11*/ UB input_bank_5;  //!< general input bank 5 (inputs 41-48).
+    /*12*/ UB input_bank_6;  //!< general input bank 6 (inputs 49-56).
+    /*13*/ UB input_bank_7;  //!< general input bank 7 (inputs 57-64).
+    /*14*/ UB input_bank_8;  //!< general input bank 8 (inputs 65-72).
+    /*15*/ UB input_bank_9;  //!< general input bank 9 (inputs 73-80).
+
+    /*16*/ UB output_bank_0;  //!< general output bank 0 (outputs 1-8).
+    /*17*/ UB output_bank_1;  //!< general output bank 1 (outputs 9-16).
+    /*18*/ UB output_bank_2;  //!< general output bank 2 (outputs 17-24).
+    /*19*/ UB output_bank_3;  //!< general output bank 3 (outputs 25-32).
+    /*20*/ UB output_bank_4;  //!< general output bank 4 (outputs 33-40).
+    /*21*/ UB output_bank_5;  //!< general output bank 5 (outputs 41-48).
+    /*22*/ UB output_bank_6;  //!< general output bank 6 (outputs 49-56).
+    /*23*/ UB output_bank_7;  //!< general output bank 7 (outputs 57-64).
+    /*24*/ UB output_bank_8;  //!< general output bank 8 (outputs 65-72).
+    /*25*/ UB output_bank_9;  //!< general output bank 9 (outputs 73-80).
+
+    /*26-27*/ SW reserved_0;   //!< Reserved.
+    /*28-29*/ SW reserved_2;   //!< Reserved.
+    /*30-31*/ SW reserved_4;   //!< Reserved.
+    /*32-33*/ SW reserved_6;   //!< Reserved.
+    /*34-35*/ SW reserved_8;   //!< Reserved.
+    /*36-37*/ SW reserved_10;  //!< Reserved.
+    /*38-39*/ SW reserved_12;  //!< Reserved.
+    /*40-41*/ SW reserved_14;  //!< Reserved.
+
+    /*42*/ UB ethernet_status_a;  //!< Ethernet Handle A Status.
+    /*43*/ UB ethernet_status_b;  //!< Ethernet Handle B Status.
+    /*44*/ UB ethernet_status_c;  //!< Ethernet Handle C Status.
+    /*45*/ UB ethernet_status_d;  //!< Ethernet Handle D Status.
+    /*46*/ UB ethernet_status_e;  //!< Ethernet Handle E Status.
+    /*47*/ UB ethernet_status_f;  //!< Ethernet Handle F Status.
+    /*48*/ UB ethernet_status_g;  //!< Ethernet Handle G Status.
+    /*49*/ UB ethernet_status_h;  //!< Ethernet Handle H Status.
+
+    /*50*/ UB error_code;           //!< error code.
+    /*51*/ UB thread_status;        //!< thread status
+    /*52-55*/ UL amplifier_status;  //!< Amplifier Status.
+
+    /*56-59*/ UL contour_segment_count;  //!< Segment Count for Contour Mode.
+    /*60-61*/ UW
+        contour_buffer_available;  //!< Buffer space remaining, Contour Mode.
+
+    /*62-63*/ UW s_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for S plane.
+    /*64-65*/ UW s_plane_move_status;  //!< coordinated move status for S plane.
+    /*66-69*/ SL
+        s_distance;  //!< distance traveled in coordinated move for S plane.
+    /*70-71*/ UW s_plane_buffer_available;  //!< Buffer space remaining, S
+                                            //!< Plane.
+
+    /*72-73*/ UW t_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for T plane.
+    /*74-75*/ UW t_plane_move_status;  //!< Coordinated move status for T plane.
+    /*76-79*/ SL
+        t_distance;  //!< distance traveled in coordinated move for T plane.
+    /*80-81*/ UW t_plane_buffer_available;  //!< Buffer space remaining, T
+                                            //!< Plane.
+
+    /*82-83*/ UW axis_a_status;              //!< A axis status.
+    /*84*/ UB axis_a_switches;               //!< A axis switches.
+    /*85*/ UB axis_a_stop_code;              //!< A axis stop code.
+    /*86-89*/ SL axis_a_reference_position;  //!< A axis reference position.
+    /*90-93*/ SL axis_a_motor_position;      //!< A axis motor position.
+    /*94-97*/ SL axis_a_position_error;      //!< A axis position error.
+    /*98-101*/ SL axis_a_aux_position;       //!< A axis auxiliary position.
+    /*102-105*/ SL axis_a_velocity;          //!< A axis velocity.
+    /*106-109*/ SL axis_a_torque;            //!< A axis torque.
+    /*110-111*/ UW axis_a_analog_in;         //!< A axis analog input.
+    /*112*/ UB axis_a_halls;                 //!< A Hall Input Status.
+    /*113*/ UB axis_a_reserved;              //!< Reserved.
+    /*114-117*/ SL axis_a_variable;          //!< A User-defined variable (ZA).
+
+    /*118-119*/ UW axis_b_status;              //!< B axis status.
+    /*120*/ UB axis_b_switches;                //!< B axis switches.
+    /*121*/ UB axis_b_stop_code;               //!< B axis stop code.
+    /*122-125*/ SL axis_b_reference_position;  //!< B axis reference position.
+    /*126-129*/ SL axis_b_motor_position;      //!< B axis motor position.
+    /*130-133*/ SL axis_b_position_error;      //!< B axis position error.
+    /*134-137*/ SL axis_b_aux_position;        //!< B axis auxiliary position.
+    /*138-141*/ SL axis_b_velocity;            //!< B axis velocity.
+    /*142-145*/ SL axis_b_torque;              //!< B axis torque.
+    /*146-147*/ UW axis_b_analog_in;           //!< B axis analog input.
+    /*148*/ UB axis_b_halls;                   //!< B Hall Input Status.
+    /*149*/ UB axis_b_reserved;                //!< Reserved.
+    /*150-153*/ SL axis_b_variable;  //!< B User-defined variable (ZA).
+
+    /*154-155*/ UW axis_c_status;              //!< C axis status.
+    /*156*/ UB axis_c_switches;                //!< C axis switches.
+    /*157*/ UB axis_c_stop_code;               //!< C axis stop code.
+    /*158-161*/ SL axis_c_reference_position;  //!< C axis reference position.
+    /*162-165*/ SL axis_c_motor_position;      //!< C axis motor position.
+    /*166-169*/ SL axis_c_position_error;      //!< C axis position error.
+    /*170-173*/ SL axis_c_aux_position;        //!< C axis auxiliary position.
+    /*174-177*/ SL axis_c_velocity;            //!< C axis velocity.
+    /*178-181*/ SL axis_c_torque;              //!< C axis torque.
+    /*182-183*/ UW axis_c_analog_in;           //!< C axis analog input.
+    /*184*/ UB axis_c_halls;                   //!< C Hall Input Status.
+    /*185*/ UB axis_c_reserved;                //!< Reserved.
+    /*186-189*/ SL axis_c_variable;  //!< C User-defined variable (ZA).
+
+    /*190-191*/ UW axis_d_status;              //!< D axis status.
+    /*192*/ UB axis_d_switches;                //!< D axis switches.
+    /*193*/ UB axis_d_stop_code;               //!< D axis stop code.
+    /*194-197*/ SL axis_d_reference_position;  //!< D axis reference position.
+    /*198-201*/ SL axis_d_motor_position;      //!< D axis motor position.
+    /*202-205*/ SL axis_d_position_error;      //!< D axis position error.
+    /*206-209*/ SL axis_d_aux_position;        //!< D axis auxiliary position.
+    /*210-213*/ SL axis_d_velocity;            //!< D axis velocity.
+    /*214-217*/ SL axis_d_torque;              //!< D axis torque.
+    /*218-219*/ UW axis_d_analog_in;           //!< D axis analog input.
+    /*220*/ UB axis_d_halls;                   //!< D Hall Input Status.
+    /*221*/ UB axis_d_reserved;                //!< Reserved.
+    /*222-225*/ SL axis_d_variable;  //!< D User-defined variable (ZA).
+
+    /*226-227*/ UW axis_e_status;              //!< E axis status.
+    /*228*/ UB axis_e_switches;                //!< E axis switches.
+    /*229*/ UB axis_e_stop_code;               //!< E axis stop code.
+    /*230-233*/ SL axis_e_reference_position;  //!< E axis reference position.
+    /*234-237*/ SL axis_e_motor_position;      //!< E axis motor position.
+    /*238-241*/ SL axis_e_position_error;      //!< E axis position error.
+    /*242-245*/ SL axis_e_aux_position;        //!< E axis auxiliary position.
+    /*246-249*/ SL axis_e_velocity;            //!< E axis velocity.
+    /*250-253*/ SL axis_e_torque;              //!< E axis torque.
+    /*254-255*/ UW axis_e_analog_in;           //!< E axis analog input.
+    /*256*/ UB axis_e_halls;                   //!< E Hall Input Status.
+    /*257*/ UB axis_e_reserved;                //!< Reserved.
+    /*258-261*/ SL axis_e_variable;  //!< E User-defined variable (ZA).
+
+    /*262-263*/ UW axis_f_status;              //!< F axis status.
+    /*264*/ UB axis_f_switches;                //!< F axis switches.
+    /*265*/ UB axis_f_stop_code;               //!< F axis stop code.
+    /*266-269*/ SL axis_f_reference_position;  //!< F axis reference position.
+    /*270-273*/ SL axis_f_motor_position;      //!< F axis motor position.
+    /*274-277*/ SL axis_f_position_error;      //!< F axis position error.
+    /*278-281*/ SL axis_f_aux_position;        //!< F axis auxiliary position.
+    /*282-285*/ SL axis_f_velocity;            //!< F axis velocity.
+    /*286-289*/ SL axis_f_torque;              //!< F axis torque.
+    /*290-291*/ UW axis_f_analog_in;           //!< F axis analog input.
+    /*292*/ UB axis_f_halls;                   //!< F Hall Input Status.
+    /*293*/ UB axis_f_reserved;                //!< Reserved.
+    /*294-297*/ SL axis_f_variable;  //!< F User-defined variable (ZA).
+
+    /*298-299*/ UW axis_g_status;              //!< G axis status.
+    /*300*/ UB axis_g_switches;                //!< G axis switches.
+    /*301*/ UB axis_g_stop_code;               //!< G axis stop code.
+    /*302-305*/ SL axis_g_reference_position;  //!< G axis reference position.
+    /*306-309*/ SL axis_g_motor_position;      //!< G axis motor position.
+    /*310-313*/ SL axis_g_position_error;      //!< G axis position error.
+    /*314-317*/ SL axis_g_aux_position;        //!< G axis auxiliary position.
+    /*318-321*/ SL axis_g_velocity;            //!< G axis velocity.
+    /*322-325*/ SL axis_g_torque;              //!< G axis torque.
+    /*326-327*/ UW axis_g_analog_in;           //!< G axis analog input.
+    /*328*/ UB axis_g_halls;                   //!< G Hall Input Status.
+    /*329*/ UB axis_g_reserved;                //!< Reserved.
+    /*330-333*/ SL axis_g_variable;  //!< G User-defined variable (ZA).
+
+    /*334-335*/ UW axis_h_status;              //!< H axis status.
+    /*336*/ UB axis_h_switches;                //!< H axis switches.
+    /*337*/ UB axis_h_stop_code;               //!< H axis stop code.
+    /*338-341*/ SL axis_h_reference_position;  //!< H axis reference position.
+    /*342-345*/ SL axis_h_motor_position;      //!< H axis motor position.
+    /*346-349*/ SL axis_h_position_error;      //!< H axis position error.
+    /*350-353*/ SL axis_h_aux_position;        //!< H axis auxiliary position.
+    /*354-357*/ SL axis_h_velocity;            //!< H axis velocity.
+    /*358-361*/ SL axis_h_torque;              //!< H axis torque.
+    /*362-363*/ UW axis_h_analog_in;           //!< H axis analog input.
+    /*364*/ UB axis_h_halls;                   //!< H Hall Input Status.
+    /*365*/ UB axis_h_reserved;                //!< Reserved.
+    /*366-369*/ SL axis_h_variable;  //!< H User-defined variable (ZA).
+};                                   // DataRecord4000
+
+//! Data record struct for DMC-52000 controller. Same as DMC-4000, with bank
+//! indicator added at byte 40.
+struct GDataRecord52000 {
+    /*Offset   type name        description*/
+
+    /*00*/ UB header_0;  //!< 1st Byte of Header.
+    /*01*/ UB header_1;  //!< 2nd Byte of Header.
+    /*02*/ UB header_2;  //!< 3rd Byte of Header.
+    /*03*/ UB header_3;  //!< 4th Byte of Header.
+
+    /*04-05*/ UW sample_number;  //!< sample number.
+
+    /*06*/ UB input_bank_0;  //!< general input bank 0 (inputs 1-8).
+    /*07*/ UB input_bank_1;  //!< general input bank 1 (inputs 9-16).
+    /*08*/ UB input_bank_2;  //!< general input bank 2 (inputs 17-24).
+    /*09*/ UB input_bank_3;  //!< general input bank 3 (inputs 25-32).
+    /*10*/ UB input_bank_4;  //!< general input bank 4 (inputs 33-40).
+    /*11*/ UB input_bank_5;  //!< general input bank 5 (inputs 41-48).
+    /*12*/ UB input_bank_6;  //!< general input bank 6 (inputs 49-56).
+    /*13*/ UB input_bank_7;  //!< general input bank 7 (inputs 57-64).
+    /*14*/ UB input_bank_8;  //!< general input bank 8 (inputs 65-72).
+    /*15*/ UB input_bank_9;  //!< general input bank 9 (inputs 73-80).
+
+    /*16*/ UB output_bank_0;  //!< general output bank 0 (outputs 1-8).
+    /*17*/ UB output_bank_1;  //!< general output bank 1 (outputs 9-16).
+    /*18*/ UB output_bank_2;  //!< general output bank 2 (outputs 17-24).
+    /*19*/ UB output_bank_3;  //!< general output bank 3 (outputs 25-32).
+    /*20*/ UB output_bank_4;  //!< general output bank 4 (outputs 33-40).
+    /*21*/ UB output_bank_5;  //!< general output bank 5 (outputs 41-48).
+    /*22*/ UB output_bank_6;  //!< general output bank 6 (outputs 49-56).
+    /*23*/ UB output_bank_7;  //!< general output bank 7 (outputs 57-64).
+    /*24*/ UB output_bank_8;  //!< general output bank 8 (outputs 65-72).
+    /*25*/ UB output_bank_9;  //!< general output bank 9 (outputs 73-80).
+
+    /*26-27*/ SW reserved_0;   //!< Reserved.
+    /*28-29*/ SW reserved_2;   //!< Reserved.
+    /*30-31*/ SW reserved_4;   //!< Reserved.
+    /*32-33*/ SW reserved_6;   //!< Reserved.
+    /*34-35*/ SW reserved_8;   //!< Reserved.
+    /*36-37*/ SW reserved_10;  //!< Reserved.
+    /*38-39*/ SW reserved_12;  //!< Reserved.
+    /*40*/ UB ethercat_bank;   //!< EtherCAT Bank Indicator.
+    /*41*/ UB reserved_14;     //!< Reserved.
+
+    /*42*/ UB ethernet_status_a;  //!< Ethernet Handle A Status.
+    /*43*/ UB ethernet_status_b;  //!< Ethernet Handle B Status.
+    /*44*/ UB ethernet_status_c;  //!< Ethernet Handle C Status.
+    /*45*/ UB ethernet_status_d;  //!< Ethernet Handle D Status.
+    /*46*/ UB ethernet_status_e;  //!< Ethernet Handle E Status.
+    /*47*/ UB ethernet_status_f;  //!< Ethernet Handle F Status.
+    /*48*/ UB ethernet_status_g;  //!< Ethernet Handle G Status.
+    /*49*/ UB ethernet_status_h;  //!< Ethernet Handle H Status.
+
+    /*50*/ UB error_code;           //!< error code.
+    /*51*/ UB thread_status;        //!< thread status
+    /*52-55*/ UL amplifier_status;  //!< Amplifier Status.
+
+    /*56-59*/ UL contour_segment_count;  //!< Segment Count for Contour Mode.
+    /*60-61*/ UW
+        contour_buffer_available;  //!< Buffer space remaining, Contour Mode.
+
+    /*62-63*/ UW s_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for S plane.
+    /*64-65*/ UW s_plane_move_status;  //!< coordinated move status for S plane.
+    /*66-69*/ SL
+        s_distance;  //!< distance traveled in coordinated move for S plane.
+    /*70-71*/ UW s_plane_buffer_available;  //!< Buffer space remaining, S
+                                            //!< Plane.
+
+    /*72-73*/ UW t_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for T plane.
+    /*74-75*/ UW t_plane_move_status;  //!< Coordinated move status for T plane.
+    /*76-79*/ SL
+        t_distance;  //!< distance traveled in coordinated move for T plane.
+    /*80-81*/ UW t_plane_buffer_available;  //!< Buffer space remaining, T
+                                            //!< Plane.
+
+    /*82-83*/ UW axis_a_status;              //!< A axis status.
+    /*84*/ UB axis_a_switches;               //!< A axis switches.
+    /*85*/ UB axis_a_stop_code;              //!< A axis stop code.
+    /*86-89*/ SL axis_a_reference_position;  //!< A axis reference position.
+    /*90-93*/ SL axis_a_motor_position;      //!< A axis motor position.
+    /*94-97*/ SL axis_a_position_error;      //!< A axis position error.
+    /*98-101*/ SL axis_a_aux_position;       //!< A axis auxiliary position.
+    /*102-105*/ SL axis_a_velocity;          //!< A axis velocity.
+    /*106-109*/ SL axis_a_torque;            //!< A axis torque.
+    /*110-111*/ UW axis_a_analog_in;         //!< A axis analog input.
+    /*112*/ UB axis_a_halls;                 //!< A Hall Input Status.
+    /*113*/ UB axis_a_reserved;              //!< Reserved.
+    /*114-117*/ SL axis_a_variable;          //!< A User-defined variable (ZA).
+
+    /*118-119*/ UW axis_b_status;              //!< B axis status.
+    /*120*/ UB axis_b_switches;                //!< B axis switches.
+    /*121*/ UB axis_b_stop_code;               //!< B axis stop code.
+    /*122-125*/ SL axis_b_reference_position;  //!< B axis reference position.
+    /*126-129*/ SL axis_b_motor_position;      //!< B axis motor position.
+    /*130-133*/ SL axis_b_position_error;      //!< B axis position error.
+    /*134-137*/ SL axis_b_aux_position;        //!< B axis auxiliary position.
+    /*138-141*/ SL axis_b_velocity;            //!< B axis velocity.
+    /*142-145*/ SL axis_b_torque;              //!< B axis torque.
+    /*146-147*/ UW axis_b_analog_in;           //!< B axis analog input.
+    /*148*/ UB axis_b_halls;                   //!< B Hall Input Status.
+    /*149*/ UB axis_b_reserved;                //!< Reserved.
+    /*150-153*/ SL axis_b_variable;  //!< B User-defined variable (ZA).
+
+    /*154-155*/ UW axis_c_status;              //!< C axis status.
+    /*156*/ UB axis_c_switches;                //!< C axis switches.
+    /*157*/ UB axis_c_stop_code;               //!< C axis stop code.
+    /*158-161*/ SL axis_c_reference_position;  //!< C axis reference position.
+    /*162-165*/ SL axis_c_motor_position;      //!< C axis motor position.
+    /*166-169*/ SL axis_c_position_error;      //!< C axis position error.
+    /*170-173*/ SL axis_c_aux_position;        //!< C axis auxiliary position.
+    /*174-177*/ SL axis_c_velocity;            //!< C axis velocity.
+    /*178-181*/ SL axis_c_torque;              //!< C axis torque.
+    /*182-183*/ UW axis_c_analog_in;           //!< C axis analog input.
+    /*184*/ UB axis_c_halls;                   //!< C Hall Input Status.
+    /*185*/ UB axis_c_reserved;                //!< Reserved.
+    /*186-189*/ SL axis_c_variable;  //!< C User-defined variable (ZA).
+
+    /*190-191*/ UW axis_d_status;              //!< D axis status.
+    /*192*/ UB axis_d_switches;                //!< D axis switches.
+    /*193*/ UB axis_d_stop_code;               //!< D axis stop code.
+    /*194-197*/ SL axis_d_reference_position;  //!< D axis reference position.
+    /*198-201*/ SL axis_d_motor_position;      //!< D axis motor position.
+    /*202-205*/ SL axis_d_position_error;      //!< D axis position error.
+    /*206-209*/ SL axis_d_aux_position;        //!< D axis auxiliary position.
+    /*210-213*/ SL axis_d_velocity;            //!< D axis velocity.
+    /*214-217*/ SL axis_d_torque;              //!< D axis torque.
+    /*218-219*/ UW axis_d_analog_in;           //!< D axis analog input.
+    /*220*/ UB axis_d_halls;                   //!< D Hall Input Status.
+    /*221*/ UB axis_d_reserved;                //!< Reserved.
+    /*222-225*/ SL axis_d_variable;  //!< D User-defined variable (ZA).
+
+    /*226-227*/ UW axis_e_status;              //!< E axis status.
+    /*228*/ UB axis_e_switches;                //!< E axis switches.
+    /*229*/ UB axis_e_stop_code;               //!< E axis stop code.
+    /*230-233*/ SL axis_e_reference_position;  //!< E axis reference position.
+    /*234-237*/ SL axis_e_motor_position;      //!< E axis motor position.
+    /*238-241*/ SL axis_e_position_error;      //!< E axis position error.
+    /*242-245*/ SL axis_e_aux_position;        //!< E axis auxiliary position.
+    /*246-249*/ SL axis_e_velocity;            //!< E axis velocity.
+    /*250-253*/ SL axis_e_torque;              //!< E axis torque.
+    /*254-255*/ UW axis_e_analog_in;           //!< E axis analog input.
+    /*256*/ UB axis_e_halls;                   //!< E Hall Input Status.
+    /*257*/ UB axis_e_reserved;                //!< Reserved.
+    /*258-261*/ SL axis_e_variable;  //!< E User-defined variable (ZA).
+
+    /*262-263*/ UW axis_f_status;              //!< F axis status.
+    /*264*/ UB axis_f_switches;                //!< F axis switches.
+    /*265*/ UB axis_f_stop_code;               //!< F axis stop code.
+    /*266-269*/ SL axis_f_reference_position;  //!< F axis reference position.
+    /*270-273*/ SL axis_f_motor_position;      //!< F axis motor position.
+    /*274-277*/ SL axis_f_position_error;      //!< F axis position error.
+    /*278-281*/ SL axis_f_aux_position;        //!< F axis auxiliary position.
+    /*282-285*/ SL axis_f_velocity;            //!< F axis velocity.
+    /*286-289*/ SL axis_f_torque;              //!< F axis torque.
+    /*290-291*/ UW axis_f_analog_in;           //!< F axis analog input.
+    /*292*/ UB axis_f_halls;                   //!< F Hall Input Status.
+    /*293*/ UB axis_f_reserved;                //!< Reserved.
+    /*294-297*/ SL axis_f_variable;  //!< F User-defined variable (ZA).
+
+    /*298-299*/ UW axis_g_status;              //!< G axis status.
+    /*300*/ UB axis_g_switches;                //!< G axis switches.
+    /*301*/ UB axis_g_stop_code;               //!< G axis stop code.
+    /*302-305*/ SL axis_g_reference_position;  //!< G axis reference position.
+    /*306-309*/ SL axis_g_motor_position;      //!< G axis motor position.
+    /*310-313*/ SL axis_g_position_error;      //!< G axis position error.
+    /*314-317*/ SL axis_g_aux_position;        //!< G axis auxiliary position.
+    /*318-321*/ SL axis_g_velocity;            //!< G axis velocity.
+    /*322-325*/ SL axis_g_torque;              //!< G axis torque.
+    /*326-327*/ UW axis_g_analog_in;           //!< G axis analog input.
+    /*328*/ UB axis_g_halls;                   //!< G Hall Input Status.
+    /*329*/ UB axis_g_reserved;                //!< Reserved.
+    /*330-333*/ SL axis_g_variable;  //!< G User-defined variable (ZA).
+
+    /*334-335*/ UW axis_h_status;              //!< H axis status.
+    /*336*/ UB axis_h_switches;                //!< H axis switches.
+    /*337*/ UB axis_h_stop_code;               //!< H axis stop code.
+    /*338-341*/ SL axis_h_reference_position;  //!< H axis reference position.
+    /*342-345*/ SL axis_h_motor_position;      //!< H axis motor position.
+    /*346-349*/ SL axis_h_position_error;      //!< H axis position error.
+    /*350-353*/ SL axis_h_aux_position;        //!< H axis auxiliary position.
+    /*354-357*/ SL axis_h_velocity;            //!< H axis velocity.
+    /*358-361*/ SL axis_h_torque;              //!< H axis torque.
+    /*362-363*/ UW axis_h_analog_in;           //!< H axis analog input.
+    /*364*/ UB axis_h_halls;                   //!< H Hall Input Status.
+    /*365*/ UB axis_h_reserved;                //!< Reserved.
+    /*366-369*/ SL axis_h_variable;  //!< H User-defined variable (ZA).
+};                                   // DataRecord52000
 
 //! Data record struct for DMC-1806 controller.
 /*!
@@ -405,656 +417,679 @@ The 18x6 Data record is the same as 4000 except the following.
 -# No amplfifier status (bytes 52-55).
 -# No axis-specific hall input status.
 */
-struct GDataRecord1806
-{
-	/*Offset   type name        description*/
-
-	/*00-01*/  	UW	sample_number; //!<sample number.
-
-	/*02*/	    UB	input_bank_0; //!<general input bank 0 (inputs 1-8).
-	/*03*/	    UB	input_bank_1; //!<general input bank 1 (inputs 9-16).
-	/*04*/	    UB	input_bank_2; //!<general input bank 2 (inputs 17-24).
-	/*05*/	    UB	input_bank_3; //!<general input bank 3 (inputs 25-32).
-	/*06*/    	UB	input_bank_4; //!<general input bank 4 (inputs 33-40).
-	/*07*/	    UB	input_bank_5; //!<general input bank 5 (inputs 41-48).
-	/*08*/	    UB	input_bank_6; //!<general input bank 6 (inputs 49-56).
-	/*09*/   	UB	input_bank_7; //!<general input bank 7 (inputs 57-64).
-	/*10*/   	UB	input_bank_8; //!<general input bank 8 (inputs 65-72).
-	/*11*/	    UB	input_bank_9; //!<general input bank 9 (inputs 73-80).
-
-	/*12*/    	UB	output_bank_0; //!<general output bank 0 (outputs 1-8).
-	/*13*/	    UB	output_bank_1; //!<general output bank 1 (outputs 9-16).
-	/*14*/   	UB	output_bank_2; //!<general output bank 2 (outputs 17-24).
-	/*15*/	    UB	output_bank_3; //!<general output bank 3 (outputs 25-32).
-	/*16*/   	UB	output_bank_4; //!<general output bank 4 (outputs 33-40).
-	/*17*/	    UB	output_bank_5; //!<general output bank 5 (outputs 41-48).
-	/*18*/	    UB	output_bank_6; //!<general output bank 6 (outputs 49-56).
-	/*19*/	    UB	output_bank_7; //!<general output bank 7 (outputs 57-64).
-	/*20*/  	UB	output_bank_8; //!<general output bank 8 (outputs 65-72).
-	/*21*/  	UB	output_bank_9; //!<general output bank 9 (outputs 73-80).
-
-	/*22-23*/	SW  reserved_0; //!<Reserved.
-	/*24-25*/	SW 	reserved_2; //!<Reserved.
-	/*26-27*/	SW 	reserved_4; //!<Reserved.
-	/*28-29*/	SW	reserved_6; //!<Reserved.
-	/*30-31*/	SW	reserved_8; //!<Reserved.
-	/*32-33*/	SW	reserved_10; //!<Reserved.
-	/*34-35*/	SW	reserved_12; //!<Reserved.
-	/*36-37*/	SW	reserved_14; //!<Reserved.
-
-	/*38*/	    UB	reserved_16; //!<Reserved.
-	/*39*/   	UB	reserved_17; //!<Reserved.
-	/*40*/	    UB	reserved_18; //!<Reserved.
-	/*41*/   	UB	reserved_19; //!<Reserved.
-	/*42*/  	UB	reserved_20; //!<Reserved.
-	/*43*/	    UB	reserved_21; //!<Reserved.
-	/*44*/  	UB	reserved_22; //!<Reserved.
-	/*45*/  	UB	reserved_23; //!<Reserved.
-
-	/*46*/	    UB	error_code; //!<error code.
-	/*47*/  	UB	thread_status; //!<thread status.
-	/*48-51*/	UL	reserved_24; //!<Reserved.
-
-	/*52-55*/	UL	contour_segment_count; //!<Segment Count for Contour Mode.
-	/*56-57*/	UW	contour_buffer_available; //!<Buffer space remaining, Contour Mode.
-
-	/*58-59*/	UW	s_plane_segment_count; //!<segment count of coordinated move for S plane.
-	/*60-61*/	UW	s_plane_move_status; //!<coordinated move status for S plane.
-	/*62-65*/	SL	s_distance; //!<distance traveled in coordinated move for S plane.
-	/*66-67*/	UW	s_plane_buffer_available; //!<Buffer space remaining, S Plane.
-
-	/*68-69*/	UW	t_plane_segment_count; //!<segment count of coordinated move for T plane.
-	/*70-71*/	UW	t_plane_move_status; //!<Coordinated move status for T plane.
-	/*72-75*/	SL	t_distance; //!<distance traveled in coordinated move for T plane.
-	/*76-77*/	UW	t_plane_buffer_available; //!<Buffer space remaining, T Plane.
-
-	/*78-79*/	UW	axis_a_status; //!<A axis status.
-	/*80*/	    UB	axis_a_switches; //!<A axis switches.
-	/*81*/	    UB	axis_a_stop_code; //!<A axis stop code.
-	/*82-85*/	SL	axis_a_reference_position; //!<A axis reference position.
-	/*86-89*/	SL	axis_a_motor_position; //!<A axis motor position.
-	/*90-93*/	SL	axis_a_position_error; //!<A axis position error.
-	/*94-97*/	SL	axis_a_aux_position; //!<A axis auxiliary position.
-	/*98-101*/	SL	axis_a_velocity; //!<A axis velocity.
-	/*102-105*/	SL 	axis_a_torque; //!<A axis torque.
-	/*106-107*/	UW  axis_a_analog_in; //!<A axis analog input.
-	/*108*/	    UB	axis_a_reserved_0; //!<Reserved.
-	/*109*/  	UB	axis_a_reserved_1; //!<Reserved.
-	/*110-113*/	SL	axis_a_variable; //!<A User-defined variable (ZA).
-
-	/*114-115*/	UW	axis_b_status; //!<B axis status.
-	/*116*/	    UB	axis_b_switches; //!<B axis switches.
-	/*117*/	    UB	axis_b_stop_code; //!<B axis stop code.
-	/*118-121*/	SL	axis_b_reference_position; //!<B axis reference position.
-	/*122-125*/	SL	axis_b_motor_position; //!<B axis motor position.
-	/*126-129*/	SL	axis_b_position_error; //!<B axis position error.
-	/*130-133*/	SL	axis_b_aux_position; //!<B axis auxiliary position.
-	/*134-137*/	SL	axis_b_velocity; //!<B axis velocity.
-	/*138-141*/	SL	axis_b_torque; //!<B axis torque.
-	/*142-143*/	UW  axis_b_analog_in; //!<B axis analog input.
-	/*144*/   	UB	axis_b_reserved_0; //!<Reserved.
-	/*145*/	    UB	axis_b_reserved_1; //!<Reserved.
-	/*146-149*/	SL	axis_b_variable; //!<B User-defined variable (ZA).
-
-	/*150-151*/	UW	axis_c_status; //!<C axis status.
-	/*152*/  	UB	axis_c_switches; //!<C axis switches.
-	/*153*/ 	UB	axis_c_stop_code; //!<C axis stop code.
-	/*154-157*/	SL	axis_c_reference_position; //!<C axis reference position.
-	/*158-161*/	SL	axis_c_motor_position; //!<C axis motor position.
-	/*162-165*/	SL	axis_c_position_error; //!<C axis position error.
-	/*166-169*/	SL	axis_c_aux_position; //!<C axis auxiliary position.
-	/*170-173*/	SL	axis_c_velocity; //!<C axis velocity.
-	/*174-177*/	SL	axis_c_torque; //!<C axis torque.
-	/*178-179*/	UW 	axis_c_analog_in; //!<C axis analog input.
-	/*180*/	    UB	axis_c_reserved_0; //!<Reserved.
-	/*181*/	    UB	axis_c_reserved_1; //!<Reserved.
-	/*182-185*/	SL	axis_c_variable; //!<C User-defined variable (ZA).
-
-	/*186-187*/	UW	axis_d_status; //!<D axis status.
-	/*188*/	    UB	axis_d_switches; //!<D axis switches.
-	/*189*/  	UB	axis_d_stop_code; //!<D axis stop code.
-	/*190-193*/	SL	axis_d_reference_position; //!<D axis reference position.
-	/*194-197*/	SL	axis_d_motor_position; //!<D axis motor position.
-	/*198-201*/	SL	axis_d_position_error; //!<D axis position error.
-	/*202-205*/	SL	axis_d_aux_position; //!<D axis auxiliary position.
-	/*206-209*/	SL	axis_d_velocity; //!<D axis velocity.
-	/*210-213*/	SL	axis_d_torque; //!<D axis torque.
-	/*214-215*/ UW  axis_d_analog_in; //!<D axis analog input.
-	/*216*/  	UB	axis_d_reserved_0; //!<Reserved.
-	/*217*/ 	UB	axis_d_reserved_1; //!<Reserved.
-	/*218-221*/	SL	axis_d_variable; //!<D User-defined variable (ZA).
-
-	/*222-223*/	UW	axis_e_status; //!<E axis status.
-	/*224*/	    UB	axis_e_switches; //!<E axis switches.
-	/*225*/	    UB	axis_e_stop_code; //!<E axis stop code.
-	/*226-229*/	SL	axis_e_reference_position; //!<E axis reference position.
-	/*230-233*/	SL	axis_e_motor_position; //!<E axis motor position.
-	/*234-237*/	SL	axis_e_position_error; //!<E axis position error.
-	/*238-241*/	SL	axis_e_aux_position; //!<E axis auxiliary position.
-	/*242-245*/	SL	axis_e_velocity; //!<E axis velocity.
-	/*256-249*/	SL	axis_e_torque; //!<E axis torque.
-	/*250-251*/	UW  axis_e_analog_in; //!<E axis analog input.
-	/*252*/  	UB	axis_e_reserved_0; //!<Reserved.
-	/*253*/	    UB	axis_e_reserved_1; //!<Reserved.
-	/*254-257*/	SL	axis_e_variable; //!<E User-defined variable (ZA).
-
-	/*258-259*/	UW	axis_f_status; //!<F axis status.
-	/*260*/	    UB	axis_f_switches; //!<F axis switches.
-	/*261*/	    UB	axis_f_stop_code; //!<F axis stop code.
-	/*262-265*/	SL	axis_f_reference_position; //!<F axis reference position.
-	/*266-269*/	SL	axis_f_motor_position; //!<F axis motor position.
-	/*270-273*/	SL	axis_f_position_error; //!<F axis position error.
-	/*274-277*/	SL	axis_f_aux_position; //!<F axis auxiliary position.
-	/*278-281*/	SL	axis_f_velocity; //!<F axis velocity.
-	/*282-285*/	SL	axis_f_torque; //!<F axis torque.
-	/*286-287*/	UW	axis_f_analog_in; //!<F axis analog input.
-	/*288*/	    UB	axis_f_reserved_0; //!<Reserved.
-	/*289*/	    UB	axis_f_reserved_1; //!<Reserved.
-	/*290-293*/	SL	axis_f_variable; //!<F User-defined variable (ZA).
-
-	/*294-295*/	UW	axis_g_status; //!<G axis status.
-	/*296*/  	UB	axis_g_switches; //!<G axis switches.
-	/*297*/ 	UB	axis_g_stop_code; //!<G axis stop code.
-	/*298-301*/	SL	axis_g_reference_position; //!<G axis reference position.
-	/*302-305*/	SL	axis_g_motor_position; //!<G axis motor position.
-	/*306-309*/	SL	axis_g_position_error; //!<G axis position error.
-	/*310-313*/	SL	axis_g_aux_position; //!<G axis auxiliary position.
-	/*314-317*/	SL	axis_g_velocity; //!<G axis velocity.
-	/*318-321*/	SL	axis_g_torque; //!<G axis torque.
-	/*322-323*/ UW  axis_g_analog_in; //!<G axis analog input.
-	/*324*/	    UB	axis_g_reserved_0; //!<Reserved.
-	/*325*/	    UB	axis_g_reserved_1; //!<Reserved.
-	/*326-329*/	SL	axis_g_variable; //!<G User-defined variable (ZA).
-
-	/*330-331*/	UW	axis_h_status; //!<H axis status.
-	/*332*/  	UB	axis_h_switches; //!<H axis switches.
-	/*333*/	    UB	axis_h_stop_code; //!<H axis stop code.
-	/*334-337*/	SL	axis_h_reference_position; //!<H axis reference position.
-	/*338-341*/	SL	axis_h_motor_position; //!<H axis motor position.
-	/*342-345*/	SL	axis_h_position_error; //!<H axis position error.
-	/*346-349*/	SL	axis_h_aux_position; //!<H axis auxiliary position.
-	/*350-353*/	SL	axis_h_velocity; //!<H axis velocity.
-	/*354-357*/	SL	axis_h_torque; //!<H axis torque.
-	/*358-359*/	UW  axis_h_analog_in; //!<H axis analog input.
-	/*360*/	    UB	axis_h_reserved_0; //!<Reserved.
-	/*361*/  	UB	axis_h_reserved_1; //!<Reserved.
-	/*362-365*/	SL	axis_h_variable; //!<H User-defined variable (ZA).
-}; //DataRecord1806
+struct GDataRecord1806 {
+    /*Offset   type name        description*/
+
+    /*00-01*/ UW sample_number;  //!< sample number.
+
+    /*02*/ UB input_bank_0;  //!< general input bank 0 (inputs 1-8).
+    /*03*/ UB input_bank_1;  //!< general input bank 1 (inputs 9-16).
+    /*04*/ UB input_bank_2;  //!< general input bank 2 (inputs 17-24).
+    /*05*/ UB input_bank_3;  //!< general input bank 3 (inputs 25-32).
+    /*06*/ UB input_bank_4;  //!< general input bank 4 (inputs 33-40).
+    /*07*/ UB input_bank_5;  //!< general input bank 5 (inputs 41-48).
+    /*08*/ UB input_bank_6;  //!< general input bank 6 (inputs 49-56).
+    /*09*/ UB input_bank_7;  //!< general input bank 7 (inputs 57-64).
+    /*10*/ UB input_bank_8;  //!< general input bank 8 (inputs 65-72).
+    /*11*/ UB input_bank_9;  //!< general input bank 9 (inputs 73-80).
+
+    /*12*/ UB output_bank_0;  //!< general output bank 0 (outputs 1-8).
+    /*13*/ UB output_bank_1;  //!< general output bank 1 (outputs 9-16).
+    /*14*/ UB output_bank_2;  //!< general output bank 2 (outputs 17-24).
+    /*15*/ UB output_bank_3;  //!< general output bank 3 (outputs 25-32).
+    /*16*/ UB output_bank_4;  //!< general output bank 4 (outputs 33-40).
+    /*17*/ UB output_bank_5;  //!< general output bank 5 (outputs 41-48).
+    /*18*/ UB output_bank_6;  //!< general output bank 6 (outputs 49-56).
+    /*19*/ UB output_bank_7;  //!< general output bank 7 (outputs 57-64).
+    /*20*/ UB output_bank_8;  //!< general output bank 8 (outputs 65-72).
+    /*21*/ UB output_bank_9;  //!< general output bank 9 (outputs 73-80).
+
+    /*22-23*/ SW reserved_0;   //!< Reserved.
+    /*24-25*/ SW reserved_2;   //!< Reserved.
+    /*26-27*/ SW reserved_4;   //!< Reserved.
+    /*28-29*/ SW reserved_6;   //!< Reserved.
+    /*30-31*/ SW reserved_8;   //!< Reserved.
+    /*32-33*/ SW reserved_10;  //!< Reserved.
+    /*34-35*/ SW reserved_12;  //!< Reserved.
+    /*36-37*/ SW reserved_14;  //!< Reserved.
+
+    /*38*/ UB reserved_16;  //!< Reserved.
+    /*39*/ UB reserved_17;  //!< Reserved.
+    /*40*/ UB reserved_18;  //!< Reserved.
+    /*41*/ UB reserved_19;  //!< Reserved.
+    /*42*/ UB reserved_20;  //!< Reserved.
+    /*43*/ UB reserved_21;  //!< Reserved.
+    /*44*/ UB reserved_22;  //!< Reserved.
+    /*45*/ UB reserved_23;  //!< Reserved.
+
+    /*46*/ UB error_code;      //!< error code.
+    /*47*/ UB thread_status;   //!< thread status.
+    /*48-51*/ UL reserved_24;  //!< Reserved.
+
+    /*52-55*/ UL contour_segment_count;  //!< Segment Count for Contour Mode.
+    /*56-57*/ UW
+        contour_buffer_available;  //!< Buffer space remaining, Contour Mode.
+
+    /*58-59*/ UW s_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for S plane.
+    /*60-61*/ UW s_plane_move_status;  //!< coordinated move status for S plane.
+    /*62-65*/ SL
+        s_distance;  //!< distance traveled in coordinated move for S plane.
+    /*66-67*/ UW s_plane_buffer_available;  //!< Buffer space remaining, S
+                                            //!< Plane.
+
+    /*68-69*/ UW t_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for T plane.
+    /*70-71*/ UW t_plane_move_status;  //!< Coordinated move status for T plane.
+    /*72-75*/ SL
+        t_distance;  //!< distance traveled in coordinated move for T plane.
+    /*76-77*/ UW t_plane_buffer_available;  //!< Buffer space remaining, T
+                                            //!< Plane.
+
+    /*78-79*/ UW axis_a_status;              //!< A axis status.
+    /*80*/ UB axis_a_switches;               //!< A axis switches.
+    /*81*/ UB axis_a_stop_code;              //!< A axis stop code.
+    /*82-85*/ SL axis_a_reference_position;  //!< A axis reference position.
+    /*86-89*/ SL axis_a_motor_position;      //!< A axis motor position.
+    /*90-93*/ SL axis_a_position_error;      //!< A axis position error.
+    /*94-97*/ SL axis_a_aux_position;        //!< A axis auxiliary position.
+    /*98-101*/ SL axis_a_velocity;           //!< A axis velocity.
+    /*102-105*/ SL axis_a_torque;            //!< A axis torque.
+    /*106-107*/ UW axis_a_analog_in;         //!< A axis analog input.
+    /*108*/ UB axis_a_reserved_0;            //!< Reserved.
+    /*109*/ UB axis_a_reserved_1;            //!< Reserved.
+    /*110-113*/ SL axis_a_variable;          //!< A User-defined variable (ZA).
+
+    /*114-115*/ UW axis_b_status;              //!< B axis status.
+    /*116*/ UB axis_b_switches;                //!< B axis switches.
+    /*117*/ UB axis_b_stop_code;               //!< B axis stop code.
+    /*118-121*/ SL axis_b_reference_position;  //!< B axis reference position.
+    /*122-125*/ SL axis_b_motor_position;      //!< B axis motor position.
+    /*126-129*/ SL axis_b_position_error;      //!< B axis position error.
+    /*130-133*/ SL axis_b_aux_position;        //!< B axis auxiliary position.
+    /*134-137*/ SL axis_b_velocity;            //!< B axis velocity.
+    /*138-141*/ SL axis_b_torque;              //!< B axis torque.
+    /*142-143*/ UW axis_b_analog_in;           //!< B axis analog input.
+    /*144*/ UB axis_b_reserved_0;              //!< Reserved.
+    /*145*/ UB axis_b_reserved_1;              //!< Reserved.
+    /*146-149*/ SL axis_b_variable;  //!< B User-defined variable (ZA).
+
+    /*150-151*/ UW axis_c_status;              //!< C axis status.
+    /*152*/ UB axis_c_switches;                //!< C axis switches.
+    /*153*/ UB axis_c_stop_code;               //!< C axis stop code.
+    /*154-157*/ SL axis_c_reference_position;  //!< C axis reference position.
+    /*158-161*/ SL axis_c_motor_position;      //!< C axis motor position.
+    /*162-165*/ SL axis_c_position_error;      //!< C axis position error.
+    /*166-169*/ SL axis_c_aux_position;        //!< C axis auxiliary position.
+    /*170-173*/ SL axis_c_velocity;            //!< C axis velocity.
+    /*174-177*/ SL axis_c_torque;              //!< C axis torque.
+    /*178-179*/ UW axis_c_analog_in;           //!< C axis analog input.
+    /*180*/ UB axis_c_reserved_0;              //!< Reserved.
+    /*181*/ UB axis_c_reserved_1;              //!< Reserved.
+    /*182-185*/ SL axis_c_variable;  //!< C User-defined variable (ZA).
+
+    /*186-187*/ UW axis_d_status;              //!< D axis status.
+    /*188*/ UB axis_d_switches;                //!< D axis switches.
+    /*189*/ UB axis_d_stop_code;               //!< D axis stop code.
+    /*190-193*/ SL axis_d_reference_position;  //!< D axis reference position.
+    /*194-197*/ SL axis_d_motor_position;      //!< D axis motor position.
+    /*198-201*/ SL axis_d_position_error;      //!< D axis position error.
+    /*202-205*/ SL axis_d_aux_position;        //!< D axis auxiliary position.
+    /*206-209*/ SL axis_d_velocity;            //!< D axis velocity.
+    /*210-213*/ SL axis_d_torque;              //!< D axis torque.
+    /*214-215*/ UW axis_d_analog_in;           //!< D axis analog input.
+    /*216*/ UB axis_d_reserved_0;              //!< Reserved.
+    /*217*/ UB axis_d_reserved_1;              //!< Reserved.
+    /*218-221*/ SL axis_d_variable;  //!< D User-defined variable (ZA).
+
+    /*222-223*/ UW axis_e_status;              //!< E axis status.
+    /*224*/ UB axis_e_switches;                //!< E axis switches.
+    /*225*/ UB axis_e_stop_code;               //!< E axis stop code.
+    /*226-229*/ SL axis_e_reference_position;  //!< E axis reference position.
+    /*230-233*/ SL axis_e_motor_position;      //!< E axis motor position.
+    /*234-237*/ SL axis_e_position_error;      //!< E axis position error.
+    /*238-241*/ SL axis_e_aux_position;        //!< E axis auxiliary position.
+    /*242-245*/ SL axis_e_velocity;            //!< E axis velocity.
+    /*256-249*/ SL axis_e_torque;              //!< E axis torque.
+    /*250-251*/ UW axis_e_analog_in;           //!< E axis analog input.
+    /*252*/ UB axis_e_reserved_0;              //!< Reserved.
+    /*253*/ UB axis_e_reserved_1;              //!< Reserved.
+    /*254-257*/ SL axis_e_variable;  //!< E User-defined variable (ZA).
+
+    /*258-259*/ UW axis_f_status;              //!< F axis status.
+    /*260*/ UB axis_f_switches;                //!< F axis switches.
+    /*261*/ UB axis_f_stop_code;               //!< F axis stop code.
+    /*262-265*/ SL axis_f_reference_position;  //!< F axis reference position.
+    /*266-269*/ SL axis_f_motor_position;      //!< F axis motor position.
+    /*270-273*/ SL axis_f_position_error;      //!< F axis position error.
+    /*274-277*/ SL axis_f_aux_position;        //!< F axis auxiliary position.
+    /*278-281*/ SL axis_f_velocity;            //!< F axis velocity.
+    /*282-285*/ SL axis_f_torque;              //!< F axis torque.
+    /*286-287*/ UW axis_f_analog_in;           //!< F axis analog input.
+    /*288*/ UB axis_f_reserved_0;              //!< Reserved.
+    /*289*/ UB axis_f_reserved_1;              //!< Reserved.
+    /*290-293*/ SL axis_f_variable;  //!< F User-defined variable (ZA).
+
+    /*294-295*/ UW axis_g_status;              //!< G axis status.
+    /*296*/ UB axis_g_switches;                //!< G axis switches.
+    /*297*/ UB axis_g_stop_code;               //!< G axis stop code.
+    /*298-301*/ SL axis_g_reference_position;  //!< G axis reference position.
+    /*302-305*/ SL axis_g_motor_position;      //!< G axis motor position.
+    /*306-309*/ SL axis_g_position_error;      //!< G axis position error.
+    /*310-313*/ SL axis_g_aux_position;        //!< G axis auxiliary position.
+    /*314-317*/ SL axis_g_velocity;            //!< G axis velocity.
+    /*318-321*/ SL axis_g_torque;              //!< G axis torque.
+    /*322-323*/ UW axis_g_analog_in;           //!< G axis analog input.
+    /*324*/ UB axis_g_reserved_0;              //!< Reserved.
+    /*325*/ UB axis_g_reserved_1;              //!< Reserved.
+    /*326-329*/ SL axis_g_variable;  //!< G User-defined variable (ZA).
+
+    /*330-331*/ UW axis_h_status;              //!< H axis status.
+    /*332*/ UB axis_h_switches;                //!< H axis switches.
+    /*333*/ UB axis_h_stop_code;               //!< H axis stop code.
+    /*334-337*/ SL axis_h_reference_position;  //!< H axis reference position.
+    /*338-341*/ SL axis_h_motor_position;      //!< H axis motor position.
+    /*342-345*/ SL axis_h_position_error;      //!< H axis position error.
+    /*346-349*/ SL axis_h_aux_position;        //!< H axis auxiliary position.
+    /*350-353*/ SL axis_h_velocity;            //!< H axis velocity.
+    /*354-357*/ SL axis_h_torque;              //!< H axis torque.
+    /*358-359*/ UW axis_h_analog_in;           //!< H axis analog input.
+    /*360*/ UB axis_h_reserved_0;              //!< Reserved.
+    /*361*/ UB axis_h_reserved_1;              //!< Reserved.
+    /*362-365*/ SL axis_h_variable;  //!< H User-defined variable (ZA).
+};                                   // DataRecord1806
 
 //! Data record struct for DMC-2103 controllers.
-struct GDataRecord2103
-{
-
-	/*Offset   type name        description*/
-
-	/*00*/	    UB	header_0; //!<1st Byte of Header.
-	/*01*/	    UB	header_1; //!<2nd Byte of Header.
-	/*02*/	    UB	header_2; //!<3rd Byte of Header.
-	/*03*/	    UB	header_3; //!<4th Byte of Header.
-
-	/*04-05*/  	UW	sample_number; //!<sample number.
-
-	/*06*/	    UB	input_bank_0; //!<general input bank 0 (inputs 1-8).
-	/*07*/	    UB	input_bank_1; //!<general input bank 1 (inputs 9-16).
-	/*08*/	    UB	input_bank_2; //!<general input bank 2 (inputs 17-24).
-	/*09*/	    UB	input_bank_3; //!<general input bank 3 (inputs 25-32).
-	/*10*/    	UB	input_bank_4; //!<general input bank 4 (inputs 33-40).
-	/*11*/	    UB	input_bank_5; //!<general input bank 5 (inputs 41-48).
-	/*12*/	    UB	input_bank_6; //!<general input bank 6 (inputs 49-56).
-	/*13*/   	UB	input_bank_7; //!<general input bank 7 (inputs 57-64).
-	/*14*/   	UB	input_bank_8; //!<general input bank 8 (inputs 65-72).
-	/*15*/	    UB	input_bank_9; //!<general input bank 9 (inputs 73-80).
-
-	/*16*/    	UB	output_bank_0; //!<general output bank 0 (outputs 1-8).
-	/*17*/	    UB	output_bank_1; //!<general output bank 1 (outputs 9-16).
-	/*18*/   	UB	output_bank_2; //!<general output bank 2 (outputs 17-24).
-	/*19*/	    UB	output_bank_3; //!<general output bank 3 (outputs 25-32).
-	/*20*/   	UB	output_bank_4; //!<general output bank 4 (outputs 33-40).
-	/*21*/	    UB	output_bank_5; //!<general output bank 5 (outputs 41-48).
-	/*22*/	    UB	output_bank_6; //!<general output bank 6 (outputs 49-56).
-	/*23*/	    UB	output_bank_7; //!<general output bank 7 (outputs 57-64).
-	/*24*/  	UB	output_bank_8; //!<general output bank 8 (outputs 65-72).
-	/*25*/  	UB	output_bank_9; //!<general output bank 9 (outputs 73-80).
-
-	/*26*/	    UB	error_code; //!<error code.
-	/*27*/  	UB	general_status; //!<general status
-
-	/*28-29*/	UW	s_plane_segment_count; //!<segment count of coordinated move for S plane.
-	/*30-31*/	UW	s_plane_move_status; //!<coordinated move status for S plane.
-	/*32-35*/	SL	s_distance; //!<distance traveled in coordinated move for S plane.
-
-	/*36-37*/	UW	t_plane_segment_count; //!<segment count of coordinated move for T plane.
-	/*38-39*/	UW	t_plane_move_status; //!<Coordinated move status for T plane.
-	/*40-43*/	SL	t_distance; //!<distance traveled in coordinated move for T plane.
-
-	/*44-45*/	UW	axis_a_status; //!<A axis status.
-	/*46*/	    UB	axis_a_switches; //!<A axis switches.
-	/*47*/	    UB	axis_a_stop_code; //!<A axis stop code.
-	/*48-51*/	SL	axis_a_reference_position; //!<A axis reference position.
-	/*52-55*/	SL	axis_a_motor_position; //!<A axis motor position.
-	/*56-59*/	SL	axis_a_position_error; //!<A axis position error.
-	/*60-63*/	SL	axis_a_aux_position; //!<A axis auxiliary position.
-	/*64-67*/	SL	axis_a_velocity; //!<A axis velocity.
-	/*68-69*/	SW 	axis_a_torque; //!<A axis torque.
-	/*70-71*/	UW  axis_a_analog_in; //!<A axis analog input.
-
-	/*72-73*/	UW	axis_b_status; //!<B axis status.
-	/*74*/	    UB	axis_b_switches; //!<B axis switches.
-	/*75*/	    UB	axis_b_stop_code; //!<B axis stop code.
-	/*76-79*/	SL	axis_b_reference_position; //!<B axis reference position.
-	/*80-83*/	SL	axis_b_motor_position; //!<B axis motor position.
-	/*84-87*/	SL	axis_b_position_error; //!<B axis position error.
-	/*88-91*/	SL	axis_b_aux_position; //!<B axis auxiliary position.
-	/*92-95*/	SL	axis_b_velocity; //!<B axis velocity.
-	/*96-97*/	SW	axis_b_torque; //!<B axis torque.
-	/*98-99*/	UW  axis_b_analog_in; //!<B axis analog input.
-
-	/*100-101*/	UW	axis_c_status; //!<C axis status.
-	/*102*/  	UB	axis_c_switches; //!<C axis switches.
-	/*103*/ 	UB	axis_c_stop_code; //!<C axis stop code.
-	/*104-107*/	SL	axis_c_reference_position; //!<C axis reference position.
-	/*108-111*/	SL	axis_c_motor_position; //!<C axis motor position.
-	/*112-115*/	SL	axis_c_position_error; //!<C axis position error.
-	/*116-119*/	SL	axis_c_aux_position; //!<C axis auxiliary position.
-	/*120-123*/	SL	axis_c_velocity; //!<C axis velocity.
-	/*124-125*/	SW	axis_c_torque; //!<C axis torque.
-	/*126-127*/	UW 	axis_c_analog_in; //!<C axis analog input.
-
-	/*128-129*/	UW	axis_d_status; //!<D axis status.
-	/*130*/	    UB	axis_d_switches; //!<D axis switches.
-	/*131*/  	UB	axis_d_stop_code; //!<D axis stop code.
-	/*132-135*/	SL	axis_d_reference_position; //!<D axis reference position.
-	/*136-139*/	SL	axis_d_motor_position; //!<D axis motor position.
-	/*140-143*/	SL	axis_d_position_error; //!<D axis position error.
-	/*144-147*/	SL	axis_d_aux_position; //!<D axis auxiliary position.
-	/*148-151*/	SL	axis_d_velocity; //!<D axis velocity.
-	/*152-153*/	SW	axis_d_torque; //!<D axis torque.
-	/*154-155*/ UW  axis_d_analog_in; //!<D axis analog input.
-
-	/*156-157*/	UW	axis_e_status; //!<E axis status.
-	/*158*/	    UB	axis_e_switches; //!<E axis switches.
-	/*159*/	    UB	axis_e_stop_code; //!<E axis stop code.
-	/*160-163*/	SL	axis_e_reference_position; //!<E axis reference position.
-	/*164-167*/	SL	axis_e_motor_position; //!<E axis motor position.
-	/*168-171*/	SL	axis_e_position_error; //!<E axis position error.
-	/*172-175*/	SL	axis_e_aux_position; //!<E axis auxiliary position.
-	/*176-179*/	SL	axis_e_velocity; //!<E axis velocity.
-	/*180-181*/	SW	axis_e_torque; //!<E axis torque.
-	/*182-183*/	UW  axis_e_analog_in; //!<E axis analog input.
-
-	/*184-185*/	UW	axis_f_status; //!<F axis status.
-	/*186*/	    UB	axis_f_switches; //!<F axis switches.
-	/*187*/	    UB	axis_f_stop_code; //!<F axis stop code.
-	/*188-191*/	SL	axis_f_reference_position; //!<F axis reference position.
-	/*192-195*/	SL	axis_f_motor_position; //!<F axis motor position.
-	/*196-199*/	SL	axis_f_position_error; //!<F axis position error.
-	/*200-203*/	SL	axis_f_aux_position; //!<F axis auxiliary position.
-	/*204-207*/	SL	axis_f_velocity; //!<F axis velocity.
-	/*208-209*/	SW	axis_f_torque; //!<F axis torque.
-	/*210-211*/	UW	axis_f_analog_in; //!<F axis analog input.
-
-	/*212-213*/	UW	axis_g_status; //!<G axis status.
-	/*214*/  	UB	axis_g_switches; //!<G axis switches.
-	/*215*/ 	UB	axis_g_stop_code; //!<G axis stop code.
-	/*216-219*/	SL	axis_g_reference_position; //!<G axis reference position.
-	/*220-223*/	SL	axis_g_motor_position; //!<G axis motor position.
-	/*224-227*/	SL	axis_g_position_error; //!<G axis position error.
-	/*228-231*/	SL	axis_g_aux_position; //!<G axis auxiliary position.
-	/*232-235*/	SL	axis_g_velocity; //!<G axis velocity.
-	/*236-237*/	SW	axis_g_torque; //!<G axis torque.
-	/*238-239*/ UW  axis_g_analog_in; //!<G axis analog input.
-
-	/*240-241*/	UW	axis_h_status; //!<H axis status.
-	/*242*/  	UB	axis_h_switches; //!<H axis switches.
-	/*243*/	    UB	axis_h_stop_code; //!<H axis stop code.
-	/*244-247*/	SL	axis_h_reference_position; //!<H axis reference position.
-	/*248-251*/	SL	axis_h_motor_position; //!<H axis motor position.
-	/*252-255*/	SL	axis_h_position_error; //!<H axis position error.
-	/*256-259*/	SL	axis_h_aux_position; //!<H axis auxiliary position.
-	/*260-263*/	SL	axis_h_velocity; //!<H axis velocity.
-	/*264-265*/	SW	axis_h_torque; //!<H axis torque.
-	/*266-267*/	UW  axis_h_analog_in; //!<H axis analog input.
-}; //DataRecord2013
-
-//!  
+struct GDataRecord2103 {
+    /*Offset   type name        description*/
+
+    /*00*/ UB header_0;  //!< 1st Byte of Header.
+    /*01*/ UB header_1;  //!< 2nd Byte of Header.
+    /*02*/ UB header_2;  //!< 3rd Byte of Header.
+    /*03*/ UB header_3;  //!< 4th Byte of Header.
+
+    /*04-05*/ UW sample_number;  //!< sample number.
+
+    /*06*/ UB input_bank_0;  //!< general input bank 0 (inputs 1-8).
+    /*07*/ UB input_bank_1;  //!< general input bank 1 (inputs 9-16).
+    /*08*/ UB input_bank_2;  //!< general input bank 2 (inputs 17-24).
+    /*09*/ UB input_bank_3;  //!< general input bank 3 (inputs 25-32).
+    /*10*/ UB input_bank_4;  //!< general input bank 4 (inputs 33-40).
+    /*11*/ UB input_bank_5;  //!< general input bank 5 (inputs 41-48).
+    /*12*/ UB input_bank_6;  //!< general input bank 6 (inputs 49-56).
+    /*13*/ UB input_bank_7;  //!< general input bank 7 (inputs 57-64).
+    /*14*/ UB input_bank_8;  //!< general input bank 8 (inputs 65-72).
+    /*15*/ UB input_bank_9;  //!< general input bank 9 (inputs 73-80).
+
+    /*16*/ UB output_bank_0;  //!< general output bank 0 (outputs 1-8).
+    /*17*/ UB output_bank_1;  //!< general output bank 1 (outputs 9-16).
+    /*18*/ UB output_bank_2;  //!< general output bank 2 (outputs 17-24).
+    /*19*/ UB output_bank_3;  //!< general output bank 3 (outputs 25-32).
+    /*20*/ UB output_bank_4;  //!< general output bank 4 (outputs 33-40).
+    /*21*/ UB output_bank_5;  //!< general output bank 5 (outputs 41-48).
+    /*22*/ UB output_bank_6;  //!< general output bank 6 (outputs 49-56).
+    /*23*/ UB output_bank_7;  //!< general output bank 7 (outputs 57-64).
+    /*24*/ UB output_bank_8;  //!< general output bank 8 (outputs 65-72).
+    /*25*/ UB output_bank_9;  //!< general output bank 9 (outputs 73-80).
+
+    /*26*/ UB error_code;      //!< error code.
+    /*27*/ UB general_status;  //!< general status
+
+    /*28-29*/ UW s_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for S plane.
+    /*30-31*/ UW s_plane_move_status;  //!< coordinated move status for S plane.
+    /*32-35*/ SL
+        s_distance;  //!< distance traveled in coordinated move for S plane.
+
+    /*36-37*/ UW t_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for T plane.
+    /*38-39*/ UW t_plane_move_status;  //!< Coordinated move status for T plane.
+    /*40-43*/ SL
+        t_distance;  //!< distance traveled in coordinated move for T plane.
+
+    /*44-45*/ UW axis_a_status;              //!< A axis status.
+    /*46*/ UB axis_a_switches;               //!< A axis switches.
+    /*47*/ UB axis_a_stop_code;              //!< A axis stop code.
+    /*48-51*/ SL axis_a_reference_position;  //!< A axis reference position.
+    /*52-55*/ SL axis_a_motor_position;      //!< A axis motor position.
+    /*56-59*/ SL axis_a_position_error;      //!< A axis position error.
+    /*60-63*/ SL axis_a_aux_position;        //!< A axis auxiliary position.
+    /*64-67*/ SL axis_a_velocity;            //!< A axis velocity.
+    /*68-69*/ SW axis_a_torque;              //!< A axis torque.
+    /*70-71*/ UW axis_a_analog_in;           //!< A axis analog input.
+
+    /*72-73*/ UW axis_b_status;              //!< B axis status.
+    /*74*/ UB axis_b_switches;               //!< B axis switches.
+    /*75*/ UB axis_b_stop_code;              //!< B axis stop code.
+    /*76-79*/ SL axis_b_reference_position;  //!< B axis reference position.
+    /*80-83*/ SL axis_b_motor_position;      //!< B axis motor position.
+    /*84-87*/ SL axis_b_position_error;      //!< B axis position error.
+    /*88-91*/ SL axis_b_aux_position;        //!< B axis auxiliary position.
+    /*92-95*/ SL axis_b_velocity;            //!< B axis velocity.
+    /*96-97*/ SW axis_b_torque;              //!< B axis torque.
+    /*98-99*/ UW axis_b_analog_in;           //!< B axis analog input.
+
+    /*100-101*/ UW axis_c_status;              //!< C axis status.
+    /*102*/ UB axis_c_switches;                //!< C axis switches.
+    /*103*/ UB axis_c_stop_code;               //!< C axis stop code.
+    /*104-107*/ SL axis_c_reference_position;  //!< C axis reference position.
+    /*108-111*/ SL axis_c_motor_position;      //!< C axis motor position.
+    /*112-115*/ SL axis_c_position_error;      //!< C axis position error.
+    /*116-119*/ SL axis_c_aux_position;        //!< C axis auxiliary position.
+    /*120-123*/ SL axis_c_velocity;            //!< C axis velocity.
+    /*124-125*/ SW axis_c_torque;              //!< C axis torque.
+    /*126-127*/ UW axis_c_analog_in;           //!< C axis analog input.
+
+    /*128-129*/ UW axis_d_status;              //!< D axis status.
+    /*130*/ UB axis_d_switches;                //!< D axis switches.
+    /*131*/ UB axis_d_stop_code;               //!< D axis stop code.
+    /*132-135*/ SL axis_d_reference_position;  //!< D axis reference position.
+    /*136-139*/ SL axis_d_motor_position;      //!< D axis motor position.
+    /*140-143*/ SL axis_d_position_error;      //!< D axis position error.
+    /*144-147*/ SL axis_d_aux_position;        //!< D axis auxiliary position.
+    /*148-151*/ SL axis_d_velocity;            //!< D axis velocity.
+    /*152-153*/ SW axis_d_torque;              //!< D axis torque.
+    /*154-155*/ UW axis_d_analog_in;           //!< D axis analog input.
+
+    /*156-157*/ UW axis_e_status;              //!< E axis status.
+    /*158*/ UB axis_e_switches;                //!< E axis switches.
+    /*159*/ UB axis_e_stop_code;               //!< E axis stop code.
+    /*160-163*/ SL axis_e_reference_position;  //!< E axis reference position.
+    /*164-167*/ SL axis_e_motor_position;      //!< E axis motor position.
+    /*168-171*/ SL axis_e_position_error;      //!< E axis position error.
+    /*172-175*/ SL axis_e_aux_position;        //!< E axis auxiliary position.
+    /*176-179*/ SL axis_e_velocity;            //!< E axis velocity.
+    /*180-181*/ SW axis_e_torque;              //!< E axis torque.
+    /*182-183*/ UW axis_e_analog_in;           //!< E axis analog input.
+
+    /*184-185*/ UW axis_f_status;              //!< F axis status.
+    /*186*/ UB axis_f_switches;                //!< F axis switches.
+    /*187*/ UB axis_f_stop_code;               //!< F axis stop code.
+    /*188-191*/ SL axis_f_reference_position;  //!< F axis reference position.
+    /*192-195*/ SL axis_f_motor_position;      //!< F axis motor position.
+    /*196-199*/ SL axis_f_position_error;      //!< F axis position error.
+    /*200-203*/ SL axis_f_aux_position;        //!< F axis auxiliary position.
+    /*204-207*/ SL axis_f_velocity;            //!< F axis velocity.
+    /*208-209*/ SW axis_f_torque;              //!< F axis torque.
+    /*210-211*/ UW axis_f_analog_in;           //!< F axis analog input.
+
+    /*212-213*/ UW axis_g_status;              //!< G axis status.
+    /*214*/ UB axis_g_switches;                //!< G axis switches.
+    /*215*/ UB axis_g_stop_code;               //!< G axis stop code.
+    /*216-219*/ SL axis_g_reference_position;  //!< G axis reference position.
+    /*220-223*/ SL axis_g_motor_position;      //!< G axis motor position.
+    /*224-227*/ SL axis_g_position_error;      //!< G axis position error.
+    /*228-231*/ SL axis_g_aux_position;        //!< G axis auxiliary position.
+    /*232-235*/ SL axis_g_velocity;            //!< G axis velocity.
+    /*236-237*/ SW axis_g_torque;              //!< G axis torque.
+    /*238-239*/ UW axis_g_analog_in;           //!< G axis analog input.
+
+    /*240-241*/ UW axis_h_status;              //!< H axis status.
+    /*242*/ UB axis_h_switches;                //!< H axis switches.
+    /*243*/ UB axis_h_stop_code;               //!< H axis stop code.
+    /*244-247*/ SL axis_h_reference_position;  //!< H axis reference position.
+    /*248-251*/ SL axis_h_motor_position;      //!< H axis motor position.
+    /*252-255*/ SL axis_h_position_error;      //!< H axis position error.
+    /*256-259*/ SL axis_h_aux_position;        //!< H axis auxiliary position.
+    /*260-263*/ SL axis_h_velocity;            //!< H axis velocity.
+    /*264-265*/ SW axis_h_torque;              //!< H axis torque.
+    /*266-267*/ UW axis_h_analog_in;           //!< H axis analog input.
+};                                             // DataRecord2013
+
+//!
 //! Data record struct for DMC-1802 controllers.
 /*!
 The 18x2 Data record is the Same as 2103 except the following.
 -# No header bytes. Software removes it from QR.
 -# No analog in axis data.
 */
-struct GDataRecord1802
-{
-
-	/*Offset   type name        description*/
-
-	/*00-01*/  	UW	sample_number; //!<sample number.
-
-	/*02*/	    UB	input_bank_0; //!<general input bank 0 (inputs 1-8).
-	/*03*/	    UB	input_bank_1; //!<general input bank 1 (inputs 9-16).
-	/*04*/	    UB	input_bank_2; //!<general input bank 2 (inputs 17-24).
-	/*05*/	    UB	input_bank_3; //!<general input bank 3 (inputs 25-32).
-	/*06*/    	UB	input_bank_4; //!<general input bank 4 (inputs 33-40).
-	/*07*/	    UB	input_bank_5; //!<general input bank 5 (inputs 41-48).
-	/*08*/	    UB	input_bank_6; //!<general input bank 6 (inputs 49-56).
-	/*09*/   	UB	input_bank_7; //!<general input bank 7 (inputs 57-64).
-	/*10*/   	UB	input_bank_8; //!<general input bank 8 (inputs 65-72).
-	/*11*/	    UB	input_bank_9; //!<general input bank 9 (inputs 73-80).
-
-	/*12*/    	UB	output_bank_0; //!<general output bank 0 (outputs 1-8).
-	/*13*/	    UB	output_bank_1; //!<general output bank 1 (outputs 9-16).
-	/*14*/   	UB	output_bank_2; //!<general output bank 2 (outputs 17-24).
-	/*15*/	    UB	output_bank_3; //!<general output bank 3 (outputs 25-32).
-	/*16*/   	UB	output_bank_4; //!<general output bank 4 (outputs 33-40).
-	/*17*/	    UB	output_bank_5; //!<general output bank 5 (outputs 41-48).
-	/*18*/	    UB	output_bank_6; //!<general output bank 6 (outputs 49-56).
-	/*19*/	    UB	output_bank_7; //!<general output bank 7 (outputs 57-64).
-	/*20*/  	UB	output_bank_8; //!<general output bank 8 (outputs 65-72).
-	/*21*/  	UB	output_bank_9; //!<general output bank 9 (outputs 73-80).
-
-	/*22*/	    UB	error_code; //!<error code.
-	/*23*/  	UB	general_status; //!<general status
-
-	/*24-25*/	UW	s_plane_segment_count; //!<segment count of coordinated move for S plane.
-	/*26-27*/	UW	s_plane_move_status; //!<coordinated move status for S plane.
-	/*28-31*/	SL	s_distance; //!<distance traveled in coordinated move for S plane.
-
-	/*32-33*/	UW	t_plane_segment_count; //!<segment count of coordinated move for T plane.
-	/*34-35*/	UW	t_plane_move_status; //!<Coordinated move status for T plane.
-	/*36-39*/	SL	t_distance; //!<distance traveled in coordinated move for T plane.
-
-	/*40-41*/	UW	axis_a_status; //!<A axis status.
-	/*42*/	    UB	axis_a_switches; //!<A axis switches.
-	/*43*/	    UB	axis_a_stop_code; //!<A axis stop code.
-	/*44-47*/	SL	axis_a_reference_position; //!<A axis reference position.
-	/*48-51*/	SL	axis_a_motor_position; //!<A axis motor position.
-	/*52-55*/	SL	axis_a_position_error; //!<A axis position error.
-	/*56-59*/	SL	axis_a_aux_position; //!<A axis auxiliary position.
-	/*60-63*/	SL	axis_a_velocity; //!<A axis velocity.
-	/*64-65*/	SW 	axis_a_torque; //!<A axis torque.
-	/*66*/	    UB	axis_a_reserved_0; //!<Reserved.
-	/*67*/      UB	axis_a_reserved_1; //!<Reserved.
-	
-	/*68-69*/   UW	axis_b_status; //!<B axis status.
-	/*70*/	    UB	axis_b_switches; //!<B axis switches.
-	/*71*/	    UB	axis_b_stop_code; //!<B axis stop code.
-	/*72-75*/	SL	axis_b_reference_position; //!<B axis reference position.
-	/*76-79*/	SL	axis_b_motor_position; //!<B axis motor position.
-	/*80-83*/	SL	axis_b_position_error; //!<B axis position error.
-	/*84-87*/	SL	axis_b_aux_position; //!<B axis auxiliary position.
-	/*88-91*/	SL	axis_b_velocity; //!<B axis velocity.
-	/*92-93*/	SW	axis_b_torque; //!<B axis torque.
-	/*94*/	    UB	axis_b_reserved_0; //!<Reserved.
-	/*95*/      UB	axis_b_reserved_1; //!<Reserved.
-
-	/*96-97*/	UW	axis_c_status; //!<C axis status.
-	/*98*/  	UB	axis_c_switches; //!<C axis switches.
-	/*99*/		UB	axis_c_stop_code; //!<C axis stop code.
-	/*100-103*/	SL	axis_c_reference_position; //!<C axis reference position.
-	/*104-107*/	SL	axis_c_motor_position; //!<C axis motor position.
-	/*108-111*/	SL	axis_c_position_error; //!<C axis position error.
-	/*112-115*/	SL	axis_c_aux_position; //!<C axis auxiliary position.
-	/*116-119*/	SL	axis_c_velocity; //!<C axis velocity.
-	/*120-121*/	SW	axis_c_torque; //!<C axis torque.
-	/*122*/	    UB	axis_c_reserved_0; //!<Reserved.
-	/*123*/     UB	axis_c_reserved_1; //!<Reserved.
-
-	/*124-125*/	UW	axis_d_status; //!<D axis status.
-	/*126*/	    UB	axis_d_switches; //!<D axis switches.
-	/*127*/  	UB	axis_d_stop_code; //!<D axis stop code.
-	/*128-131*/	SL	axis_d_reference_position; //!<D axis reference position.
-	/*132-135*/	SL	axis_d_motor_position; //!<D axis motor position.
-	/*136-139*/	SL	axis_d_position_error; //!<D axis position error.
-	/*140-143*/	SL	axis_d_aux_position; //!<D axis auxiliary position.
-	/*144-147*/	SL	axis_d_velocity; //!<D axis velocity.
-	/*148-149*/	SW	axis_d_torque; //!<D axis torque.
-	/*150*/	    UB	axis_d_reserved_0; //!<Reserved.
-	/*151*/     UB	axis_d_reserved_1; //!<Reserved.
-
-}; //DataRecord1802
-
-//! Data record struct for DMC-30010 controllers. 
-struct GDataRecord30000
-{
-
-	/*Offset   type name        description*/
-
-	/*00*/	    UB	header_0; //!<1st Byte of Header.
-	/*01*/	    UB	header_1; //!<2nd Byte of Header.
-	/*02*/	    UB	header_2; //!<3rd Byte of Header.
-	/*03*/	    UB	header_3; //!<4th Byte of Header.
-
-	/*04-05*/  	UW	sample_number; //!<sample number.
-
-	/*06*/	    UB	input_bank_0; //!<general input bank 0 (inputs 1-8).
-	/*07*/	    UB	input_bank_1; //!<general input bank 1 (inputs 9-16).
-
-	/*08*/    	UB	output_bank_0; //!<general output bank 0 (outputs 1-8).
-	/*09*/	    UB	output_bank_1; //!<general output bank 1 (outputs 9-16).
-
-	/*10*/	    UB	error_code; //!<error code.
-	/*11*/  	UB	thread_status; //!<thread status.
-
-	/*12-13*/	UW	input_analog_2; //!< Analog input 2. 1 is in axis data, see axis_a_analog_in.
-
-	/*14-15*/	UW	output_analog_1; //!< Analog output 1.
-	/*16-17*/	UW	output_analog_2; //!< Analog output 2.
-
-	/*18-21*/	UL	amplifier_status; //!<Amplifier Status.
-
-	/*22-25*/	UL	contour_segment_count; //!<Segment Count for Contour Mode.
-	/*26-27*/	UW	contour_buffer_available; //!<Buffer space remaining, Contour Mode.
-
-	/*28-29*/	UW	s_plane_segment_count; //!<segment count of coordinated move for S plane.
-	/*30-31*/	UW	s_plane_move_status; //!<coordinated move status for S plane.
-	/*32-35*/	SL	s_distance; //!<distance traveled in coordinated move for S plane.
-	/*36-37*/	UW	s_plane_buffer_available; //!<Buffer space remaining, S Plane.
-
-	/*38-39*/	UW	axis_a_status; //!<A axis status.
-	/*40*/	    UB	axis_a_switches; //!<A axis switches.
-	/*41*/	    UB	axis_a_stop_code; //!<A axis stop code.
-	/*42-45*/	SL	axis_a_reference_position; //!<A axis reference position.
-	/*46-49*/	SL	axis_a_motor_position; //!<A axis motor position.
-	/*50-53*/	SL	axis_a_position_error; //!<A axis position error.
-	/*54-57*/	SL	axis_a_aux_position; //!<A axis auxiliary position.
-	/*58-61*/	SL	axis_a_velocity; //!<A axis velocity.
-	/*62-65*/	SL 	axis_a_torque; //!<A axis torque.
-	/*66-67*/	UW  axis_a_analog_in; //!<A axis analog input.
-	/*68*/	    UB	axis_a_halls; //!<A Hall Input Status.
-	/*69*/  	UB	axis_a_reserved; //!<Reserved.
-	/*70-73*/	SL	axis_a_variable; //!<A User-defined variable (ZA).
-}; //DataRecord30000
-
-//! Data record struct for RIO-471xx and RIO-472xx PLCs. Includes encoder fields.
-struct GDataRecord47000_ENC
-{
-
-	/*Offset   type name        description*/
-
-	/*00*/	    UB	header_0; //!< 1st Byte of Header.
-	/*01*/	    UB	header_1; //!< 2nd Byte of Header.
-	/*02*/	    UB	header_2; //!< 3rd Byte of Header.
-	/*03*/	    UB	header_3; //!< 4th Byte of Header.
-
-	/*04-05*/  	UW	sample_number; //!< Sample number.
-	/*06*/	    UB	error_code; //!< Error code.
-	/*07*/  	UB	general_status; //!< General status.
-
-	/*08-09*/	UW	output_analog_0; //!< Analog output 0.
-	/*10-11*/	UW	output_analog_1; //!< Analog output 1.
-	/*12-13*/	UW	output_analog_2; //!< Analog output 2.
-	/*14-15*/	UW	output_analog_3; //!< Analog output 3.
-	/*16-17*/	UW	output_analog_4; //!< Analog output 4.
-	/*18-19*/	UW	output_analog_5; //!< Analog output 5.
-	/*20-21*/	UW	output_analog_6; //!< Analog output 6.
-	/*22-23*/	UW	output_analog_7; //!< Analog output 7.
-
-	/*24-25*/	UW	input_analog_0; //!< Analog input 0.
-	/*26-27*/	UW	input_analog_1; //!< Analog input 1.
-	/*28-29*/	UW	input_analog_2; //!< Analog input 2.
-	/*30-31*/	UW	input_analog_3; //!< Analog input 3.
-	/*32-33*/	UW	input_analog_4; //!< Analog input 4.
-	/*34-35*/	UW	input_analog_5; //!< Analog input 5.
-	/*36-37*/	UW	input_analog_6; //!< Analog input 6.
-	/*38-39*/	UW	input_analog_7; //!< Analog input 7.
-
-	/*40-41*/	UW	output_bank_0; //!< Digital outputs 0-15;
-
-	/*42-43*/	UW	input_bank_0; //!< Digital inputs 0-15;
-
-	/*44-47*/	UL	pulse_count_0; //!< Pulse counter (see PC).
-	/*48-51*/	SL	zc_variable; //!< ZC User-defined variable (see ZC). 
-	/*52-55*/	SL	zd_variable; //!< ZD User-defined variable (see ZD).
-
-	/*56-59*/	SL	encoder_0; //!< Encoder channel 0. Data only valid for parts with -BISS, -QUAD, or -SSI.
-	/*60-63*/	SL	encoder_1; //!< Encoder channel 1. Data only valid for parts with -BISS, -QUAD, or -SSI.
-	/*64-67*/	SL	encoder_2; //!< Encoder channel 2. Data only valid for parts with -BISS, -QUAD, or -SSI.
-	/*68-71*/	SL	encoder_3; //!< Encoder channel 3. Data only valid for parts with -BISS, -QUAD, or -SSI.
-
-}; //GDataRecord47000_ENC
+struct GDataRecord1802 {
+    /*Offset   type name        description*/
+
+    /*00-01*/ UW sample_number;  //!< sample number.
+
+    /*02*/ UB input_bank_0;  //!< general input bank 0 (inputs 1-8).
+    /*03*/ UB input_bank_1;  //!< general input bank 1 (inputs 9-16).
+    /*04*/ UB input_bank_2;  //!< general input bank 2 (inputs 17-24).
+    /*05*/ UB input_bank_3;  //!< general input bank 3 (inputs 25-32).
+    /*06*/ UB input_bank_4;  //!< general input bank 4 (inputs 33-40).
+    /*07*/ UB input_bank_5;  //!< general input bank 5 (inputs 41-48).
+    /*08*/ UB input_bank_6;  //!< general input bank 6 (inputs 49-56).
+    /*09*/ UB input_bank_7;  //!< general input bank 7 (inputs 57-64).
+    /*10*/ UB input_bank_8;  //!< general input bank 8 (inputs 65-72).
+    /*11*/ UB input_bank_9;  //!< general input bank 9 (inputs 73-80).
+
+    /*12*/ UB output_bank_0;  //!< general output bank 0 (outputs 1-8).
+    /*13*/ UB output_bank_1;  //!< general output bank 1 (outputs 9-16).
+    /*14*/ UB output_bank_2;  //!< general output bank 2 (outputs 17-24).
+    /*15*/ UB output_bank_3;  //!< general output bank 3 (outputs 25-32).
+    /*16*/ UB output_bank_4;  //!< general output bank 4 (outputs 33-40).
+    /*17*/ UB output_bank_5;  //!< general output bank 5 (outputs 41-48).
+    /*18*/ UB output_bank_6;  //!< general output bank 6 (outputs 49-56).
+    /*19*/ UB output_bank_7;  //!< general output bank 7 (outputs 57-64).
+    /*20*/ UB output_bank_8;  //!< general output bank 8 (outputs 65-72).
+    /*21*/ UB output_bank_9;  //!< general output bank 9 (outputs 73-80).
+
+    /*22*/ UB error_code;      //!< error code.
+    /*23*/ UB general_status;  //!< general status
+
+    /*24-25*/ UW s_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for S plane.
+    /*26-27*/ UW s_plane_move_status;  //!< coordinated move status for S plane.
+    /*28-31*/ SL
+        s_distance;  //!< distance traveled in coordinated move for S plane.
+
+    /*32-33*/ UW t_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for T plane.
+    /*34-35*/ UW t_plane_move_status;  //!< Coordinated move status for T plane.
+    /*36-39*/ SL
+        t_distance;  //!< distance traveled in coordinated move for T plane.
+
+    /*40-41*/ UW axis_a_status;              //!< A axis status.
+    /*42*/ UB axis_a_switches;               //!< A axis switches.
+    /*43*/ UB axis_a_stop_code;              //!< A axis stop code.
+    /*44-47*/ SL axis_a_reference_position;  //!< A axis reference position.
+    /*48-51*/ SL axis_a_motor_position;      //!< A axis motor position.
+    /*52-55*/ SL axis_a_position_error;      //!< A axis position error.
+    /*56-59*/ SL axis_a_aux_position;        //!< A axis auxiliary position.
+    /*60-63*/ SL axis_a_velocity;            //!< A axis velocity.
+    /*64-65*/ SW axis_a_torque;              //!< A axis torque.
+    /*66*/ UB axis_a_reserved_0;             //!< Reserved.
+    /*67*/ UB axis_a_reserved_1;             //!< Reserved.
+
+    /*68-69*/ UW axis_b_status;              //!< B axis status.
+    /*70*/ UB axis_b_switches;               //!< B axis switches.
+    /*71*/ UB axis_b_stop_code;              //!< B axis stop code.
+    /*72-75*/ SL axis_b_reference_position;  //!< B axis reference position.
+    /*76-79*/ SL axis_b_motor_position;      //!< B axis motor position.
+    /*80-83*/ SL axis_b_position_error;      //!< B axis position error.
+    /*84-87*/ SL axis_b_aux_position;        //!< B axis auxiliary position.
+    /*88-91*/ SL axis_b_velocity;            //!< B axis velocity.
+    /*92-93*/ SW axis_b_torque;              //!< B axis torque.
+    /*94*/ UB axis_b_reserved_0;             //!< Reserved.
+    /*95*/ UB axis_b_reserved_1;             //!< Reserved.
+
+    /*96-97*/ UW axis_c_status;                //!< C axis status.
+    /*98*/ UB axis_c_switches;                 //!< C axis switches.
+    /*99*/ UB axis_c_stop_code;                //!< C axis stop code.
+    /*100-103*/ SL axis_c_reference_position;  //!< C axis reference position.
+    /*104-107*/ SL axis_c_motor_position;      //!< C axis motor position.
+    /*108-111*/ SL axis_c_position_error;      //!< C axis position error.
+    /*112-115*/ SL axis_c_aux_position;        //!< C axis auxiliary position.
+    /*116-119*/ SL axis_c_velocity;            //!< C axis velocity.
+    /*120-121*/ SW axis_c_torque;              //!< C axis torque.
+    /*122*/ UB axis_c_reserved_0;              //!< Reserved.
+    /*123*/ UB axis_c_reserved_1;              //!< Reserved.
+
+    /*124-125*/ UW axis_d_status;              //!< D axis status.
+    /*126*/ UB axis_d_switches;                //!< D axis switches.
+    /*127*/ UB axis_d_stop_code;               //!< D axis stop code.
+    /*128-131*/ SL axis_d_reference_position;  //!< D axis reference position.
+    /*132-135*/ SL axis_d_motor_position;      //!< D axis motor position.
+    /*136-139*/ SL axis_d_position_error;      //!< D axis position error.
+    /*140-143*/ SL axis_d_aux_position;        //!< D axis auxiliary position.
+    /*144-147*/ SL axis_d_velocity;            //!< D axis velocity.
+    /*148-149*/ SW axis_d_torque;              //!< D axis torque.
+    /*150*/ UB axis_d_reserved_0;              //!< Reserved.
+    /*151*/ UB axis_d_reserved_1;              //!< Reserved.
+
+};  // DataRecord1802
+
+//! Data record struct for DMC-30010 controllers.
+struct GDataRecord30000 {
+    /*Offset   type name        description*/
+
+    /*00*/ UB header_0;  //!< 1st Byte of Header.
+    /*01*/ UB header_1;  //!< 2nd Byte of Header.
+    /*02*/ UB header_2;  //!< 3rd Byte of Header.
+    /*03*/ UB header_3;  //!< 4th Byte of Header.
+
+    /*04-05*/ UW sample_number;  //!< sample number.
+
+    /*06*/ UB input_bank_0;  //!< general input bank 0 (inputs 1-8).
+    /*07*/ UB input_bank_1;  //!< general input bank 1 (inputs 9-16).
+
+    /*08*/ UB output_bank_0;  //!< general output bank 0 (outputs 1-8).
+    /*09*/ UB output_bank_1;  //!< general output bank 1 (outputs 9-16).
+
+    /*10*/ UB error_code;     //!< error code.
+    /*11*/ UB thread_status;  //!< thread status.
+
+    /*12-13*/ UW input_analog_2;  //!< Analog input 2. 1 is in axis data, see
+                                  //!< axis_a_analog_in.
+
+    /*14-15*/ UW output_analog_1;  //!< Analog output 1.
+    /*16-17*/ UW output_analog_2;  //!< Analog output 2.
+
+    /*18-21*/ UL amplifier_status;  //!< Amplifier Status.
+
+    /*22-25*/ UL contour_segment_count;  //!< Segment Count for Contour Mode.
+    /*26-27*/ UW
+        contour_buffer_available;  //!< Buffer space remaining, Contour Mode.
+
+    /*28-29*/ UW s_plane_segment_count;  //!< segment count of coordinated move
+                                         //!< for S plane.
+    /*30-31*/ UW s_plane_move_status;  //!< coordinated move status for S plane.
+    /*32-35*/ SL
+        s_distance;  //!< distance traveled in coordinated move for S plane.
+    /*36-37*/ UW s_plane_buffer_available;  //!< Buffer space remaining, S
+                                            //!< Plane.
+
+    /*38-39*/ UW axis_a_status;              //!< A axis status.
+    /*40*/ UB axis_a_switches;               //!< A axis switches.
+    /*41*/ UB axis_a_stop_code;              //!< A axis stop code.
+    /*42-45*/ SL axis_a_reference_position;  //!< A axis reference position.
+    /*46-49*/ SL axis_a_motor_position;      //!< A axis motor position.
+    /*50-53*/ SL axis_a_position_error;      //!< A axis position error.
+    /*54-57*/ SL axis_a_aux_position;        //!< A axis auxiliary position.
+    /*58-61*/ SL axis_a_velocity;            //!< A axis velocity.
+    /*62-65*/ SL axis_a_torque;              //!< A axis torque.
+    /*66-67*/ UW axis_a_analog_in;           //!< A axis analog input.
+    /*68*/ UB axis_a_halls;                  //!< A Hall Input Status.
+    /*69*/ UB axis_a_reserved;               //!< Reserved.
+    /*70-73*/ SL axis_a_variable;            //!< A User-defined variable (ZA).
+};                                           // DataRecord30000
+
+//! Data record struct for RIO-471xx and RIO-472xx PLCs. Includes encoder
+//! fields.
+struct GDataRecord47000_ENC {
+    /*Offset   type name        description*/
+
+    /*00*/ UB header_0;  //!< 1st Byte of Header.
+    /*01*/ UB header_1;  //!< 2nd Byte of Header.
+    /*02*/ UB header_2;  //!< 3rd Byte of Header.
+    /*03*/ UB header_3;  //!< 4th Byte of Header.
+
+    /*04-05*/ UW sample_number;  //!< Sample number.
+    /*06*/ UB error_code;        //!< Error code.
+    /*07*/ UB general_status;    //!< General status.
+
+    /*08-09*/ UW output_analog_0;  //!< Analog output 0.
+    /*10-11*/ UW output_analog_1;  //!< Analog output 1.
+    /*12-13*/ UW output_analog_2;  //!< Analog output 2.
+    /*14-15*/ UW output_analog_3;  //!< Analog output 3.
+    /*16-17*/ UW output_analog_4;  //!< Analog output 4.
+    /*18-19*/ UW output_analog_5;  //!< Analog output 5.
+    /*20-21*/ UW output_analog_6;  //!< Analog output 6.
+    /*22-23*/ UW output_analog_7;  //!< Analog output 7.
+
+    /*24-25*/ UW input_analog_0;  //!< Analog input 0.
+    /*26-27*/ UW input_analog_1;  //!< Analog input 1.
+    /*28-29*/ UW input_analog_2;  //!< Analog input 2.
+    /*30-31*/ UW input_analog_3;  //!< Analog input 3.
+    /*32-33*/ UW input_analog_4;  //!< Analog input 4.
+    /*34-35*/ UW input_analog_5;  //!< Analog input 5.
+    /*36-37*/ UW input_analog_6;  //!< Analog input 6.
+    /*38-39*/ UW input_analog_7;  //!< Analog input 7.
+
+    /*40-41*/ UW output_bank_0;  //!< Digital outputs 0-15;
+
+    /*42-43*/ UW input_bank_0;  //!< Digital inputs 0-15;
+
+    /*44-47*/ UL pulse_count_0;  //!< Pulse counter (see PC).
+    /*48-51*/ SL zc_variable;    //!< ZC User-defined variable (see ZC).
+    /*52-55*/ SL zd_variable;    //!< ZD User-defined variable (see ZD).
+
+    /*56-59*/ SL encoder_0;  //!< Encoder channel 0. Data only valid for parts
+                             //!< with -BISS, -QUAD, or -SSI.
+    /*60-63*/ SL encoder_1;  //!< Encoder channel 1. Data only valid for parts
+                             //!< with -BISS, -QUAD, or -SSI.
+    /*64-67*/ SL encoder_2;  //!< Encoder channel 2. Data only valid for parts
+                             //!< with -BISS, -QUAD, or -SSI.
+    /*68-71*/ SL encoder_3;  //!< Encoder channel 3. Data only valid for parts
+                             //!< with -BISS, -QUAD, or -SSI.
+
+};  // GDataRecord47000_ENC
 
 //! Data record struct for RIO-47300. Includes encoder fields.
-struct GDataRecord47300_ENC
-{
-
-	/*Offset   type name        description*/
-
-	/*00*/	    UB	header_0; //!< 1st Byte of Header.
-	/*01*/	    UB	header_1; //!< 2nd Byte of Header.
-	/*02*/	    UB	header_2; //!< 3rd Byte of Header.
-	/*03*/	    UB	header_3; //!< 4th Byte of Header.
-
-	/*04-05*/  	UW	sample_number; //!< Sample number.
-	/*06*/	    UB	error_code; //!< Error code.
-	/*07*/  	UB	general_status; //!< General status.
-
-	/*08-09*/	UW	output_analog_0; //!< Analog output 0.
-	/*10-11*/	UW	output_analog_1; //!< Analog output 1.
-	/*12-13*/	UW	output_analog_2; //!< Analog output 2.
-	/*14-15*/	UW	output_analog_3; //!< Analog output 3.
-	/*16-17*/	UW	output_analog_4; //!< Analog output 4.
-	/*18-19*/	UW	output_analog_5; //!< Analog output 5.
-	/*20-21*/	UW	output_analog_6; //!< Analog output 6.
-	/*22-23*/	UW	output_analog_7; //!< Analog output 7.
-
-	/*24-25*/	UW	input_analog_0; //!< Analog input 0.
-	/*26-27*/	UW	input_analog_1; //!< Analog input 1.
-	/*28-29*/	UW	input_analog_2; //!< Analog input 2.
-	/*30-31*/	UW	input_analog_3; //!< Analog input 3.
-	/*32-33*/	UW	input_analog_4; //!< Analog input 4.
-	/*34-35*/	UW	input_analog_5; //!< Analog input 5.
-	/*36-37*/	UW	input_analog_6; //!< Analog input 6.
-	/*38-39*/	UW	input_analog_7; //!< Analog input 7.
-
-	/*40-41*/	UW	output_bank_0; //!< Digital outputs 0-15;
-	/*42-43*/	UW	output_bank_1; //!< Digital outputs 16-23;
-
-	/*44-45*/	UW	input_bank_0; //!< Digital inputs 0-15;
-	/*46-47*/	UW	input_bank_1; //!< Digital inputs 16-23;
-
-	/*48-51*/	UL	pulse_count_0; //!< Pulse counter (see PC).
-	/*52-55*/	SL	zc_variable; //!< ZC User-defined variable (see ZC). 
-	/*56-59*/	SL	zd_variable; //!< ZD User-defined variable (see ZD).
-
-	/*60-63*/	SL	encoder_0; //!< Encoder channel 0. Data only valid for parts with -BISS, -QUAD, or -SSI.
-	/*64-67*/	SL	encoder_1; //!< Encoder channel 1. Data only valid for parts with -BISS, -QUAD, or -SSI.
-	/*68-71*/	SL	encoder_2; //!< Encoder channel 2. Data only valid for parts with -BISS, -QUAD, or -SSI.
-	/*72-75*/	SL	encoder_3; //!< Encoder channel 3. Data only valid for parts with -BISS, -QUAD, or -SSI.
-
-}; //GDataRecord47300_ENC
+struct GDataRecord47300_ENC {
+    /*Offset   type name        description*/
+
+    /*00*/ UB header_0;  //!< 1st Byte of Header.
+    /*01*/ UB header_1;  //!< 2nd Byte of Header.
+    /*02*/ UB header_2;  //!< 3rd Byte of Header.
+    /*03*/ UB header_3;  //!< 4th Byte of Header.
+
+    /*04-05*/ UW sample_number;  //!< Sample number.
+    /*06*/ UB error_code;        //!< Error code.
+    /*07*/ UB general_status;    //!< General status.
+
+    /*08-09*/ UW output_analog_0;  //!< Analog output 0.
+    /*10-11*/ UW output_analog_1;  //!< Analog output 1.
+    /*12-13*/ UW output_analog_2;  //!< Analog output 2.
+    /*14-15*/ UW output_analog_3;  //!< Analog output 3.
+    /*16-17*/ UW output_analog_4;  //!< Analog output 4.
+    /*18-19*/ UW output_analog_5;  //!< Analog output 5.
+    /*20-21*/ UW output_analog_6;  //!< Analog output 6.
+    /*22-23*/ UW output_analog_7;  //!< Analog output 7.
+
+    /*24-25*/ UW input_analog_0;  //!< Analog input 0.
+    /*26-27*/ UW input_analog_1;  //!< Analog input 1.
+    /*28-29*/ UW input_analog_2;  //!< Analog input 2.
+    /*30-31*/ UW input_analog_3;  //!< Analog input 3.
+    /*32-33*/ UW input_analog_4;  //!< Analog input 4.
+    /*34-35*/ UW input_analog_5;  //!< Analog input 5.
+    /*36-37*/ UW input_analog_6;  //!< Analog input 6.
+    /*38-39*/ UW input_analog_7;  //!< Analog input 7.
+
+    /*40-41*/ UW output_bank_0;  //!< Digital outputs 0-15;
+    /*42-43*/ UW output_bank_1;  //!< Digital outputs 16-23;
+
+    /*44-45*/ UW input_bank_0;  //!< Digital inputs 0-15;
+    /*46-47*/ UW input_bank_1;  //!< Digital inputs 16-23;
+
+    /*48-51*/ UL pulse_count_0;  //!< Pulse counter (see PC).
+    /*52-55*/ SL zc_variable;    //!< ZC User-defined variable (see ZC).
+    /*56-59*/ SL zd_variable;    //!< ZD User-defined variable (see ZD).
+
+    /*60-63*/ SL encoder_0;  //!< Encoder channel 0. Data only valid for parts
+                             //!< with -BISS, -QUAD, or -SSI.
+    /*64-67*/ SL encoder_1;  //!< Encoder channel 1. Data only valid for parts
+                             //!< with -BISS, -QUAD, or -SSI.
+    /*68-71*/ SL encoder_2;  //!< Encoder channel 2. Data only valid for parts
+                             //!< with -BISS, -QUAD, or -SSI.
+    /*72-75*/ SL encoder_3;  //!< Encoder channel 3. Data only valid for parts
+                             //!< with -BISS, -QUAD, or -SSI.
+
+};  // GDataRecord47300_ENC
 
 //! Data record struct for RIO-47300 with 24EX I/O daughter board.
-struct GDataRecord47300_24EX
-{
-
-	/*Offset   type name        description*/
-
-	/*00*/	    UB	header_0; //!< 1st Byte of Header.
-	/*01*/	    UB	header_1; //!< 2nd Byte of Header.
-	/*02*/	    UB	header_2; //!< 3rd Byte of Header.
-	/*03*/	    UB	header_3; //!< 4th Byte of Header.
-
-	/*04-05*/  	UW	sample_number; //!< Sample number.
-	/*06*/	    UB	error_code; //!< Error code.
-	/*07*/  	UB	general_status; //!< General status.
-
-	/*08-09*/	UW	output_analog_0; //!< Analog output 0.
-	/*10-11*/	UW	output_analog_1; //!< Analog output 1.
-	/*12-13*/	UW	output_analog_2; //!< Analog output 2.
-	/*14-15*/	UW	output_analog_3; //!< Analog output 3.
-	/*16-17*/	UW	output_analog_4; //!< Analog output 4.
-	/*18-19*/	UW	output_analog_5; //!< Analog output 5.
-	/*20-21*/	UW	output_analog_6; //!< Analog output 6.
-	/*22-23*/	UW	output_analog_7; //!< Analog output 7.
-
-	/*24-25*/	UW	input_analog_0; //!< Analog input 0.
-	/*26-27*/	UW	input_analog_1; //!< Analog input 1.
-	/*28-29*/	UW	input_analog_2; //!< Analog input 2.
-	/*30-31*/	UW	input_analog_3; //!< Analog input 3.
-	/*32-33*/	UW	input_analog_4; //!< Analog input 4.
-	/*34-35*/	UW	input_analog_5; //!< Analog input 5.
-	/*36-37*/	UW	input_analog_6; //!< Analog input 6.
-	/*38-39*/	UW	input_analog_7; //!< Analog input 7.
-
-	/*40-41*/	UW	output_bank_0; //!< Digital outputs 0-15.
-	/*42-43*/	UW	output_bank_1; //!< Digital outputs 16-23.
-
-	/*44-45*/	UW	input_bank_0; //!< Digital inputs 0-15.
-	/*46-47*/	UW	input_bank_1; //!< Digital inputs 16-23.
-
-	/*48-51*/	UL	pulse_count_0; //!< Pulse counter (see PC)8.
-	/*52-55*/	SL	zc_variable; //!< ZC User-defined variable (see ZC). 
-	/*56-59*/	SL	zd_variable; //!< ZD User-defined variable (see ZD).
-
-	/*60-61*/	UW output_bank_2; //!< Digital outputs 24-39. Data only valid for parts with 24EXOUT.
-	/*62-63*/	UW output_back_3; //!< Digital outputs 40-47. Data only valid for parts with 24EXOUT.
-
-	/*64-65*/	UW input_bank_2; //!< Digital inputs 24-39. Data only valid for parts with 24EXIN.
-	/*66-67*/	UW input_bank_3; //!< Digital inputs 40-47. Data only valid for parts with 24EXIN.
-
-}; //GDataRecord47300_24EX
-
+struct GDataRecord47300_24EX {
+    /*Offset   type name        description*/
+
+    /*00*/ UB header_0;  //!< 1st Byte of Header.
+    /*01*/ UB header_1;  //!< 2nd Byte of Header.
+    /*02*/ UB header_2;  //!< 3rd Byte of Header.
+    /*03*/ UB header_3;  //!< 4th Byte of Header.
+
+    /*04-05*/ UW sample_number;  //!< Sample number.
+    /*06*/ UB error_code;        //!< Error code.
+    /*07*/ UB general_status;    //!< General status.
+
+    /*08-09*/ UW output_analog_0;  //!< Analog output 0.
+    /*10-11*/ UW output_analog_1;  //!< Analog output 1.
+    /*12-13*/ UW output_analog_2;  //!< Analog output 2.
+    /*14-15*/ UW output_analog_3;  //!< Analog output 3.
+    /*16-17*/ UW output_analog_4;  //!< Analog output 4.
+    /*18-19*/ UW output_analog_5;  //!< Analog output 5.
+    /*20-21*/ UW output_analog_6;  //!< Analog output 6.
+    /*22-23*/ UW output_analog_7;  //!< Analog output 7.
+
+    /*24-25*/ UW input_analog_0;  //!< Analog input 0.
+    /*26-27*/ UW input_analog_1;  //!< Analog input 1.
+    /*28-29*/ UW input_analog_2;  //!< Analog input 2.
+    /*30-31*/ UW input_analog_3;  //!< Analog input 3.
+    /*32-33*/ UW input_analog_4;  //!< Analog input 4.
+    /*34-35*/ UW input_analog_5;  //!< Analog input 5.
+    /*36-37*/ UW input_analog_6;  //!< Analog input 6.
+    /*38-39*/ UW input_analog_7;  //!< Analog input 7.
+
+    /*40-41*/ UW output_bank_0;  //!< Digital outputs 0-15.
+    /*42-43*/ UW output_bank_1;  //!< Digital outputs 16-23.
+
+    /*44-45*/ UW input_bank_0;  //!< Digital inputs 0-15.
+    /*46-47*/ UW input_bank_1;  //!< Digital inputs 16-23.
+
+    /*48-51*/ UL pulse_count_0;  //!< Pulse counter (see PC)8.
+    /*52-55*/ SL zc_variable;    //!< ZC User-defined variable (see ZC).
+    /*56-59*/ SL zd_variable;    //!< ZD User-defined variable (see ZD).
+
+    /*60-61*/ UW output_bank_2;  //!< Digital outputs 24-39. Data only valid for
+                                 //!< parts with 24EXOUT.
+    /*62-63*/ UW output_back_3;  //!< Digital outputs 40-47. Data only valid for
+                                 //!< parts with 24EXOUT.
+
+    /*64-65*/ UW input_bank_2;  //!< Digital inputs 24-39. Data only valid for
+                                //!< parts with 24EXIN.
+    /*66-67*/ UW input_bank_3;  //!< Digital inputs 40-47. Data only valid for
+                                //!< parts with 24EXIN.
+
+};  // GDataRecord47300_24EX
 
 //! Data record union, containing all structs and a generic byte array accessor.
 /*!
-*  Named structs can be used to access typed data by name.
-*  Offsets into the data record can also be used by referencing the member `byte_array`.
-*
-*  \code{.cpp}
-*  //Getting the sample counter for the DMC-4000.
-*  cout << data_record->dmc4000.sample_number << '\n'; //access by 4000 product
-*  cout << * ((unsigned short *) (data_record->byte_array + 4)) << '\n'; //access by pointer arithmetic
-*  \endcode
-*/
-union GDataRecord
-{
-
-	struct GDataRecord4000 dmc4000;//!< The DMC-4000 data record.
-	struct GDataRecord4000 dmc4103; //!< The DMC-4103 data record.
-	struct GDataRecord4000 dmc50000;//!< The DMC-50000 data record.
-
-	struct GDataRecord52000 dmc52000;//!< The DMC-52000 data record.
-
-	struct GDataRecord30000 dmc30000;//!< The DMC-30000 data record.
-
-	struct GDataRecord2103 dmc2103; //!< The DMC-21x3 data record.
-
-	struct GDataRecord1806 dmc1806; //!< The DMC-1806 data record.
-
-	struct GDataRecord1802 dmc1802; //!< The DMC-1802 data record.
-
-	struct GDataRecord47000_ENC rio47000; //!< The RIO-471xx & 472xx data record, including encoder support.
-	struct GDataRecord47300_ENC rio47300; //!< The RIO 473xx data record, including encoder support.
-	struct GDataRecord47300_24EX rio47300_24ex; //!< The RIO 473xx data record, with 24EXOUT/24EXIN support.
-
-	unsigned char byte_array[GALILDATARECORDMAXLENGTH]; //!< Generic byte array for offsets.
+ *  Named structs can be used to access typed data by name.
+ *  Offsets into the data record can also be used by referencing the member
+ * `byte_array`.
+ *
+ *  \code{.cpp}
+ *  //Getting the sample counter for the DMC-4000.
+ *  cout << data_record->dmc4000.sample_number << '\n'; //access by 4000 product
+ *  cout << * ((unsigned short *) (data_record->byte_array + 4)) << '\n';
+ * //access by pointer arithmetic \endcode
+ */
+union GDataRecord {
+    struct GDataRecord4000 dmc4000;   //!< The DMC-4000 data record.
+    struct GDataRecord4000 dmc4103;   //!< The DMC-4103 data record.
+    struct GDataRecord4000 dmc50000;  //!< The DMC-50000 data record.
+
+    struct GDataRecord52000 dmc52000;  //!< The DMC-52000 data record.
+
+    struct GDataRecord30000 dmc30000;  //!< The DMC-30000 data record.
+
+    struct GDataRecord2103 dmc2103;  //!< The DMC-21x3 data record.
+
+    struct GDataRecord1806 dmc1806;  //!< The DMC-1806 data record.
+
+    struct GDataRecord1802 dmc1802;  //!< The DMC-1802 data record.
+
+    struct GDataRecord47000_ENC
+        rio47000;  //!< The RIO-471xx & 472xx data record, including encoder
+                   //!< support.
+    struct GDataRecord47300_ENC
+        rio47300;  //!< The RIO 473xx data record, including encoder support.
+    struct GDataRecord47300_24EX
+        rio47300_24ex;  //!< The RIO 473xx data record, with 24EXOUT/24EXIN
+                        //!< support.
+
+    unsigned char byte_array[GALILDATARECORDMAXLENGTH];  //!< Generic byte array
+                                                         //!< for offsets.
 };
 
-
 #ifdef PACKOK
-#pragma pack() //return pack to default
+#pragma pack()  // return pack to default
 #else
 #error "Need to return structure packing for compiler"
 #endif
 
-#endif //I_210405D9_D9EF_484F_8258_BB29A1BBA217
\ No newline at end of file
+#endif  // I_210405D9_D9EF_484F_8258_BB29A1BBA217
\ No newline at end of file
diff --git a/src/libGalil/gclibo.cpp b/src/libGalil/gclibo.cpp
old mode 100755
new mode 100644
index 4d60c8c2..83194f9a
--- a/src/libGalil/gclibo.cpp
+++ b/src/libGalil/gclibo.cpp
@@ -1,413 +1,393 @@
 /*! \file gclibo.c
-*
-* Partial implementation of gclibo.h
-*
-*/
+ *
+ * Partial implementation of gclibo.h
+ *
+ */
 
 #include "gclibo.h"
-#define _CRT_SECURE_NO_WARNINGS //use traditional C calls like strncpy()
-#include <stdlib.h> //atoi, atof
-#include <string.h> //strcpy
-#include <stdio.h> //fopen
-#include <math.h> //log()
-
-
-
-void GCALL GSleep(unsigned int timeout_ms)
-{
-	GUtility(0, G_UTIL_SLEEP, &timeout_ms, 0);
+#define _CRT_SECURE_NO_WARNINGS  // use traditional C calls like strncpy()
+#include <math.h>                //log()
+#include <stdio.h>               //fopen
+#include <stdlib.h>              //atoi, atof
+#include <string.h>              //strcpy
+
+void GCALL GSleep(unsigned int timeout_ms) {
+    GUtility(0, G_UTIL_SLEEP, &timeout_ms, 0);
 }
 
-GReturn GCALL GVersion(GCStringOut ver, GSize ver_len)
-{
-	int str_len;
-	GReturn rc;
-	if ((rc = GUtility(0, G_UTIL_VERSION, ver, &ver_len)) != G_NO_ERROR)
-		return rc;
+GReturn GCALL GVersion(GCStringOut ver, GSize ver_len) {
+    int str_len;
+    GReturn rc;
+    if ((rc = GUtility(0, G_UTIL_VERSION, ver, &ver_len)) != G_NO_ERROR)
+        return rc;
 
 #ifdef G_USE_GCAPS
-	str_len = strlen(ver) + 1;
-	ver_len -= str_len;
-	if (ver_len > 0 
-		&& GUtility(0, G_UTIL_GCAPS_VERSION, ver + str_len, &ver_len) == G_NO_ERROR)
-	{
-		ver[str_len - 1] = ' '; //add a delimiter
-	}
-#endif 
-
-	return rc;
+    str_len = strlen(ver) + 1;
+    ver_len -= str_len;
+    if (ver_len > 0 && GUtility(0, G_UTIL_GCAPS_VERSION, ver + str_len,
+                                &ver_len) == G_NO_ERROR) {
+        ver[str_len - 1] = ' ';  // add a delimiter
+    }
+#endif
+
+    return rc;
 }
 
-GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
-{
-	return GUtility(g, G_UTIL_INFO, info, &info_len);
+GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len) {
+    return GUtility(g, G_UTIL_INFO, info, &info_len);
 }
 
-GReturn GCALL GAddresses(GCStringOut addresses, GSize addresses_len)
-{
+GReturn GCALL GAddresses(GCStringOut addresses, GSize addresses_len) {
 #ifdef G_USE_GCAPS
-	GReturn rc;
-	if (G_NO_ERROR == (rc = GUtility(0, G_UTIL_GCAPS_ADDRESSES, addresses, &addresses_len)))
-		return rc;		
+    GReturn rc;
+    if (G_NO_ERROR ==
+        (rc = GUtility(0, G_UTIL_GCAPS_ADDRESSES, addresses, &addresses_len)))
+        return rc;
 #endif
 
-	return GUtility(0, G_UTIL_ADDRESSES, addresses, &addresses_len);		
+    return GUtility(0, G_UTIL_ADDRESSES, addresses, &addresses_len);
 }
 
-GReturn GCALL GTimeout(GCon g, short timeout_ms)
-{
-	return GUtility(g, G_UTIL_TIMEOUT_OVERRIDE, &timeout_ms, 0);
+GReturn GCALL GTimeout(GCon g, short timeout_ms) {
+    return GUtility(g, G_UTIL_TIMEOUT_OVERRIDE, &timeout_ms, 0);
 }
 
-GReturn GCALL GAssign(char* ip, char* mac)
-{
-	/*
-	*  On Linux and Apple, the IP address is pinged prior to assigning.
-	*  On Windows, pinging first can make the arp table stale, and the
-	*  IP address unreachable for several seconds. We skip ping so that
-	*  we can immediately connect.
-	*/
+GReturn GCALL GAssign(char* ip, char* mac) {
+    /*
+     *  On Linux and Apple, the IP address is pinged prior to assigning.
+     *  On Windows, pinging first can make the arp table stale, and the
+     *  IP address unreachable for several seconds. We skip ping so that
+     *  we can immediately connect.
+     */
 
-	GReturn rc;
-	int reply = 0; //ping reply is nonzero
+    GReturn rc;
+    int reply = 0;  // ping reply is nonzero
 
 #ifdef G_USE_GCAPS
 
 #if defined(__linux__) || defined(__APPLE__)
-	GUtility(0, G_UTIL_GCAPS_PING, ip, &reply); //ping to see if IP address is already taken
-	if (reply)
-		return G_GCLIB_UTILITY_IP_TAKEN;
+    GUtility(0, G_UTIL_GCAPS_PING, ip,
+             &reply);  // ping to see if IP address is already taken
+    if (reply) return G_GCLIB_UTILITY_IP_TAKEN;
 #endif
 
-	if (G_NO_ERROR == (rc = GUtility(0, G_UTIL_GCAPS_ASSIGN, ip, mac)))
-		return rc;
+    if (G_NO_ERROR == (rc = GUtility(0, G_UTIL_GCAPS_ASSIGN, ip, mac)))
+        return rc;
 #endif
 
 #if defined(__linux__) || defined(__APPLE__)
-	GUtility(0, G_UTIL_PING, ip, &reply);  //ping to see if IP address is already taken
-	if (reply)
-		return G_GCLIB_UTILITY_IP_TAKEN;
+    GUtility(0, G_UTIL_PING, ip,
+             &reply);  // ping to see if IP address is already taken
+    if (reply) return G_GCLIB_UTILITY_IP_TAKEN;
 #endif
-	
-	return GUtility(0, G_UTIL_ASSIGN, ip, mac);
+
+    return GUtility(0, G_UTIL_ASSIGN, ip, mac);
 }
 
-GReturn GCALL GIpRequests(GCStringOut requests, GSize requests_len)
-{
+GReturn GCALL GIpRequests(GCStringOut requests, GSize requests_len) {
 #ifdef G_USE_GCAPS
-	GReturn rc;
-	if (G_NO_ERROR == (rc = GUtility(0, G_UTIL_GCAPS_IPREQUEST, requests, &requests_len)))
-		return rc;
+    GReturn rc;
+    if (G_NO_ERROR ==
+        (rc = GUtility(0, G_UTIL_GCAPS_IPREQUEST, requests, &requests_len)))
+        return rc;
 #endif
-	
-	return GUtility(0, G_UTIL_IPREQUEST, requests, &requests_len);
-}
 
-GReturn GCALL GCmd(GCon g, GCStringIn command)
-{
-	char buf[G_SMALL_BUFFER]; //response usually brief, e.g. :
-	return GCommand(g, command, buf, G_SMALL_BUFFER, 0);
+    return GUtility(0, G_UTIL_IPREQUEST, requests, &requests_len);
 }
 
-GReturn GCALL GCmdT(GCon g, GCStringIn command, GCStringOut trimmed_response, GSize response_len, GCStringOut* front)
-{
-	GSize read;
-	GReturn rc;
-	int i;
-	char c;
-	if ((rc = GCommand(g, command, trimmed_response, response_len, &read)) != G_NO_ERROR)
-		return rc;
-	//if here, the data is already null-terminated, just trim.
-	for (i = read - 1; i >= 0; i--) //read does NOT include null terminator.
-	{
-		c = trimmed_response[i];
-		if ((c == ':') || (c == '\n') || (c == '\r'))
-			trimmed_response[i] = 0; //trim it
-		else
-			break; //we hit non-trimmable data, bail out.
-	}
-
-	if (front) //null to skip "trim" on front.
-	{
-		*front = trimmed_response;
-		i = 0;
-		do
-		{
-			c = trimmed_response[i++];
-			if (c == ' ')
-				(*front)++;
-			else
-				break;
-		} while (1); //exit will be any non-space, including null terminator
-	}
-
-	return G_NO_ERROR;
+GReturn GCALL GCmd(GCon g, GCStringIn command) {
+    char buf[G_SMALL_BUFFER];  // response usually brief, e.g. :
+    return GCommand(g, command, buf, G_SMALL_BUFFER, 0);
 }
 
-GReturn GCALL GCmdI(GCon g, GCStringIn command, int* value)
-{
-	char buf[G_SMALL_BUFFER]; //response should be ~19 chars
-	GSize read;
-	GReturn rc;
-	if ((rc = GCommand(g, command, buf, G_SMALL_BUFFER, &read)) != G_NO_ERROR)
-		return rc;
-	*value = atoi(buf);
-	return G_NO_ERROR;
+GReturn GCALL GCmdT(GCon g, GCStringIn command, GCStringOut trimmed_response,
+                    GSize response_len, GCStringOut* front) {
+    GSize read;
+    GReturn rc;
+    int i;
+    char c;
+    if ((rc = GCommand(g, command, trimmed_response, response_len, &read)) !=
+        G_NO_ERROR)
+        return rc;
+    // if here, the data is already null-terminated, just trim.
+    for (i = read - 1; i >= 0; i--)  // read does NOT include null terminator.
+    {
+        c = trimmed_response[i];
+        if ((c == ':') || (c == '\n') || (c == '\r'))
+            trimmed_response[i] = 0;  // trim it
+        else
+            break;  // we hit non-trimmable data, bail out.
+    }
+
+    if (front)  // null to skip "trim" on front.
+    {
+        *front = trimmed_response;
+        i = 0;
+        do {
+            c = trimmed_response[i++];
+            if (c == ' ')
+                (*front)++;
+            else
+                break;
+        } while (1);  // exit will be any non-space, including null terminator
+    }
+
+    return G_NO_ERROR;
 }
 
-GReturn GCALL GCmdD(GCon g, GCStringIn command, double* value)
-{
-	char buf[G_SMALL_BUFFER]; //response should be ~19 chars
-	GSize read;
-	GReturn rc;
-	if ((rc = GCommand(g, command, buf, G_SMALL_BUFFER, &read)) != G_NO_ERROR)
-		return rc;
-	*value = atof(buf);
-	return G_NO_ERROR;
+GReturn GCALL GCmdI(GCon g, GCStringIn command, int* value) {
+    char buf[G_SMALL_BUFFER];  // response should be ~19 chars
+    GSize read;
+    GReturn rc;
+    if ((rc = GCommand(g, command, buf, G_SMALL_BUFFER, &read)) != G_NO_ERROR)
+        return rc;
+    *value = atoi(buf);
+    return G_NO_ERROR;
 }
 
-GReturn GCALL GMotionComplete(GCon g, GCStringIn axes)
-{
-
-	char buf[G_SMALL_BUFFER]; //response should be ~19 chars.
-	char cmd[] = "MG_BGm"; //command for polling the axis' motion status, m is a place holder replaced below.
-	GSize read;
-	GReturn rc;
-	GSize i = 0; //C, not C++
-	GSize len = strlen(axes);
-
-	for (i = 0; i < len; i++) //iterate through all chars in axes
-	{
-		cmd[5] = axes[i]; //set the axis
-	poll:
-		if ((rc = GCommand(g, cmd, buf, G_SMALL_BUFFER, &read)) != G_NO_ERROR)
-			return rc;
-		if (atoi(buf))
-		{
-			GSleep(POLLINGINTERVAL);
-			goto poll;
-		}
-	}// for
-
-	return G_NO_ERROR;
+GReturn GCALL GCmdD(GCon g, GCStringIn command, double* value) {
+    char buf[G_SMALL_BUFFER];  // response should be ~19 chars
+    GSize read;
+    GReturn rc;
+    if ((rc = GCommand(g, command, buf, G_SMALL_BUFFER, &read)) != G_NO_ERROR)
+        return rc;
+    *value = atof(buf);
+    return G_NO_ERROR;
 }
 
-GReturn GCALL GRecordRate(GCon g, double period_ms)
-{
-	char buf[G_SMALL_BUFFER];
-	double dt;
-	double period_arg;
-
-	if (period_ms == 0) //turn off
-		return GCmd(g, "DR 0");
-
-	if (GCmdD(g, "TM?", &dt) == G_NO_ERROR)
-	{
-		dt /= 1024.0; //ms per controller sample
-		if (!dt) dt = 1; //don't want to divide by zero below
-	}
-	else
-	{
-		dt = 0.9765625; //RIO doesn't have TM
-	}
-
-	period_arg = period_ms / dt; //data record specified in samples between records
-
-	if (GCmdT(g, "\x12\x16", buf, sizeof(buf), 0) == G_NO_ERROR) //Revision string, ^R^V
-	{
-		if (strstr(buf, "DMC18")) //PCI controller
-			period_arg = log(period_arg) / log(2.0); //PCI DR arg is 2^n.
-		else if ((strstr(buf, "DMC40") != NULL) //4000
-			|| (strstr(buf, "DMC500") != NULL) //50000
-			|| (strstr(buf, "RIO") != NULL)) // RIO
-		{
-			if (period_arg < 2) period_arg = 2; //lowest non-zero DR
-		}
-		else if ((strstr(buf, "DMC41") != NULL) || (strstr(buf, "DMC21") != NULL)) //4103, 2103
-		{
-			if (period_arg < 8) period_arg = 8; //lowest non-zero DR
-		}
-		else if ((strstr(buf, "DMC3") != NULL)) //30010, 31010
-		{
-			if (period_arg < 4) period_arg = 4; //lowest non-zero DR
-		}
-	}
-	
-	sprintf(buf, "DR %d", (int)period_arg);
-	return GCmd(g, buf);
+GReturn GCALL GMotionComplete(GCon g, GCStringIn axes) {
+    char buf[G_SMALL_BUFFER];  // response should be ~19 chars.
+    char cmd[] = "MG_BGm";  // command for polling the axis' motion status, m is
+                            // a place holder replaced below.
+    GSize read;
+    GReturn rc;
+    GSize i = 0;  // C, not C++
+    GSize len = strlen(axes);
+
+    for (i = 0; i < len; i++)  // iterate through all chars in axes
+    {
+        cmd[5] = axes[i];  // set the axis
+    poll:
+        if ((rc = GCommand(g, cmd, buf, G_SMALL_BUFFER, &read)) != G_NO_ERROR)
+            return rc;
+        if (atoi(buf)) {
+            GSleep(POLLINGINTERVAL);
+            goto poll;
+        }
+    }  // for
+
+    return G_NO_ERROR;
 }
 
-GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path, GCStringIn preprocessor)
-{
-	FILE *file;
-	long file_size;
-	char* program_buffer;
-	GReturn rc = G_NO_ERROR;
-
-	if (!(file = fopen(file_path, "rb"))) //open file for reading, binary mode
-		return G_BAD_FILE;
-
-	fseek(file, 0, SEEK_END); //find end of file
-	file_size = ftell(file); //add one to null terminate below
-	rewind(file);
-
-	if (file_size) //don't malloc 0.
-	{
-
-		if (!(program_buffer = (char*) malloc(file_size + 1))) //allocate memory for the data, +1 for null termination below
-		{
-			fclose(file);
-			return G_BAD_FULL_MEMORY;
-		}
-
-		if (file_size != fread(program_buffer, 1, file_size, file))
-		{
-			fclose(file);
-			free(program_buffer); //free memory
-			return G_BAD_FILE;
-		}
-		program_buffer[file_size] = 0; //null terminate, malloc was one byte larger for this
-	}
-	else
-	{
-		program_buffer = (char*) ""; //nullstring
-	}
-
-	fclose(file); //done with file, close it
-
-	rc = GProgramDownload(g, program_buffer, preprocessor); //call the gclib downloader
-	if (file_size) free(program_buffer); //free memory
-	return rc;
+GReturn GCALL GRecordRate(GCon g, double period_ms) {
+    char buf[G_SMALL_BUFFER];
+    double dt;
+    double period_arg;
+
+    if (period_ms == 0)  // turn off
+        return GCmd(g, "DR 0");
+
+    if (GCmdD(g, "TM?", &dt) == G_NO_ERROR) {
+        dt /= 1024.0;     // ms per controller sample
+        if (!dt) dt = 1;  // don't want to divide by zero below
+    } else {
+        dt = 0.9765625;  // RIO doesn't have TM
+    }
+
+    period_arg =
+        period_ms / dt;  // data record specified in samples between records
+
+    if (GCmdT(g, "\x12\x16", buf, sizeof(buf), 0) ==
+        G_NO_ERROR)  // Revision string, ^R^V
+    {
+        if (strstr(buf, "DMC18"))                     // PCI controller
+            period_arg = log(period_arg) / log(2.0);  // PCI DR arg is 2^n.
+        else if ((strstr(buf, "DMC40") != NULL)       // 4000
+                 || (strstr(buf, "DMC500") != NULL)   // 50000
+                 || (strstr(buf, "RIO") != NULL))     // RIO
+        {
+            if (period_arg < 2) period_arg = 2;  // lowest non-zero DR
+        } else if ((strstr(buf, "DMC41") != NULL) ||
+                   (strstr(buf, "DMC21") != NULL))  // 4103, 2103
+        {
+            if (period_arg < 8) period_arg = 8;    // lowest non-zero DR
+        } else if ((strstr(buf, "DMC3") != NULL))  // 30010, 31010
+        {
+            if (period_arg < 4) period_arg = 4;  // lowest non-zero DR
+        }
+    }
+
+    sprintf(buf, "DR %d", (int)period_arg);
+    return GCmd(g, buf);
 }
 
-GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path)
-{
-	FILE *file;
-	GReturn rc = G_NO_ERROR;
-	char* program_buffer;
-	long file_size;
-
-	if (!(file = fopen(file_path, "wb"))) //open file for writing, binary mode
-		return G_BAD_FILE;
-
-	if (!(program_buffer = (char* )malloc(MAXPROG))) //allocate memory for the data
-	{
-		fclose(file);
-		return G_BAD_FULL_MEMORY;
-	}
-
-	if ((rc = GProgramUpload(g, program_buffer, MAXPROG)) == G_NO_ERROR)
-	{
-		file_size = strlen(program_buffer);
-		if (file_size != fwrite(program_buffer, 1, file_size, file))
-			rc = G_BAD_FILE;
-	}
-
-	fclose(file);
-	free(program_buffer);
-	return rc;
+GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path,
+                                   GCStringIn preprocessor) {
+    FILE* file;
+    long file_size;
+    char* program_buffer;
+    GReturn rc = G_NO_ERROR;
+
+    if (!(file = fopen(file_path, "rb")))  // open file for reading, binary mode
+        return G_BAD_FILE;
+
+    fseek(file, 0, SEEK_END);  // find end of file
+    file_size = ftell(file);   // add one to null terminate below
+    rewind(file);
+
+    if (file_size)  // don't malloc 0.
+    {
+        if (!(program_buffer = (char*)malloc(
+                  file_size + 1)))  // allocate memory for the data, +1 for null
+                                    // termination below
+        {
+            fclose(file);
+            return G_BAD_FULL_MEMORY;
+        }
+
+        if (file_size != fread(program_buffer, 1, file_size, file)) {
+            fclose(file);
+            free(program_buffer);  // free memory
+            return G_BAD_FILE;
+        }
+        program_buffer[file_size] =
+            0;  // null terminate, malloc was one byte larger for this
+    } else {
+        program_buffer = (char*)"";  // nullstring
+    }
+
+    fclose(file);  // done with file, close it
+
+    rc = GProgramDownload(g, program_buffer,
+                          preprocessor);  // call the gclib downloader
+    if (file_size) free(program_buffer);  // free memory
+    return rc;
 }
 
+GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path) {
+    FILE* file;
+    GReturn rc = G_NO_ERROR;
+    char* program_buffer;
+    long file_size;
+
+    if (!(file = fopen(file_path, "wb")))  // open file for writing, binary mode
+        return G_BAD_FILE;
+
+    if (!(program_buffer =
+              (char*)malloc(MAXPROG)))  // allocate memory for the data
+    {
+        fclose(file);
+        return G_BAD_FULL_MEMORY;
+    }
+
+    if ((rc = GProgramUpload(g, program_buffer, MAXPROG)) == G_NO_ERROR) {
+        file_size = strlen(program_buffer);
+        if (file_size != fwrite(program_buffer, 1, file_size, file))
+            rc = G_BAD_FILE;
+    }
+
+    fclose(file);
+    free(program_buffer);
+    return rc;
+}
 
-void GCALL GError(GReturn rc, GCStringOut error, GSize error_len)
-{
-	char const * error_message;
+void GCALL GError(GReturn rc, GCStringOut error, GSize error_len) {
+    char const* error_message;
 
-	switch (rc)
-	{
-	case G_NO_ERROR:
-		error_message = G_NO_ERROR_S;
-		break;
+    switch (rc) {
+        case G_NO_ERROR:
+            error_message = G_NO_ERROR_S;
+            break;
 
-	case G_GCLIB_ERROR:
-		error_message = G_GCLIB_ERROR_S;
-		break;
+        case G_GCLIB_ERROR:
+            error_message = G_GCLIB_ERROR_S;
+            break;
 
-	case G_GCLIB_UTILITY_ERROR:
-		error_message = G_GCLIB_UTILITY_ERROR_S;
-		break;
+        case G_GCLIB_UTILITY_ERROR:
+            error_message = G_GCLIB_UTILITY_ERROR_S;
+            break;
 
-	case G_GCLIB_UTILITY_IP_TAKEN:
-		error_message = G_GCLIB_UTILITY_IP_TAKEN_S;
-		break;
+        case G_GCLIB_UTILITY_IP_TAKEN:
+            error_message = G_GCLIB_UTILITY_IP_TAKEN_S;
+            break;
 
-	case G_GCLIB_NON_BLOCKING_READ_EMPTY:
-		error_message = G_GCLIB_NON_BLOCKING_READ_EMPTY_S;
-		break;
+        case G_GCLIB_NON_BLOCKING_READ_EMPTY:
+            error_message = G_GCLIB_NON_BLOCKING_READ_EMPTY_S;
+            break;
 
-	case G_TIMEOUT:
-		error_message = G_TIMEOUT_S;
-		break;
+        case G_TIMEOUT:
+            error_message = G_TIMEOUT_S;
+            break;
 
-	case G_OPEN_ERROR:
-		error_message = G_OPEN_ERROR_S;
-		break;
+        case G_OPEN_ERROR:
+            error_message = G_OPEN_ERROR_S;
+            break;
 
-	case G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND:
-		error_message = G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND_S;
-		break;
+        case G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND:
+            error_message = G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND_S;
+            break;
 
-	case G_DATA_RECORD_ERROR:
-		error_message = G_DATA_RECORD_ERROR_S;
-		break;
+        case G_DATA_RECORD_ERROR:
+            error_message = G_DATA_RECORD_ERROR_S;
+            break;
 
-	case G_UNSUPPORTED_FUNCTION:
-		error_message = G_UNSUPPORTED_FUNCTION_S;
-		break;
+        case G_UNSUPPORTED_FUNCTION:
+            error_message = G_UNSUPPORTED_FUNCTION_S;
+            break;
 
-	case G_BAD_ADDRESS:
-		error_message = G_BAD_ADDRESS_S;
-		break;
+        case G_BAD_ADDRESS:
+            error_message = G_BAD_ADDRESS_S;
+            break;
 
-	case G_FIRMWARE_LOAD_NOT_SUPPORTED:
-		error_message = G_FIRMWARE_LOAD_NOT_SUPPORTED_S;
-		break;
+        case G_FIRMWARE_LOAD_NOT_SUPPORTED:
+            error_message = G_FIRMWARE_LOAD_NOT_SUPPORTED_S;
+            break;
 
-	case G_ARRAY_NOT_DIMENSIONED:
-		error_message = G_ARRAY_NOT_DIMENSIONED_S;
-		break;
+        case G_ARRAY_NOT_DIMENSIONED:
+            error_message = G_ARRAY_NOT_DIMENSIONED_S;
+            break;
 
-	case G_ILLEGAL_DATA_IN_PROGRAM:
-		error_message = G_ILLEGAL_DATA_IN_PROGRAM_S;
-		break;
+        case G_ILLEGAL_DATA_IN_PROGRAM:
+            error_message = G_ILLEGAL_DATA_IN_PROGRAM_S;
+            break;
 
-	case G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT:
-		error_message = G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT_S;
-		break;
+        case G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT:
+            error_message = G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT_S;
+            break;
 
-	case G_INVALID_PREPROCESSOR_OPTIONS:
-		error_message = G_INVALID_PREPROCESSOR_OPTIONS_S;
-		break;
+        case G_INVALID_PREPROCESSOR_OPTIONS:
+            error_message = G_INVALID_PREPROCESSOR_OPTIONS_S;
+            break;
 
-	case G_BAD_RESPONSE_QUESTION_MARK:
-		error_message = G_BAD_RESPONSE_QUESTION_MARK_S;
-		break;
+        case G_BAD_RESPONSE_QUESTION_MARK:
+            error_message = G_BAD_RESPONSE_QUESTION_MARK_S;
+            break;
 
-	case G_BAD_VALUE_RANGE:
-		error_message = G_BAD_VALUE_RANGE_S;
-		break;
+        case G_BAD_VALUE_RANGE:
+            error_message = G_BAD_VALUE_RANGE_S;
+            break;
 
-	case G_BAD_FULL_MEMORY:
-		error_message = G_BAD_FULL_MEMORY_S;
-		break;
+        case G_BAD_FULL_MEMORY:
+            error_message = G_BAD_FULL_MEMORY_S;
+            break;
 
-	case G_BAD_LOST_DATA:
-		error_message = G_BAD_LOST_DATA_S;
-		break;
+        case G_BAD_LOST_DATA:
+            error_message = G_BAD_LOST_DATA_S;
+            break;
 
-	case G_BAD_FILE:
-		error_message = G_BAD_FILE_S;
-		break;
+        case G_BAD_FILE:
+            error_message = G_BAD_FILE_S;
+            break;
 
-	case G_GCAPS_OPEN_ERROR:
-		error_message = G_GCAPS_OPEN_ERROR_S;
-		break;
+        case G_GCAPS_OPEN_ERROR:
+            error_message = G_GCAPS_OPEN_ERROR_S;
+            break;
 
-	default:
-		error_message = "internal error";
-		break;
-	}
+        default:
+            error_message = "internal error";
+            break;
+    }
 
-	strncpy(error, error_message, error_len);
-	error[error_len - 1] = 0; //ensure null termination
+    strncpy(error, error_message, error_len);
+    error[error_len - 1] = 0;  // ensure null termination
 }
diff --git a/src/libGalil/gclibo.h b/src/libGalil/gclibo.h
old mode 100755
new mode 100644
index 856b9798..4c2bd0f9
--- a/src/libGalil/gclibo.h
+++ b/src/libGalil/gclibo.h
@@ -1,13 +1,14 @@
 /*! \file gclibo.h
-*
-* Open-source convenience functions for Galil C Lib.
-* Please email softwarefeedback@galil.com with suggestions for useful/missing functions.
-*
-*/
+ *
+ * Open-source convenience functions for Galil C Lib.
+ * Please email softwarefeedback@galil.com with suggestions for useful/missing
+ * functions.
+ *
+ */
 #ifndef I_007AD0AF_C956_4B96_ADE2_AD04FAFFEE99
 #define I_007AD0AF_C956_4B96_ADE2_AD04FAFFEE99
 
-//set library visibility for gcc and msvc
+// set library visibility for gcc and msvc
 #if BUILDING_GCLIB && HAVE_VISIBILITY
 #define GCLIB_DLL_EXPORTED __attribute__((__visibility__("default")))
 #elif BUILDING_GCLIB && defined _MSC_VER
@@ -18,328 +19,395 @@
 #define GCLIB_DLL_EXPORTED
 #endif
 
-#include "gclib.h" //Galil's C Library
+#include "gclib.h"  //Galil's C Library
 
 #ifdef _WIN32
 #define GCALL __stdcall
 #else
-#define GCALL  /* nothing */
+#define GCALL /* nothing */
 #endif
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define MALLOCBUF G_HUGE_BUFFER //!< Malloc used for large program and array uploads.
-#define MAXPROG MALLOCBUF //!< Maximum size for a program.
-#define MAXARRAY MALLOCBUF //!< Maximum size for an array table upload.
-#define POLLINGINTERVAL 1000 //!< Interval, in miliseconds, for polling commands, e.g. GMotionComplete().
-#define G_USE_GCAPS //!< Use the GCAPS server in GAddresses(), GAssign(), GIpRequests(), and GVersion(). To avoid GCAPS, comment out this line and recompile, http://galil.com/sw/pub/all/doc/gclib/html/gclibo.html
-
-	//! Uses GUtility() and @ref G_UTIL_SLEEP to provide a blocking sleep call which can be useful for timing-based chores.
-	GCLIB_DLL_EXPORTED void GCALL GSleep(unsigned int timeout_ms);
-	/*!<
-	*  \param timeout_ms The timeout, in milliseconds, to block before returning.
-	*
-	*  See GMotionComplete() for an example.
-	*/
-
-
-	//! Uses GUtility(), @ref G_UTIL_VERSION and @ref G_UTIL_GCAPS_VERSION to provide the library and @ref gcaps version numbers.
-	GCLIB_DLL_EXPORTED GReturn GCALL GVersion(GCStringOut ver, GSize ver_len);
-	/*!<
-	*  \param ver Buffer to hold the output string. Buffer will be null terminated, even if the data must be truncated to do so.
-	*  \param ver_len Length of buffer.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  The version number of gclib is provided first. If the @ref gcaps server can be found, 
-	*  its version will be provided after a space.
-	*
-	*  Example with gcaps version.
-	*
-	*      154.190.329 1.0.0.82
-	*  
-	*  Example with gclib version only.
-	*  
-	*      154.190.329
-	*  
-	*  \note GVersion() will take up to 1 second to look for @ref gcaps.
-	*
-	*  See x_examples.cpp for an example.
-	*/
-
-	//! Uses GUtility(), @ref G_UTIL_GCAPS_ADDRESSES or @ref G_UTIL_ADDRESSES to provide a listing of all available connection addresses.
-	GCLIB_DLL_EXPORTED GReturn GCALL GAddresses(GCStringOut addresses, GSize addresses_len);
-	/*!<
-	*  \note Serial ports are listed, e.g. COM1. Upon open, it may be necesary to specify a baud rate for the controller, e.g. `--baud 19200`.
-	*        Default baud is 115200. See GOpen().
-	*
-	*  \param addresses Buffer to hold the output string. Buffer will be null terminated, even if the data must be truncated to do so. See below for more information.
-	*  \param addresses_len Length of buffer.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  If @ref gcaps is available, the listing will come from the server via  @ref G_UTIL_GCAPS_ADDRESSES. 
-	*  In the abscence of the server, gclib will use @ref G_UTIL_ADDRESSES to generate the list.
-	*
-	*  * Ethernet controllers will be listed as *ip_address, revision_report, network_adaptor_name, network_adaptor_ip_address*.
-	*  If an IP address is unreachable via ping, the address will be in parentheses.
-	*  * PCI controllers will be listed by their identifier, e.g. GALILPCI1.
-	*  * Serial ports will be listed by their identifier, e.g. COM1.
-	*
-	*
-	*      10.1.3.91, DMC4020 Rev 1.2e, LAN, 10.1.3.10
-	*      192.168.0.63, DMC4040 Rev 1.2f, Static, 192.168.0.41
-	*      (192.0.0.42), RIO47102 Rev 1.1j, Static, 192.168.0.41
-	*      10.1., RIO47102 Rev 1.1j, Static, 192.168.0.41
-	*      GALILPCI1
-	*      COM1
-	*      COM2
-	*
-	*  \note GAddresses() will take up to 1 second to look for @ref gcaps.
-	*
-	*  See x_examples.cpp for an example.
-	*/
-
-	//! Uses GUtility() and @ref G_UTIL_INFO to provide a useful connection string.
-	GCLIB_DLL_EXPORTED GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param info Buffer to hold the output string. Buffer will be null terminated, even if the data must be truncated to do so.
-	*  \param info_len Length of buffer.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  The response is *address, revision_report, serial_number*. For example:
-	*
-	*      COM2, RIO47102 Rev 1.1j, 37290
-	*
-	*  See x_examples.cpp for an example.
-	*/
-
-
-	//! Uses GUtility() and @ref G_UTIL_TIMEOUT_OVERRIDE to set the library timeout.
-	GCLIB_DLL_EXPORTED GReturn GCALL GTimeout(GCon g, short timeout_ms);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param timeout_ms The value to be used for the timeout. Use `G_USE_INITIAL_TIMEOUT` to set the timeout back to the initial GOpen() value, `--timeout`.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_gcommand.cpp and x_gread_gwrite.cpp for examples.
-	*/
-
-
-	//! Wrapper around GCommand for use when the return value is not desired.
-	GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command);
-	/*!<
-	*  The returned data is still checked for error, e.g. `?` or timeout, but is not brought out through the prototype.
-	*
-	*  \param g Connection's handle.
-	*  \param command Null-terminated command string to send to the controller.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_gcommand.cpp for an example.
-	*/
-
-
-	//! Wrapper around GCommand that trims the response.
-	GCLIB_DLL_EXPORTED GReturn GCALL GCmdT(GCon g, GCStringIn command, GCStringOut trimmed_response, GSize response_len, GCStringOut* front);
-	/*!<
-	*  For use when the return value is desired, is ASCII (not binary), and the response should be trimmed of trailing colon, whitespace, and optionally leading space.
-	*
-	*  \param g Connection's handle.
-	*  \param command Null-terminated command string to send to the controller.
-	*  \param trimmed_response The trimmed response from the controller. Trailing space is trimmed by null terminating any trailing spaces, carriage returns, or line feeds.
-	*  \param response_len The length of the trimmed_response buffer.
-	*  \param front If non-null, upon return *front will point to the first non-space character in trimmed_response.
-	*          This allows trimming the front of the string without modifying the user's buffer pointer, which may be allocated on the heap.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_gcommand.cpp for an example.
-	*/
-
-
-	//! Wrapper around GCommand that provides the return value of a command parsed into an int.
-	GCLIB_DLL_EXPORTED GReturn GCALL GCmdI(GCon g, GCStringIn command, int* value);
-	/*!<
-	*  Use this function to get most values including TP, RP, TE, Digital I/O states, etc.
-	*
-	*  \param g Connection's handle.
-	*  \param command Null-terminated command string to send to the controller.
-	*  \param value Pointer to an int that will be filled with the return value.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_gcommand.cpp for an example.
-	*/
-
-
-	//! Wrapper around GCommand that provides the return value of a command parsed into a double.
-	GCLIB_DLL_EXPORTED GReturn GCALL GCmdD(GCon g, GCStringIn command, double* value);
-	/*!<
-	*  Use this function to retrieve the full Galil 4.2 range, e.g. for a variable value with fractional data,
-	*  or the value of an Analog input or Output.
-	*
-	*  \param g Connection's handle.
-	*  \param command Null-terminated command string to send to the controller.
-	*  \param value Pointer to a double that will be filled with the return value.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_gcommand.cpp for an example.
-	*/
-
-
-	//! Blocking call that returns once all axes specified have completed their motion.
-	GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete(GCon g, GCStringIn axes);
-	/*!<
-	*  \note This function uses a profiled motion indicator, not the position of the encoder. E.G. see the difference between AM (profiled) and MC (encoder-based).
-	*
-	*  Although using the _BGm operand is the most generally compatible method,
-	*  there are higher-performance ways to check for motion complete by using
-	*  the data record, or interrupts. See examples x_dr_motioncomplete() and x_ei_motioncomplete().
-	*
-	*  \param g Connection's handle.
-	*  \param axes A null-terminated string containing a multiple-axes mask. Every character in the string should be a valid argument to MG_BGm, i.e. XYZWABCDEFGHST.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_gmotioncomplete.cpp for an example.
-	*/
-
-
-	//! Sets the asynchronous data record to a user-specified period via `DR`.
-	GCLIB_DLL_EXPORTED GReturn GCALL GRecordRate(GCon g, double period_ms);
-	/*!<
-	*  Takes TM and product type into account and sets the `DR` period to the period requested by the user, if possible.
-	*
-	*  \param g Connection's handle.
-	*  \param period_ms Period, in milliseconds, to set up for the asynchronous data record.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_grecord.cpp for an example.
-	*/
-
-
-	//! Program download from file.
-	GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path, GCStringIn preprocessor);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param file_path Null-terminated string containing the path to the program file.
-	*  \param preprocessor Options string for preprocessing the program before sending it to the controller. See GProgramDownload().
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_programs.cpp for an example.
-	*/
-
-
-	//! Program upload to file.
-	GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path);
-	/*!<
-	*  \param g Connection's handle.
-	*  \param file_path Null-terminated string containing the path to the program file, file will be overwritten if it exists.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_programs.cpp for an example.
-	*/
-
-
-	//! Array download from file.
-	GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownloadFile(GCon g, GCStringIn file_path);
-	/*!<
-	*  Downloads a csv file containing array data at `file_path`. If the arrays don't exist, they will be dimensioned.
-	*
-	*  \param g Connection's handle.
-	*  \param file_path Null-terminated string containing the path to the array file.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_arrays.cpp for an example.
-	*/
-
-
-	//! Array upload to file.
-	GCLIB_DLL_EXPORTED GReturn GCALL GArrayUploadFile(GCon g, GCStringIn file_path, GCStringIn names);
-	/*!<
-	*  Uploads the entire controller array table or a subset and saves the data as a csv file specified by `file_path`.
-	*
-	*  \param g Connection's handle.
-	*  \param file_path Null-terminated string containing the path to the array file, file will be overwritten if it exists.
-	*  \param names Null-terminated string containing the arrays to upload, delimited with space. "" or null uploads all arrays listed in LA.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  See x_arrays.cpp for an example.
-	*/
-
-	
-	//! Uses GUtility(), @ref G_UTIL_GCAPS_IPREQUEST or @ref G_UTIL_IPREQUEST to provide a list of all Galil controllers requesting IP addresses via BOOT-P or DHCP.
-	GCLIB_DLL_EXPORTED GReturn GCALL GIpRequests(GCStringOut requests, GSize requests_len);
-	/*!<
-	*  \param requests The buffer to hold the list of requesting controllers. Data will be null terminated, even if the data must be truncated to do so. See below for more information.
-	*  \param requests_len The length of the requests buffer.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values.
-	*
-	*  GIpRequests() will block about 5 seconds while listening for requests.
-	*
-	*  If @ref gcaps is available, the listing will come from the server via  @ref G_UTIL_GCAPS_IPREQUEST.
-	*  In the abscence of the server, gclib will use @ref G_UTIL_IPREQUEST to generate the list.
-	*
-	*  \attention When not using @ref gcaps, Linux/OS X users must be root to use GIpRequests() and have UDP access to bind and listen on port 67.
-	*
-	*  Each line of the returned data will be of the form *model, serial_number, MAC_address, network_adaptor_name, network_adaptor_ip_address*. For example:
-	*
-	*      DMC4000, 291, 00:50:4C:20:01:23, LAN, 10.1.3.10
-	*      RIO47000, 37290, 00:50:4C:28:91:AA, Static, 192.168.0.41
-	*
-	*  \note GIpRequests() will take up to 1 second to look for @ref gcaps.
-	*
-	*  See x_examples.cpp for an example.
-	*/
-
-
-	//! Uses GUtility(), @ref G_UTIL_GCAPS_ASSIGN or @ref G_UTIL_ASSIGN to assign an IP address over the Ethernet to a controller at a given MAC address.
-	GCLIB_DLL_EXPORTED GReturn GCALL GAssign(char* ip, char* mac);
-	/*!< 
-	*  \param ip The null-terminated ip address to assign. The hardware should not yet have an IP address.
-	*  \param mac The null-terminated MAC address of the hardware.
-	*
-	*  \return The success status or error code of the function. See gclib_errors.h for possible values. 
-	*
-	*  
-	*  On Linux and Mac, the desired IP address will be pinged prior to the assigment. If the ping is returned, GAssign() will return @ref G_GCLIB_UTILITY_IP_TAKEN.
-	*
-	*  If @ref gcaps is available, the assign will be performed from the server via  @ref G_UTIL_GCAPS_ASSIGN. 
-	*  In the abscence of the server, gclib will use @ref G_UTIL_ASSIGN to assign.
-	*
-	*  \attention When not using @ref gcaps, Linux/OS X users must be root to use GAssign() and have UDP access to send on port 68.
-	*
-	*  \note GAssign() will take up to 1 second to look for @ref gcaps.
-	*
-	*  See x_examples.cpp for an example.
-	*/
-		
-
-	//! Provides a human-readable description string for return codes.
-	GCLIB_DLL_EXPORTED void GCALL GError(GReturn rc, GCStringOut error, GSize error_len);
-	/*!<
-	*  \param rc The return code to lookup.
-	*  \param error The buffer to fill with the error text. Buffer will be null terminated, even if the data must be truncated to do so.
-	*  \param error_len The length of the error buffer.
-	*
-	*  See x_examples.cpp for an example.
-	*/
+#define MALLOCBUF \
+    G_HUGE_BUFFER  //!< Malloc used for large program and array uploads.
+#define MAXPROG MALLOCBUF  //!< Maximum size for a program.
+#define MAXARRAY MALLOCBUF  //!< Maximum size for an array table upload.
+#define POLLINGINTERVAL \
+    1000  //!< Interval, in miliseconds, for polling commands, e.g.
+          //!< GMotionComplete().
+#define G_USE_GCAPS  //!< Use the GCAPS server in GAddresses(), GAssign(),
+                     //!< GIpRequests(), and GVersion(). To avoid GCAPS, comment
+                     //!< out this line and recompile,
+                     //!< http://galil.com/sw/pub/all/doc/gclib/html/gclibo.html
+
+//! Uses GUtility() and @ref G_UTIL_SLEEP to provide a blocking sleep call which
+//! can be useful for timing-based chores.
+GCLIB_DLL_EXPORTED void GCALL GSleep(unsigned int timeout_ms);
+/*!<
+ *  \param timeout_ms The timeout, in milliseconds, to block before returning.
+ *
+ *  See GMotionComplete() for an example.
+ */
+
+//! Uses GUtility(), @ref G_UTIL_VERSION and @ref G_UTIL_GCAPS_VERSION to
+//! provide the library and @ref gcaps version numbers.
+GCLIB_DLL_EXPORTED GReturn GCALL GVersion(GCStringOut ver, GSize ver_len);
+/*!<
+ *  \param ver Buffer to hold the output string. Buffer will be null terminated,
+ * even if the data must be truncated to do so. \param ver_len Length of buffer.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  The version number of gclib is provided first. If the @ref gcaps server can
+ * be found, its version will be provided after a space.
+ *
+ *  Example with gcaps version.
+ *
+ *      154.190.329 1.0.0.82
+ *
+ *  Example with gclib version only.
+ *
+ *      154.190.329
+ *
+ *  \note GVersion() will take up to 1 second to look for @ref gcaps.
+ *
+ *  See x_examples.cpp for an example.
+ */
+
+//! Uses GUtility(), @ref G_UTIL_GCAPS_ADDRESSES or @ref G_UTIL_ADDRESSES to
+//! provide a listing of all available connection addresses.
+GCLIB_DLL_EXPORTED GReturn GCALL GAddresses(GCStringOut addresses,
+                                            GSize addresses_len);
+/*!<
+ *  \note Serial ports are listed, e.g. COM1. Upon open, it may be necesary to
+ * specify a baud rate for the controller, e.g. `--baud 19200`. Default baud is
+ * 115200. See GOpen().
+ *
+ *  \param addresses Buffer to hold the output string. Buffer will be null
+ * terminated, even if the data must be truncated to do so. See below for more
+ * information. \param addresses_len Length of buffer.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  If @ref gcaps is available, the listing will come from the server via  @ref
+ * G_UTIL_GCAPS_ADDRESSES. In the abscence of the server, gclib will use @ref
+ * G_UTIL_ADDRESSES to generate the list.
+ *
+ *  * Ethernet controllers will be listed as *ip_address, revision_report,
+ * network_adaptor_name, network_adaptor_ip_address*. If an IP address is
+ * unreachable via ping, the address will be in parentheses.
+ *  * PCI controllers will be listed by their identifier, e.g. GALILPCI1.
+ *  * Serial ports will be listed by their identifier, e.g. COM1.
+ *
+ *
+ *      10.1.3.91, DMC4020 Rev 1.2e, LAN, 10.1.3.10
+ *      192.168.0.63, DMC4040 Rev 1.2f, Static, 192.168.0.41
+ *      (192.0.0.42), RIO47102 Rev 1.1j, Static, 192.168.0.41
+ *      10.1., RIO47102 Rev 1.1j, Static, 192.168.0.41
+ *      GALILPCI1
+ *      COM1
+ *      COM2
+ *
+ *  \note GAddresses() will take up to 1 second to look for @ref gcaps.
+ *
+ *  See x_examples.cpp for an example.
+ */
+
+//! Uses GUtility() and @ref G_UTIL_INFO to provide a useful connection string.
+GCLIB_DLL_EXPORTED GReturn GCALL GInfo(GCon g, GCStringOut info,
+                                       GSize info_len);
+/*!<
+ *  \param g Connection's handle.
+ *  \param info Buffer to hold the output string. Buffer will be null
+ * terminated, even if the data must be truncated to do so. \param info_len
+ * Length of buffer.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  The response is *address, revision_report, serial_number*. For example:
+ *
+ *      COM2, RIO47102 Rev 1.1j, 37290
+ *
+ *  See x_examples.cpp for an example.
+ */
+
+//! Uses GUtility() and @ref G_UTIL_TIMEOUT_OVERRIDE to set the library timeout.
+GCLIB_DLL_EXPORTED GReturn GCALL GTimeout(GCon g, short timeout_ms);
+/*!<
+ *  \param g Connection's handle.
+ *  \param timeout_ms The value to be used for the timeout. Use
+ * `G_USE_INITIAL_TIMEOUT` to set the timeout back to the initial GOpen() value,
+ * `--timeout`.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_gcommand.cpp and x_gread_gwrite.cpp for examples.
+ */
+
+//! Wrapper around GCommand for use when the return value is not desired.
+GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command);
+/*!<
+ *  The returned data is still checked for error, e.g. `?` or timeout, but is
+ * not brought out through the prototype.
+ *
+ *  \param g Connection's handle.
+ *  \param command Null-terminated command string to send to the controller.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_gcommand.cpp for an example.
+ */
+
+//! Wrapper around GCommand that trims the response.
+GCLIB_DLL_EXPORTED GReturn GCALL GCmdT(GCon g, GCStringIn command,
+                                       GCStringOut trimmed_response,
+                                       GSize response_len, GCStringOut* front);
+/*!<
+ *  For use when the return value is desired, is ASCII (not binary), and the
+ * response should be trimmed of trailing colon, whitespace, and optionally
+ * leading space.
+ *
+ *  \param g Connection's handle.
+ *  \param command Null-terminated command string to send to the controller.
+ *  \param trimmed_response The trimmed response from the controller. Trailing
+ * space is trimmed by null terminating any trailing spaces, carriage returns,
+ * or line feeds. \param response_len The length of the trimmed_response buffer.
+ *  \param front If non-null, upon return *front will point to the first
+ * non-space character in trimmed_response. This allows trimming the front of
+ * the string without modifying the user's buffer pointer, which may be
+ * allocated on the heap.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_gcommand.cpp for an example.
+ */
+
+//! Wrapper around GCommand that provides the return value of a command parsed
+//! into an int.
+GCLIB_DLL_EXPORTED GReturn GCALL GCmdI(GCon g, GCStringIn command, int* value);
+/*!<
+ *  Use this function to get most values including TP, RP, TE, Digital I/O
+ * states, etc.
+ *
+ *  \param g Connection's handle.
+ *  \param command Null-terminated command string to send to the controller.
+ *  \param value Pointer to an int that will be filled with the return value.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_gcommand.cpp for an example.
+ */
+
+//! Wrapper around GCommand that provides the return value of a command parsed
+//! into a double.
+GCLIB_DLL_EXPORTED GReturn GCALL GCmdD(GCon g, GCStringIn command,
+                                       double* value);
+/*!<
+ *  Use this function to retrieve the full Galil 4.2 range, e.g. for a variable
+ * value with fractional data, or the value of an Analog input or Output.
+ *
+ *  \param g Connection's handle.
+ *  \param command Null-terminated command string to send to the controller.
+ *  \param value Pointer to a double that will be filled with the return value.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_gcommand.cpp for an example.
+ */
+
+//! Blocking call that returns once all axes specified have completed their
+//! motion.
+GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete(GCon g, GCStringIn axes);
+/*!<
+ *  \note This function uses a profiled motion indicator, not the position of
+ * the encoder. E.G. see the difference between AM (profiled) and MC
+ * (encoder-based).
+ *
+ *  Although using the _BGm operand is the most generally compatible method,
+ *  there are higher-performance ways to check for motion complete by using
+ *  the data record, or interrupts. See examples x_dr_motioncomplete() and
+ * x_ei_motioncomplete().
+ *
+ *  \param g Connection's handle.
+ *  \param axes A null-terminated string containing a multiple-axes mask. Every
+ * character in the string should be a valid argument to MG_BGm, i.e.
+ * XYZWABCDEFGHST.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_gmotioncomplete.cpp for an example.
+ */
+
+//! Sets the asynchronous data record to a user-specified period via `DR`.
+GCLIB_DLL_EXPORTED GReturn GCALL GRecordRate(GCon g, double period_ms);
+/*!<
+ *  Takes TM and product type into account and sets the `DR` period to the
+ * period requested by the user, if possible.
+ *
+ *  \param g Connection's handle.
+ *  \param period_ms Period, in milliseconds, to set up for the asynchronous
+ * data record.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_grecord.cpp for an example.
+ */
+
+//! Program download from file.
+GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownloadFile(GCon g,
+                                                      GCStringIn file_path,
+                                                      GCStringIn preprocessor);
+/*!<
+ *  \param g Connection's handle.
+ *  \param file_path Null-terminated string containing the path to the program
+ * file. \param preprocessor Options string for preprocessing the program before
+ * sending it to the controller. See GProgramDownload().
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_programs.cpp for an example.
+ */
+
+//! Program upload to file.
+GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile(GCon g,
+                                                    GCStringIn file_path);
+/*!<
+ *  \param g Connection's handle.
+ *  \param file_path Null-terminated string containing the path to the program
+ * file, file will be overwritten if it exists.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_programs.cpp for an example.
+ */
+
+//! Array download from file.
+GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownloadFile(GCon g,
+                                                    GCStringIn file_path);
+/*!<
+ *  Downloads a csv file containing array data at `file_path`. If the arrays
+ * don't exist, they will be dimensioned.
+ *
+ *  \param g Connection's handle.
+ *  \param file_path Null-terminated string containing the path to the array
+ * file.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_arrays.cpp for an example.
+ */
+
+//! Array upload to file.
+GCLIB_DLL_EXPORTED GReturn GCALL GArrayUploadFile(GCon g, GCStringIn file_path,
+                                                  GCStringIn names);
+/*!<
+ *  Uploads the entire controller array table or a subset and saves the data as
+ * a csv file specified by `file_path`.
+ *
+ *  \param g Connection's handle.
+ *  \param file_path Null-terminated string containing the path to the array
+ * file, file will be overwritten if it exists. \param names Null-terminated
+ * string containing the arrays to upload, delimited with space. "" or null
+ * uploads all arrays listed in LA.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  See x_arrays.cpp for an example.
+ */
+
+//! Uses GUtility(), @ref G_UTIL_GCAPS_IPREQUEST or @ref G_UTIL_IPREQUEST to
+//! provide a list of all Galil controllers requesting IP addresses via BOOT-P
+//! or DHCP.
+GCLIB_DLL_EXPORTED GReturn GCALL GIpRequests(GCStringOut requests,
+                                             GSize requests_len);
+/*!<
+ *  \param requests The buffer to hold the list of requesting controllers. Data
+ * will be null terminated, even if the data must be truncated to do so. See
+ * below for more information. \param requests_len The length of the requests
+ * buffer.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *  GIpRequests() will block about 5 seconds while listening for requests.
+ *
+ *  If @ref gcaps is available, the listing will come from the server via  @ref
+ * G_UTIL_GCAPS_IPREQUEST. In the abscence of the server, gclib will use @ref
+ * G_UTIL_IPREQUEST to generate the list.
+ *
+ *  \attention When not using @ref gcaps, Linux/OS X users must be root to use
+ * GIpRequests() and have UDP access to bind and listen on port 67.
+ *
+ *  Each line of the returned data will be of the form *model, serial_number,
+ * MAC_address, network_adaptor_name, network_adaptor_ip_address*. For example:
+ *
+ *      DMC4000, 291, 00:50:4C:20:01:23, LAN, 10.1.3.10
+ *      RIO47000, 37290, 00:50:4C:28:91:AA, Static, 192.168.0.41
+ *
+ *  \note GIpRequests() will take up to 1 second to look for @ref gcaps.
+ *
+ *  See x_examples.cpp for an example.
+ */
+
+//! Uses GUtility(), @ref G_UTIL_GCAPS_ASSIGN or @ref G_UTIL_ASSIGN to assign an
+//! IP address over the Ethernet to a controller at a given MAC address.
+GCLIB_DLL_EXPORTED GReturn GCALL GAssign(char* ip, char* mac);
+/*!<
+ *  \param ip The null-terminated ip address to assign. The hardware should not
+ * yet have an IP address. \param mac The null-terminated MAC address of the
+ * hardware.
+ *
+ *  \return The success status or error code of the function. See gclib_errors.h
+ * for possible values.
+ *
+ *
+ *  On Linux and Mac, the desired IP address will be pinged prior to the
+ * assigment. If the ping is returned, GAssign() will return @ref
+ * G_GCLIB_UTILITY_IP_TAKEN.
+ *
+ *  If @ref gcaps is available, the assign will be performed from the server via
+ * @ref G_UTIL_GCAPS_ASSIGN. In the abscence of the server, gclib will use @ref
+ * G_UTIL_ASSIGN to assign.
+ *
+ *  \attention When not using @ref gcaps, Linux/OS X users must be root to use
+ * GAssign() and have UDP access to send on port 68.
+ *
+ *  \note GAssign() will take up to 1 second to look for @ref gcaps.
+ *
+ *  See x_examples.cpp for an example.
+ */
+
+//! Provides a human-readable description string for return codes.
+GCLIB_DLL_EXPORTED void GCALL GError(GReturn rc, GCStringOut error,
+                                     GSize error_len);
+/*!<
+ *  \param rc The return code to lookup.
+ *  \param error The buffer to fill with the error text. Buffer will be null
+ * terminated, even if the data must be truncated to do so. \param error_len The
+ * length of the error buffer.
+ *
+ *  See x_examples.cpp for an example.
+ */
 
 #ifdef __cplusplus
-} //extern "C"
+}  // extern "C"
 #endif
 
-#endif //I_007AD0AF_C956_4B96_ADE2_AD04FAFFEE99
+#endif  // I_007AD0AF_C956_4B96_ADE2_AD04FAFFEE99
diff --git a/src/libImageRec/OpenCVHelper.cpp b/src/libImageRec/OpenCVHelper.cpp
index ec6201fe..77a7bb55 100644
--- a/src/libImageRec/OpenCVHelper.cpp
+++ b/src/libImageRec/OpenCVHelper.cpp
@@ -1,94 +1,89 @@
 #include "OpenCVHelper.h"
 
+#include <iostream>
+#include <vector>
+
+#include "opencv2/calib3d/calib3d.hpp"  // for findHomography
 #include "opencv2/core/core.hpp"
-#include "opencv2/imgproc/imgproc.hpp"
-#include "opencv2/highgui/highgui.hpp"
 #include "opencv2/features2d/features2d.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/imgproc/imgproc.hpp"
 #include "opencv2/xfeatures2d.hpp"
-
-#include "opencv2/calib3d/calib3d.hpp" // for findHomography
 #include "opencv2/xfeatures2d/nonfree.hpp"
 
-#include <vector>
-#include <iostream>
-
 using namespace cv;
 using namespace cv::xfeatures2d;
 
 using namespace std;
 
-void OpenCVHelper::SIFT_obj_identify(
-		const Mat& img1,
-		const Mat& img2,
-		vector<Point2f>& matchedCorners)
-{
-	bool debug = false;
-	Ptr<SIFT> detector = SIFT::create();
-//	const int minHessian = 400;
-//	Ptr<SURF> detector = SURF::create(minHessian);
-	// Ptr<ORB> detector = ORB::create();
-
-	vector<KeyPoint> kp1, kp2;
-	Mat des1, des2;
-	detector->detectAndCompute(img1, noArray(), kp1, des1);
-	detector->detectAndCompute(img2, noArray(), kp2, des2);
-	if(debug) cout <<"computed features" << endl;
-
-	const int checks = 50;
-	Ptr<flann::SearchParams> searchParams = new flann::SearchParams(checks);
-	Ptr<flann::KDTreeIndexParams> indexParams = new flann::KDTreeIndexParams(5);
-
-	auto flann = FlannBasedMatcher(indexParams, searchParams);
-	if(debug) cout <<"created FLANN Matcher" << endl;
-
-	vector<vector<DMatch> > matches;
-	flann.knnMatch(des1, des2, matches, 2);
-
-	vector<DMatch> good_matches;
-	// perform a ratio test.
-	const float minRatio = 1./1.5;
-
-	for(int i = 0; i < (int)matches.size(); i++) {
-		const DMatch& bestMatch = matches[i][0];
-		const DMatch& betterMatch = matches[i][1];
-		float distanceRatio = bestMatch.distance / betterMatch.distance;
-		if(distanceRatio < minRatio) {
-			good_matches.push_back(bestMatch);
-		}
-	}
-
-	if(debug) cout <<"found good matches" << endl;
-
-	const int min_match_count = 10;
-	if(good_matches.size() > min_match_count) {
-		vector<Point2f> src_pts;
-		vector<Point2f> dst_pts;
-
-		for(int i = 0; i < (int) good_matches.size(); i++) {
-			src_pts.push_back( kp1[ good_matches[i].queryIdx ].pt );
-			dst_pts.push_back( kp2[ good_matches[i].trainIdx ].pt );
-		}
-		if(debug) cout <<"created source and destination points" << endl;
-
-		Mat H = findHomography(src_pts, dst_pts, cv::RANSAC, 5.0);
-
-		//-- Get the corners from the img1 (the object to be "detected")
-		vector<Point2f> obj_corners(4);
-		obj_corners[0] = cvPoint(0, 0);
-		obj_corners[1] = cvPoint(img1.cols, 0);
-		obj_corners[2] = cvPoint(img1.cols, img1.rows);
-		obj_corners[3] = cvPoint(0, img1.rows);
-		// vector<Point2f> scene_corners(4);
-		if(debug) cout << "before the transformation" << endl;
+void OpenCVHelper::SIFT_obj_identify(const Mat& img1, const Mat& img2,
+                                     vector<Point2f>& matchedCorners) {
+    bool debug = false;
+    Ptr<SIFT> detector = SIFT::create();
+    //  const int minHessian = 400;
+    //  Ptr<SURF> detector = SURF::create(minHessian);
+    //  Ptr<ORB> detector = ORB::create();
+
+    vector<KeyPoint> kp1, kp2;
+    Mat des1, des2;
+    detector->detectAndCompute(img1, noArray(), kp1, des1);
+    detector->detectAndCompute(img2, noArray(), kp2, des2);
+    if (debug) cout << "computed features" << endl;
+
+    const int checks = 50;
+    Ptr<flann::SearchParams> searchParams = new flann::SearchParams(checks);
+    Ptr<flann::KDTreeIndexParams> indexParams = new flann::KDTreeIndexParams(5);
+
+    auto flann = FlannBasedMatcher(indexParams, searchParams);
+    if (debug) cout << "created FLANN Matcher" << endl;
+
+    vector<vector<DMatch> > matches;
+    flann.knnMatch(des1, des2, matches, 2);
+
+    vector<DMatch> good_matches;
+    // perform a ratio test.
+    const float minRatio = 1. / 1.5;
+
+    for (int i = 0; i < static_cast<int>(matches.size()); i++) {
+        const DMatch& bestMatch = matches[i][0];
+        const DMatch& betterMatch = matches[i][1];
+        float distanceRatio = bestMatch.distance / betterMatch.distance;
+        if (distanceRatio < minRatio) {
+            good_matches.push_back(bestMatch);
+        }
+    }
+
+    if (debug) cout << "found good matches" << endl;
+
+    const int min_match_count = 10;
+    if (good_matches.size() > min_match_count) {
+        vector<Point2f> src_pts;
+        vector<Point2f> dst_pts;
+
+        for (int i = 0; i < static_cast<int>(good_matches.size()); i++) {
+            src_pts.push_back(kp1[good_matches[i].queryIdx].pt);
+            dst_pts.push_back(kp2[good_matches[i].trainIdx].pt);
+        }
+        if (debug) cout << "created source and destination points" << endl;
+
+        Mat H = findHomography(src_pts, dst_pts, cv::RANSAC, 5.0);
+
+        //-- Get the corners from the img1 (the object to be "detected")
+        vector<Point2f> obj_corners(4);
+        obj_corners[0] = cvPoint(0, 0);
+        obj_corners[1] = cvPoint(img1.cols, 0);
+        obj_corners[2] = cvPoint(img1.cols, img1.rows);
+        obj_corners[3] = cvPoint(0, img1.rows);
+        // vector<Point2f> scene_corners(4);
+        if (debug) cout << "before the transformation" << endl;
 
         try {
             perspectiveTransform(obj_corners, matchedCorners, H);
-        }catch(cv::Exception e){
-            ;
+        } catch (cv::Exception e) {
         }
-	} else {
-		cout <<"Found less than " << min_match_count << " matches" << endl;
-	}
-	if(debug) cout << "Finished" <<endl;
-	return;
+    } else {
+        cout << "Found less than " << min_match_count << " matches" << endl;
+    }
+    if (debug) cout << "Finished" << endl;
+    return;
 }
diff --git a/src/libImageRec/OpenCVHelper.h b/src/libImageRec/OpenCVHelper.h
index ebec802b..7bfc3ece 100644
--- a/src/libImageRec/OpenCVHelper.h
+++ b/src/libImageRec/OpenCVHelper.h
@@ -4,7 +4,8 @@
 #include "opencv2/core/core.hpp"
 
 namespace OpenCVHelper {
-	void SIFT_obj_identify(const cv::Mat& img1, const cv::Mat& img2, std::vector<cv::Point2f>& matchedCorners);
+void SIFT_obj_identify(const cv::Mat& img1, const cv::Mat& img2,
+                       std::vector<cv::Point2f>& matchedCorners);
 };
 
 #endif
diff --git a/src/libLoad/Bk85xx.cpp b/src/libLoad/Bk85xx.cpp
index f8f2bf8a..5eebae09 100644
--- a/src/libLoad/Bk85xx.cpp
+++ b/src/libLoad/Bk85xx.cpp
@@ -1,40 +1,47 @@
 #include "Bk85xx.h"
+
 #include "Logger.h"
 
 Bk85xx::Bk85xx(std::string dev) {
     m_address = 0;
     m_com = new SerialCom(dev);
     if (!m_com->is_open()) {
-        logger(logERROR) << __PRETTY_FUNCTION__ << " -> Could not open com port: " << dev;
+        logger(logERROR) << __PRETTY_FUNCTION__
+                         << " -> Could not open com port: " << dev;
     }
 }
 
-Bk85xx::~Bk85xx() {
-    delete m_com;
-}
+Bk85xx::~Bk85xx() { delete m_com; }
 
 void Bk85xx::send(union u_packet packet) {
-    logger(logDEBUG3) << __PRETTY_FUNCTION__ << " -> Writing packet! " << sizeof(packet);
-    for (unsigned i=0; i<sizeof(packet); i++)
-        logger(logDEBUG4) << std::hex << "0x" << (unsigned)packet.bytes[i] << std::dec;
-    m_com->send((char*)packet.bytes, sizeof(packet.bytes));
+    logger(logDEBUG3) << __PRETTY_FUNCTION__ << " -> Writing packet! "
+                      << sizeof(packet);
+    for (unsigned i = 0; i < sizeof(packet); i++)
+        logger(logDEBUG4) << std::hex << "0x" << (unsigned)packet.bytes[i]
+                          << std::dec;
+    m_com->send(reinterpret_cast<char *>(packet.bytes, sizeof(packet.bytes)));
 }
 
 union u_packet Bk85xx::receive() {
     union u_packet answer;
-    m_com->receive((char*)answer.bytes, sizeof(answer.bytes));
-    logger(logDEBUG3) << __PRETTY_FUNCTION__ << " -> Read packet! " << sizeof(answer);
-    for (unsigned i=0; i<sizeof(answer); i++)
-        logger(logDEBUG4) << std::hex << "0x" << (unsigned)answer.bytes[i] << std::dec;
+    m_com->receive(
+        reinterpret_cast<char *>(answer.bytes, sizeof(answer.bytes)));
+    logger(logDEBUG3) << __PRETTY_FUNCTION__ << " -> Read packet! "
+                      << sizeof(answer);
+    for (unsigned i = 0; i < sizeof(answer); i++)
+        logger(logDEBUG4) << std::hex << "0x" << (unsigned)answer.bytes[i]
+                          << std::dec;
     return answer;
 }
 
 void Bk85xx::checkStatus(struct s_packet packet) {
     if (packet.command != CMD_STATUS) {
-        logger(logERROR) << __PRETTY_FUNCTION__ << " -> Was asked to interpret status, but packet is not a status packet!";
+        logger(logERROR) << __PRETTY_FUNCTION__
+                         << " -> Was asked to interpret status, but packet is "
+                            "not a status packet!";
         throw "Received malformed status!";
     }
-    
+
     std::string msg;
     switch (packet.data[0]) {
         case 0x90:
@@ -56,7 +63,7 @@ void Bk85xx::checkStatus(struct s_packet packet) {
             msg = "Unknown status message";
             break;
     }
-    
+
     if (packet.data[0] != 0x80) {
         logger(logERROR) << __PRETTY_FUNCTION__ << " -> " << msg;
         throw msg;
@@ -71,17 +78,15 @@ union u_packet Bk85xx::genPacket() {
     tmp.var.header = 0xAA;
     tmp.var.address = m_address;
     tmp.var.command = 0x0;
-    for (unsigned int i=0; i<22; i++)
-        tmp.var.data[i] = 0x0;
-    tmp.var.checksum = 0x0; 
+    for (unsigned int i = 0; i < 22; i++) tmp.var.data[i] = 0x0;
+    tmp.var.checksum = 0x0;
     return tmp;
 }
 
 void Bk85xx::setChecksum(union u_packet &packet) {
     unsigned sum = 0;
-    for (unsigned int i=0; i<26; i++)
-        sum += packet.bytes[i];
-    sum = sum%256;
+    for (unsigned int i = 0; i < 26; i++) sum += packet.bytes[i];
+    sum = sum % 256;
     packet.var.checksum = sum;
     logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> " << sum;
 }
@@ -89,11 +94,10 @@ void Bk85xx::setChecksum(union u_packet &packet) {
 struct s_packet Bk85xx::sendCommand(uint8_t cmd, uint8_t data[22]) {
     union u_packet tmp = this->genPacket();
     tmp.var.command = cmd;
-    for (unsigned int i=0; i<22; i++)
-        tmp.var.data[i] = data[i];
+    for (unsigned int i = 0; i < 22; i++) tmp.var.data[i] = data[i];
     this->setChecksum(tmp);
     this->send(tmp);
-    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait)); 
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
     union u_packet response = this->receive();
     return response.var;
 }
@@ -103,7 +107,7 @@ struct s_packet Bk85xx::sendCommand(uint8_t cmd) {
     tmp.var.command = cmd;
     this->setChecksum(tmp);
     this->send(tmp);
-    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait)); 
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
     union u_packet response = this->receive();
     return response.var;
 }
@@ -121,7 +125,7 @@ void Bk85xx::turnOn() {
     data[0] = 1;
     this->checkStatus(this->sendCommand(CMD_ON_OFF, data));
 }
-    
+
 void Bk85xx::turnOff() {
     logger(logDEBUG) << __PRETTY_FUNCTION__;
     uint8_t data[22] = {0};
@@ -159,7 +163,7 @@ void Bk85xx::setModeCR() {
 
 void Bk85xx::setCurrent(double current) {
     logger(logDEBUG) << __PRETTY_FUNCTION__ << " -> " << current;
-    uint32_t cur = current*10; // 0.1mA  = 0x1
+    uint32_t cur = current * 10;  // 0.1mA  = 0x1
     uint8_t data[22] = {0};
     data[0] = (cur & 0xFF);
     data[1] = ((cur >> 8) & 0xFF);
@@ -167,16 +171,16 @@ void Bk85xx::setCurrent(double current) {
     data[3] = ((cur >> 24) & 0xFF);
     this->checkStatus(this->sendCommand(CMD_SET_CC_CURRENT, data));
 }
- 
+
 double Bk85xx::getCurrent() {
     logger(logDEBUG) << __PRETTY_FUNCTION__;
     struct s_packet ans = this->sendCommand(CMD_GET_CC_CURRENT);
-    uint32_t cur = 0; // 0.1mA  = 0x1
+    uint32_t cur = 0;  // 0.1mA  = 0x1
     cur += (ans.data[0] & 0xFF);
     cur += ((ans.data[1] & 0xFF) << 8);
     cur += ((ans.data[2] & 0xFF) << 16);
     cur += ((ans.data[3] & 0xFF) << 24);
-    return cur*0.1;
+    return cur * 0.1;
 }
 
 struct values Bk85xx::getValues() {
@@ -193,13 +197,14 @@ struct values Bk85xx::getValues() {
     val.cur += ((ans.data[5] & 0xFF) << 8);
     val.cur += ((ans.data[6] & 0xFF) << 16);
     val.cur += ((ans.data[7] & 0xFF) << 24);
-    val.cur = val.cur*0.1;
+    val.cur = val.cur * 0.1;
     // 1mW  = 0x1
     val.pow += (ans.data[8] & 0xFF);
     val.pow += ((ans.data[9] & 0xFF) << 8);
     val.pow += ((ans.data[10] & 0xFF) << 16);
     val.pow += ((ans.data[11] & 0xFF) << 24);
-    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> " << val.vol << " " << val.cur << " " << val.pow;
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> " << val.vol << " "
+                      << val.cur << " " << val.pow;
     return val;
 }
 
diff --git a/src/libLoad/Bk85xx.h b/src/libLoad/Bk85xx.h
index 59ff0535..951dc1c1 100644
--- a/src/libLoad/Bk85xx.h
+++ b/src/libLoad/Bk85xx.h
@@ -5,13 +5,15 @@
 // BK85xx Programmable DC load
 // Author: Timon Heim
 // Date: Feb 2017
-// Notes: https://bkpmedia.s3.amazonaws.com/downloads/manuals/en-us/85xx_manual.pdf
+// Notes:
+// https://bkpmedia.s3.amazonaws.com/downloads/manuals/en-us/85xx_manual.pdf
 // ###################
 
+#include <chrono>
 #include <iostream>
 #include <string>
 #include <thread>
-#include <chrono>
+
 #include "SerialCom.h"
 
 #define CMD_STATUS 0x12
@@ -65,40 +67,40 @@ struct values {
 };
 
 class Bk85xx {
-    public:
-        Bk85xx(std::string dev);
-        ~Bk85xx();
+ public:
+    Bk85xx(std::string dev);
+    ~Bk85xx();
+
+    void setRemote();
 
-        void setRemote();
+    void turnOn();
+    void turnOff();
 
-        void turnOn();
-        void turnOff();
+    void setModeCC();
+    void setModeCV();
+    void setModeCW();
+    void setModeCR();
 
-        void setModeCC();
-        void setModeCV();
-        void setModeCW();
-        void setModeCR();
+    void setRemoteSense(bool enableRemoteSense = true);
 
-        void setRemoteSense(bool enableRemoteSense=true);
+    void setCurrent(double current);  // mA
+    double getCurrent();
+    struct values getValues();
 
-        void setCurrent(double current); // mA
-        double getCurrent();
-        struct values getValues();
+ private:
+    SerialCom *m_com;
+    uint8_t m_address;
 
-    private:
-        SerialCom *m_com;
-        uint8_t m_address;
+    void send(union u_packet packet);
+    union u_packet receive();
+    void checkStatus(struct s_packet packet);
 
-        void send(union u_packet packet);
-        union u_packet receive();
-        void checkStatus(struct s_packet packet);
-        
-        union u_packet genPacket();
-        struct s_packet sendCommand(uint8_t cmd, uint8_t data[22]);
-        struct s_packet sendCommand(uint8_t cmd);
-        void setChecksum(union u_packet &packet);
+    union u_packet genPacket();
+    struct s_packet sendCommand(uint8_t cmd, uint8_t data[22]);
+    struct s_packet sendCommand(uint8_t cmd);
+    void setChecksum(union u_packet &packet);
 
-        const std::chrono::milliseconds m_wait{200};
+    const std::chrono::milliseconds m_wait{200};
 };
 
 #endif
diff --git a/src/libLoad/GenericLoad.h b/src/libLoad/GenericLoad.h
index 763c4470..3888ef55 100644
--- a/src/libLoad/GenericLoad.h
+++ b/src/libLoad/GenericLoad.h
@@ -4,13 +4,13 @@
 #include <string>
 
 class GenericLoad {
-    public:
-        virtual void setCurrent(double cur) = 0;
-        virtual std::string getCurrent() = 0;
-        virtual void setVoltage(double volt) = 0;
-        virtual std::string getVoltage() = 0;
-        virtual void turnOn() = 0;
-        virtual void turnOff() = 0;
+ public:
+    virtual void setCurrent(double cur) = 0;
+    virtual std::string getCurrent() = 0;
+    virtual void setVoltage(double volt) = 0;
+    virtual std::string getVoltage() = 0;
+    virtual void turnOn() = 0;
+    virtual void turnOff() = 0;
 };
 
 #endif
diff --git a/src/libLoad/TTILD400P.cpp b/src/libLoad/TTILD400P.cpp
index 65349984..70c86a90 100644
--- a/src/libLoad/TTILD400P.cpp
+++ b/src/libLoad/TTILD400P.cpp
@@ -4,112 +4,95 @@
 
 #include "Logger.h"
 
-
 TTILD400P::TTILD400P(std::string dev, unsigned addr) {
-  m_com = new SerialCom(dev, B115200);
-  m_addr = addr;
-  m_com->send("++auto 0\n\r");
-  m_channel = 0;
+    m_com = new SerialCom(dev, B115200);
+    m_addr = addr;
+    m_com->send("++auto 0\n\r");
+    m_channel = 0;
 }
 
-TTILD400P::~TTILD400P() {
-    delete m_com;
-}
+TTILD400P::~TTILD400P() { delete m_com; }
 
-void TTILD400P::send(std::string cmd){
-  m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
-  cmd += "\r\n";
-  m_com->send(cmd);
-  std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
+void TTILD400P::send(std::string cmd) {
+    m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
+    cmd += "\r\n";
+    m_com->send(cmd);
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
 }
 
-std::string TTILD400P::receive(std::string cmd)
-{
-  m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
-  cmd += "\r\n";
-  m_com->send(cmd);
-  m_com->send("++read eoi\n\r");
-  std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
-  std::string buf=m_com->receive();
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
-  return buf;
+std::string TTILD400P::receive(std::string cmd) {
+    m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
+    cmd += "\r\n";
+    m_com->send(cmd);
+    m_com->send("++read eoi\n\r");
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
+    std::string buf = m_com->receive();
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
+    return buf;
 }
 
 void TTILD400P::init() {
-  // Check if the Load is connected
-  std::string idn=this->receive("*idn?");
-  idn.erase(std::find_if(idn.rbegin(), idn.rend(), [](int ch) {
-	return !std::isspace(ch);
-      }).base(), idn.end());
-  
-  //TBD what the idn is 
-  if(idn.find("THURLBY THANDAR, LD400P, 480850, 1.04-1.05") == std::string::npos)
-    throw "Unknown Load: "+idn;
-  
-  // Prepare everything else
- 
-  this->send("*RST");
-  std::this_thread::sleep_for(std::chrono::seconds(1));
-}
+    // Check if the Load is connected
+    std::string idn = this->receive("*idn?");
+    idn.erase(std::find_if(idn.rbegin(), idn.rend(),
+                           [](int ch) { return !std::isspace(ch); })
+                  .base(),
+              idn.end());
+
+    // TBD what the idn is
+    if (idn.find("THURLBY THANDAR, LD400P, 480850, 1.04-1.05") ==
+        std::string::npos)
+        throw "Unknown Load: " + idn;
 
+    // Prepare everything else
+
+    this->send("*RST");
+    std::this_thread::sleep_for(std::chrono::seconds(1));
+}
 
 void TTILD400P::setVoltage(double volt) {
-  this->send("A "+std::to_string(volt));
-  this->send("LVLSEL A");
+    this->send("A " + std::to_string(volt));
+    this->send("LVLSEL A");
 }
 
 std::string TTILD400P::getVoltage() {
-  std::string result=this->receive("V?");
-  return result.substr(0, result.length()-2);
+    std::string result = this->receive("V?");
+    return result.substr(0, result.length() - 2);
 }
 
 void TTILD400P::setVoltageLim(double vol) {
-  this->send("VLIM "+std::to_string(vol));
+    this->send("VLIM " + std::to_string(vol));
 }
 
 void TTILD400P::setCurrent(double cur) {
-  this->send("A "+std::to_string(cur));
-  this->send("LVLSEL A");
+    this->send("A " + std::to_string(cur));
+    this->send("LVLSEL A");
 }
 
 std::string TTILD400P::getCurrent() {
-  std::string result=this->receive("I?");
-  return result.substr(0, result.length()-2);
+    std::string result = this->receive("I?");
+    return result.substr(0, result.length() - 2);
 }
 
 void TTILD400P::setCurrentLim(double cur) {
-  this->send("ILIM "+std::to_string(cur));
+    this->send("ILIM " + std::to_string(cur));
 }
 
+void TTILD400P::turnOn() { this->send("INP 1"); }
 
-void TTILD400P::turnOn(){
-  this->send("INP 1");
-}
+void TTILD400P::turnOff() { this->send("INP 0"); }
 
-void TTILD400P::turnOff(){
-  this->send("INP 0");
-}
-
-void TTILD400P::setModeCC(){
-this->send("MODE C");
-}
+void TTILD400P::setModeCC() { this->send("MODE C"); }
 
-void TTILD400P::setModeCV(){
-this->send("MODE V");
-}
+void TTILD400P::setModeCV() { this->send("MODE V"); }
 
-void TTILD400P::setModeCW(){
-this->send("MODE P");
-}
+void TTILD400P::setModeCW() { this->send("MODE P"); }
 
-void TTILD400P::setModeCR(){
-this->send("MODE R");
-}
+void TTILD400P::setModeCR() { this->send("MODE R"); }
 
-std::string TTILD400P::getMode(){
-  std::string result=this->receive("MODE?");
-  return result;
+std::string TTILD400P::getMode() {
+    std::string result = this->receive("MODE?");
+    return result;
 }
- 
diff --git a/src/libLoad/TTILD400P.h b/src/libLoad/TTILD400P.h
index 3f908507..c46e6237 100644
--- a/src/libLoad/TTILD400P.h
+++ b/src/libLoad/TTILD400P.h
@@ -7,46 +7,46 @@
 // Prologix GPIB Comm
 //###############
 
+#include <chrono>
 #include <iostream>
 #include <string>
 #include <thread>
-#include <chrono>
-#include "GenericLoad.h"
 
+#include "GenericLoad.h"
 #include "SerialCom.h"
 
-class TTILD400P : public GenericLoad{
-    public:
-        TTILD400P(std::string dev, unsigned addr);
-        ~TTILD400P();
-
-        void init();
-	void setVoltage(double volt);
-        std::string getVoltage();
-        void setCurrent(double cur);
-        std::string getCurrent();
-        void turnOn();
-        void turnOff();
-
-	void setCurrentLim(double cur);	
-	void setVoltageLim(double vol);
-
-	void setModeCC();
-        void setModeCV();
-        void setModeCW();
-        void setModeCR();
-	std::string getMode();
-	
-    private:
-        SerialCom *m_com;
-        unsigned m_addr;
-        unsigned m_channel;
-
-        void send(std::string cmd);
- 
-	std::string receive(std::string cmd);
-        
-        std::chrono::milliseconds m_wait{500};
+class TTILD400P : public GenericLoad {
+ public:
+    TTILD400P(std::string dev, unsigned addr);
+    ~TTILD400P();
+
+    void init();
+    void setVoltage(double volt);
+    std::string getVoltage();
+    void setCurrent(double cur);
+    std::string getCurrent();
+    void turnOn();
+    void turnOff();
+
+    void setCurrentLim(double cur);
+    void setVoltageLim(double vol);
+
+    void setModeCC();
+    void setModeCV();
+    void setModeCW();
+    void setModeCR();
+    std::string getMode();
+
+ private:
+    SerialCom *m_com;
+    unsigned m_addr;
+    unsigned m_channel;
+
+    void send(std::string cmd);
+
+    std::string receive(std::string cmd);
+
+    std::chrono::milliseconds m_wait{500};
 };
 
 #endif
diff --git a/src/libMeter/Fluke8842.cpp b/src/libMeter/Fluke8842.cpp
index cc3d60d2..91447204 100644
--- a/src/libMeter/Fluke8842.cpp
+++ b/src/libMeter/Fluke8842.cpp
@@ -1,4 +1,5 @@
 #include "Fluke8842.h"
+
 #include "Logger.h"
 
 Fluke8842::Fluke8842(std::string dev, unsigned addr) {
@@ -7,9 +8,7 @@ Fluke8842::Fluke8842(std::string dev, unsigned addr) {
     m_com->send("++auto 0\n\r");
 }
 
-Fluke8842::~Fluke8842() {
-    delete m_com;
-}
+Fluke8842::~Fluke8842() { delete m_com; }
 
 // TODO send/receive should be in prologix class
 void Fluke8842::send(std::string cmd) {
@@ -20,22 +19,19 @@ void Fluke8842::send(std::string cmd) {
     std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
 }
 
-std::string Fluke8842::receive(std::string cmd)
-{
-  m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
-  cmd += "\r\n";
-  m_com->send(cmd);
-  m_com->send("++read eoi\n\r");
-  std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
-  std::string buf=m_com->receive();
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
-  return buf;
+std::string Fluke8842::receive(std::string cmd) {
+    m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
+    cmd += "\r\n";
+    m_com->send(cmd);
+    m_com->send("++read eoi\n\r");
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
+    std::string buf = m_com->receive();
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
+    return buf;
 }
 
-void Fluke8842::init() {
-    this->send("*");
-}
+void Fluke8842::init() { this->send("*"); }
 
 void Fluke8842::setSense(enum FlukeMode mode) {
     switch (mode) {
@@ -57,8 +53,4 @@ void Fluke8842::setSense(enum FlukeMode mode) {
     }
 }
 
-std::string Fluke8842::sense() {
-    return this->receive("?").substr(0, 11);
-}
-
-
+std::string Fluke8842::sense() { return this->receive("?").substr(0, 11); }
diff --git a/src/libMeter/Fluke8842.h b/src/libMeter/Fluke8842.h
index 650b4aa3..f33998dd 100644
--- a/src/libMeter/Fluke8842.h
+++ b/src/libMeter/Fluke8842.h
@@ -3,45 +3,38 @@
 
 // ####################
 // Fluke 8842A Multimeter
-// Author: 
+// Author:
 // Date: Nov 2018
 // Notes: Assuming Prologix GPIB to USB
 // ###################
 
+#include <chrono>
 #include <iostream>
 #include <string>
 #include <thread>
-#include <chrono>
 
 #include "SerialCom.h"
 
-enum class FlukeMode {
-    VOLTAGEDC,
-    VOLTAGEAC,
-    CURRENTDC,
-    CURRENTAC
-};
+enum class FlukeMode { VOLTAGEDC, VOLTAGEAC, CURRENTDC, CURRENTAC };
 
 class Fluke8842 {
-    public:
-        Fluke8842(std::string dev, unsigned addr);
-        ~Fluke8842();
+ public:
+    Fluke8842(std::string dev, unsigned addr);
+    ~Fluke8842();
 
-        void init();
-        void setSense(enum FlukeMode);
+    void init();
+    void setSense(enum FlukeMode);
 
-        std::string sense();
+    std::string sense();
 
+ private:
+    SerialCom *m_com;
+    unsigned m_addr;
 
-    private:
-        SerialCom *m_com;
-        unsigned m_addr;
+    void send(std::string cmd);
+    std::string receive(std::string cmd);
 
-        void send(std::string cmd);
-        std::string receive(std::string cmd);
-
-        std::chrono::milliseconds m_wait{500};
+    std::chrono::milliseconds m_wait{500};
 };
 
 #endif
-
diff --git a/src/libMeter/HP3478A.cpp b/src/libMeter/HP3478A.cpp
index f99e4f86..60f08e87 100644
--- a/src/libMeter/HP3478A.cpp
+++ b/src/libMeter/HP3478A.cpp
@@ -1,96 +1,87 @@
 #include "HP3478A.h"
-#include "Logger.h"
 
-//Commands predate SCPI. See manual for more details.
+#include "Logger.h"
 
+// Commands predate SCPI. See manual for more details.
 
 HP3478A::HP3478A(std::string dev, unsigned addr) {
-	m_com = new SerialCom(dev, B115200);
-	m_addr = addr;
-	m_com->send("++auto 0\n\r");
+    m_com = new SerialCom(dev, B115200);
+    m_addr = addr;
+    m_com->send("++auto 0\n\r");
 }
 
-
-HP3478A::~HP3478A() {
-	delete m_com;
-}
+HP3478A::~HP3478A() { delete m_com; }
 
 // TODO send/receive should be in prologix class
 void HP3478A::send(std::string cmd) {
-	m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
-	logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
-	cmd += "\r\n";
-	m_com->send(cmd);
-	std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
+    m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
+    cmd += "\r\n";
+    m_com->send(cmd);
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
 }
 
-
-std::string HP3478A::receive(std::string cmd)
-{
-  m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
-  cmd += "\r\n";
-  m_com->send(cmd);
-  m_com->send("++read eoi\n\r");
-  std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
-  std::string buf=m_com->receive();
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
-  return buf;
+std::string HP3478A::receive(std::string cmd) {
+    m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
+    cmd += "\r\n";
+    m_com->send(cmd);
+    m_com->send("++read eoi\n\r");
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
+    std::string buf = m_com->receive();
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
+    return buf;
 }
 
-
-//All these settings uses digit_mode="N5" ( 5 1/2 digit mode; best noise rejection, but slowest reading rate).
+// All these settings uses digit_mode="N5" ( 5 1/2 digit mode; best noise
+// rejection, but slowest reading rate).
 std::string HP3478A::setSense(enum HPMode mode) {
-	std::string temp = "";
-	switch (mode) {
-		case HPMode::SETTING:  //currently not working
-			this->send("\"S\"");
-			this->receive("S1"); // S0/S1 for rear/front panel
-			this->send("DISP S1");
-			//this->send("PRINT");
-			this->send("END");
-			break;
-		case HPMode::DC_VOLTAGE:
-			this->send("++auto 0\n\r");
-			this->send("\"F1RAZ1N5\"");
-			this->send("++auto 1\n\r");
-			return this->receive("++read 10\n\r");
-			//std::cout << this->receive("++read 10\n\r");
-			//this->send("TRIGGER 7");
-			//this->send("ENTER 704; I10");
-			//this->send("DISP I10");
-			//this->receive("PRINT I10");
-			break;
-		case HPMode::DC_CURRENT:
-			this->send("++auto 0\n\r");
-			this->send("\"F5RAZ1N5\"");
-			this->send("++auto 1\n\r");
-			return this->receive("++read 10\n\r");
-			//std::cout << this->receive("++read 10\n\r");
-			//this->send("ENTER 704; B1");
-			//this->send("DISP A3");
-			//this->receive("PRINT A3");
-			break;
-		case HPMode::AC_VOLTAGE:
-			this->send("++auto 0\n\r");
-			this->send("F2RAZ1N5\"");
-			this->receive("++auto 1\n\r");
-			return this->receive("++read 10\n\r");
-			break;
-		case HPMode::AC_CURRENT:
-			this->send("++auto 0\n\r");
-			this->send("\"F6RAZ1N5\"");
-			this->receive("++auto 1\n\r");
-			return this->receive("++read 10\n\r");
-			break;
-		default:
-			logger(logERROR) << __PRETTY_FUNCTION__ << " : Unknown mode!";
-			temp = std::string(__PRETTY_FUNCTION__) + " : Unknown model";
-			break;
-	}
-	return temp;
+    std::string temp = "";
+    switch (mode) {
+        case HPMode::SETTING:  // currently not working
+            this->send("\"S\"");
+            this->receive("S1");  // S0/S1 for rear/front panel
+            this->send("DISP S1");
+            // this->send("PRINT");
+            this->send("END");
+            break;
+        case HPMode::DC_VOLTAGE:
+            this->send("++auto 0\n\r");
+            this->send("\"F1RAZ1N5\"");
+            this->send("++auto 1\n\r");
+            return this->receive("++read 10\n\r");
+            // std::cout << this->receive("++read 10\n\r");
+            // this->send("TRIGGER 7");
+            // this->send("ENTER 704; I10");
+            // this->send("DISP I10");
+            // this->receive("PRINT I10");
+            break;
+        case HPMode::DC_CURRENT:
+            this->send("++auto 0\n\r");
+            this->send("\"F5RAZ1N5\"");
+            this->send("++auto 1\n\r");
+            return this->receive("++read 10\n\r");
+            // std::cout << this->receive("++read 10\n\r");
+            // this->send("ENTER 704; B1");
+            // this->send("DISP A3");
+            // this->receive("PRINT A3");
+            break;
+        case HPMode::AC_VOLTAGE:
+            this->send("++auto 0\n\r");
+            this->send("F2RAZ1N5\"");
+            this->receive("++auto 1\n\r");
+            return this->receive("++read 10\n\r");
+            break;
+        case HPMode::AC_CURRENT:
+            this->send("++auto 0\n\r");
+            this->send("\"F6RAZ1N5\"");
+            this->receive("++auto 1\n\r");
+            return this->receive("++read 10\n\r");
+            break;
+        default:
+            logger(logERROR) << __PRETTY_FUNCTION__ << " : Unknown mode!";
+            temp = std::string(__PRETTY_FUNCTION__) + " : Unknown model";
+            break;
+    }
+    return temp;
 }
-
-
-
-
diff --git a/src/libMeter/HP3478A.h b/src/libMeter/HP3478A.h
index 086dedf0..a8b8e914 100644
--- a/src/libMeter/HP3478A.h
+++ b/src/libMeter/HP3478A.h
@@ -5,43 +5,40 @@
 // HP Source Meter
 // Author: Timon Heim
 // Date: Aug 2017
-// Notes: Assuming Prologix GPIB to USB. Original file for Keithley power supplies; edited by Charilou Labitan to use for HP multimeters.
+// Notes: Assuming Prologix GPIB to USB. Original file for Keithley power
+// supplies; edited by Charilou Labitan to use for HP multimeters.
 // ###################
 
+#include <chrono>
 #include <iostream>
 #include <string>
 #include <thread>
-#include <chrono>
 
 #include "SerialCom.h"
 
 enum class HPMode {
-	SETTING,
-	DC_VOLTAGE,
-	DC_CURRENT,
-	AC_VOLTAGE,
-	AC_CURRENT,
-
+    SETTING,
+    DC_VOLTAGE,
+    DC_CURRENT,
+    AC_VOLTAGE,
+    AC_CURRENT,
 };
 
 class HP3478A {
-	public:
-		HP3478A(std::string dev, unsigned addr);
-		~HP3478A();
+ public:
+    HP3478A(std::string dev, unsigned addr);
+    ~HP3478A();
 
-		std::string setSense(enum HPMode);
+    std::string setSense(enum HPMode);
 
-		void send(std::string cmd);
-		std::string receive(std::string cmd);
+    void send(std::string cmd);
+    std::string receive(std::string cmd);
 
+ private:
+    SerialCom *m_com;
+    unsigned m_addr;
 
-	private:
-		SerialCom *m_com;
-		unsigned m_addr;
-
-
-		std::chrono::milliseconds m_wait{600}; //200
+    std::chrono::milliseconds m_wait{600};  // 200
 };
 
 #endif
-
diff --git a/src/libMeter/Keithley2000.cpp b/src/libMeter/Keithley2000.cpp
index 25cccaf5..65e4d923 100644
--- a/src/libMeter/Keithley2000.cpp
+++ b/src/libMeter/Keithley2000.cpp
@@ -1,4 +1,5 @@
 #include "Keithley2000.h"
+
 #include "Logger.h"
 
 Keithley2000::Keithley2000(std::string dev, unsigned addr) {
@@ -7,9 +8,7 @@ Keithley2000::Keithley2000(std::string dev, unsigned addr) {
     m_com->send("++auto 0\n\r");
 }
 
-Keithley2000::~Keithley2000() {
-    delete m_com;
-}
+Keithley2000::~Keithley2000() { delete m_com; }
 
 // TODO send/receive should be in prologix class
 void Keithley2000::send(std::string cmd) {
@@ -20,23 +19,22 @@ void Keithley2000::send(std::string cmd) {
     std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
 }
 
-std::string Keithley2000::receive(std::string cmd)
-{
-  m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
-  cmd += "\r\n";
-  m_com->send(cmd);
-  m_com->send("++read eoi\n\r");
-  std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
-  std::string buf=m_com->receive();
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
-  return buf;
+std::string Keithley2000::receive(std::string cmd) {
+    m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
+    cmd += "\r\n";
+    m_com->send(cmd);
+    m_com->send("++read eoi\n\r");
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
+    std::string buf = m_com->receive();
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
+    return buf;
 }
 
 void Keithley2000::init() {
     this->send("*RST");
     this->send(":FORMAT:ELEMENTS READ,CHAN,UNIT");
-    this->send(":SYST:BEEP:STAT OFF");//disable beep
+    this->send(":SYST:BEEP:STAT OFF");  // disable beep
 }
 
 void Keithley2000::setSense(enum KeithleyMode mode) {
@@ -57,14 +55,11 @@ std::string Keithley2000::sense() {
     return this->receive(":READ?").substr(0, 13);
 }
 
-//SCAN scanner board -- Switching Matrix Functions
+// SCAN scanner board -- Switching Matrix Functions
 
-std::string Keithley2000::readChannel(std::string channel){
+std::string Keithley2000::readChannel(std::string channel) {
     this->send(":ROUTE:OPEN:ALL");
     this->send(":SENSE:FUNC \"VOLT\"");
     this->send(":ROUTE:CLOSE (@" + channel + ")");
-    return this->receive(":READ?").substr(0,13);
+    return this->receive(":READ?").substr(0, 13);
 }
-
-
-
diff --git a/src/libMeter/Keithley2000.h b/src/libMeter/Keithley2000.h
index c06d5635..a5d3bddf 100644
--- a/src/libMeter/Keithley2000.h
+++ b/src/libMeter/Keithley2000.h
@@ -8,39 +8,34 @@
 // Notes: Assuming Prologix GPIB to USB
 // ###################
 
+#include <chrono>
 #include <iostream>
 #include <string>
 #include <thread>
-#include <chrono>
 
 #include "SerialCom.h"
 
-enum class KeithleyMode {
-    VOLTAGE,
-    CURRENT
-};
+enum class KeithleyMode { VOLTAGE, CURRENT };
 
 class Keithley2000 {
-    public:
-        Keithley2000(std::string dev, unsigned addr);
-        ~Keithley2000();
+ public:
+    Keithley2000(std::string dev, unsigned addr);
+    ~Keithley2000();
 
-        void init();
-        void setSense(enum KeithleyMode);
+    void init();
+    void setSense(enum KeithleyMode);
 
-	std::string readChannel(std::string channel);
-        std::string sense();
+    std::string readChannel(std::string channel);
+    std::string sense();
 
+ private:
+    SerialCom *m_com;
+    unsigned m_addr;
 
-    private:
-        SerialCom *m_com;
-        unsigned m_addr;
+    void send(std::string cmd);
+    std::string receive(std::string cmd);
 
-        void send(std::string cmd);
-        std::string receive(std::string cmd);
-
-        std::chrono::milliseconds m_wait{200};
+    std::chrono::milliseconds m_wait{200};
 };
 
 #endif
-
diff --git a/src/libMeter/PM6680.cpp b/src/libMeter/PM6680.cpp
index c836cf97..6af303c8 100644
--- a/src/libMeter/PM6680.cpp
+++ b/src/libMeter/PM6680.cpp
@@ -1,6 +1,6 @@
 #include "PM6680.h"
-#include "Logger.h"
 
+#include "Logger.h"
 
 PM6680::PM6680(std::string dev, unsigned addr) {
     m_com = new SerialCom(dev);
@@ -8,9 +8,7 @@ PM6680::PM6680(std::string dev, unsigned addr) {
     m_com->send("++auto 0\n\r");
 }
 
-PM6680::~PM6680() {
-    delete m_com;
-}
+PM6680::~PM6680() { delete m_com; }
 
 void PM6680::send(std::string cmd) {
     m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
@@ -28,7 +26,7 @@ std::string PM6680::receive(std::string cmd) {
     std::this_thread::sleep_for(std::chrono::seconds(1));
     m_com->send("++read eoi\n\r");
     std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
-    std::string buf=m_com->receive();
+    std::string buf = m_com->receive();
     logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
     return buf;
 }
@@ -48,15 +46,13 @@ void PM6680::init() {
     std::this_thread::sleep_for(std::chrono::seconds(1));
     this->send("INP:FILT ON");
     std::this_thread::sleep_for(std::chrono::seconds(1));
-   this->send("AVER:STATE ON");
-    
+    this->send("AVER:STATE ON");
 }
 
 std::string PM6680::getFrequency() {
-    //std::string result=this->receive("MEAS:ARRay:FREQ? (10)");
-    std::string result=this->receive("MEAS:FREQ?");
-    //std::string result=this->receive("MEAS:FREQ? (10)");
-    logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
+    // std::string result=this->receive("MEAS:ARRay:FREQ? (10)");
+    std::string result = this->receive("MEAS:FREQ?");
+    // std::string result=this->receive("MEAS:FREQ? (10)");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
     return result;
 }
-
diff --git a/src/libMeter/PM6680.h b/src/libMeter/PM6680.h
index 6f6ee2de..ead5049e 100644
--- a/src/libMeter/PM6680.h
+++ b/src/libMeter/PM6680.h
@@ -2,37 +2,37 @@
 #define PM6680_H
 
 // ####################
-// PM 6680 high resolution programmable timer/counter 225MHz  
+// PM 6680 high resolution programmable timer/counter 225MHz
 // Author: Peilian Liu
 // Date: May 2019
 // Notes: Assuming Prologix GPIB to USB
 // ###################
 
+#include <chrono>
 #include <iostream>
 #include <string>
 #include <thread>
-#include <chrono>
 
 #include "SerialCom.h"
 
 class PM6680 {
-    public:
-        PM6680(std::string dev, unsigned addr);
-        ~PM6680();
-
-        void init();
-        std::string getFrequency();
-        void turnOn();
-        void turnOff();
-
-    private:
-        SerialCom *m_com;
-        unsigned m_addr;
-
-        void send(std::string cmd);
-        std::string receive(std::string cmd);
-        
-        std::chrono::milliseconds m_wait{200};
+ public:
+    PM6680(std::string dev, unsigned addr);
+    ~PM6680();
+
+    void init();
+    std::string getFrequency();
+    void turnOn();
+    void turnOff();
+
+ private:
+    SerialCom *m_com;
+    unsigned m_addr;
+
+    void send(std::string cmd);
+    std::string receive(std::string cmd);
+
+    std::chrono::milliseconds m_wait{200};
 };
 
 #endif
diff --git a/src/libPS/AgilentE36300APs.h b/src/libPS/AgilentE36300APs.h
index 6c836cb5..565f0649 100644
--- a/src/libPS/AgilentE36300APs.h
+++ b/src/libPS/AgilentE36300APs.h
@@ -7,13 +7,13 @@
 
 /**
  * Implementation for the Agilent E36300A Triple Output
- * DC Power Supply ([Programming Manual](https://literature.cdn.keysight.com/litweb/pdf/E36311-90008.pdf)).
+ * DC Power Supply ([Programming
+ * Manual](https://literature.cdn.keysight.com/litweb/pdf/E36311-90008.pdf)).
  */
-class AgilentE36300APs : public AgilentPs
-{
-public:
-  AgilentE36300APs(const std::string& name);
-  ~AgilentE36300APs() =default;
+class AgilentE36300APs : public AgilentPs {
+ public:
+    AgilentE36300APs(const std::string& name);
+    ~AgilentE36300APs() = default;
 };
 
-#endif //AGILENTE36300APS_H
+#endif  // AGILENTE36300APS_H
diff --git a/src/libPS/AgilentE3631APs.cpp b/src/libPS/AgilentE3631APs.cpp
index 2c80b688..55e9a0ad 100644
--- a/src/libPS/AgilentE3631APs.cpp
+++ b/src/libPS/AgilentE3631APs.cpp
@@ -1,19 +1,12 @@
 #include "AgilentE3631APs.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(AgilentE3631APs)
 
-AgilentE3631APs::AgilentE3631APs(const std::string& name) :
-AgilentPs(name, {"E3631A"}, 3)
-{ }
+AgilentE3631APs::AgilentE3631APs(const std::string& name)
+    : AgilentPs(name, {"E3631A"}, 3) {}
 
-void AgilentE3631APs::turnOn(unsigned channel)
-{ 
-  SCPIPs::turnOn(channel);
-}
+void AgilentE3631APs::turnOn(unsigned channel) { SCPIPs::turnOn(channel); }
 
-void AgilentE3631APs::turnOff(unsigned channel)
-{
-  SCPIPs::turnOff(channel);
-}
+void AgilentE3631APs::turnOff(unsigned channel) { SCPIPs::turnOff(channel); }
diff --git a/src/libPS/AgilentE3631APs.h b/src/libPS/AgilentE3631APs.h
index 8ab6591b..e80b6c80 100644
--- a/src/libPS/AgilentE3631APs.h
+++ b/src/libPS/AgilentE3631APs.h
@@ -7,7 +7,8 @@
 
 /**
  * Implementation for the Agilent E3631A Triple Output
- * DC Power Supply ([Programming Manual](http://literature.cdn.keysight.com/litweb/pdf/E3631-90002.pdf)).
+ * DC Power Supply ([Programming
+ * Manual](http://literature.cdn.keysight.com/litweb/pdf/E3631-90002.pdf)).
  *
  * Using numerical channel mapping from the power supply
  * operations manual:
@@ -15,27 +16,26 @@
  *  - 2: P25V
  *  - 3: M25V
  */
-class AgilentE3631APs : public AgilentPs
-{
-public:
-  AgilentE3631APs(const std::string& name);
-  ~AgilentE3631APs() =default;
+class AgilentE3631APs : public AgilentPs {
+ public:
+    AgilentE3631APs(const std::string& name);
+    ~AgilentE3631APs() = default;
 
-  /** Turn on all channels
-   *
-   * E3631A does not support enabling specific channels.
-   *
-   * @param channel ignored
-   */  
-  virtual void turnOn(unsigned channel);
+    /** Turn on all channels
+     *
+     * E3631A does not support enabling specific channels.
+     *
+     * @param channel ignored
+     */
+    virtual void turnOn(unsigned channel);
 
-  /** Turn off all channels
-   *
-   * E3631A does not support enabling specific channels.
-   *
-   * @param channel ignored
-   */  
-  virtual void turnOff(unsigned channel);
+    /** Turn off all channels
+     *
+     * E3631A does not support enabling specific channels.
+     *
+     * @param channel ignored
+     */
+    virtual void turnOff(unsigned channel);
 };
 
-#endif //AGILENTE3631APS_H
+#endif  // AGILENTE3631APS_H
diff --git a/src/libPS/AgilentE3634APs.h b/src/libPS/AgilentE3634APs.h
index fcf6e63b..b17ff743 100644
--- a/src/libPS/AgilentE3634APs.h
+++ b/src/libPS/AgilentE3634APs.h
@@ -7,18 +7,18 @@
 
 /**
  * Implementation for the Agilent E3633A/E3634A Single Output
- * DC Power Supply ([Programming Manual](http://literature.cdn.keysight.com/litweb/pdf/E3634-90001.pdf)).
+ * DC Power Supply ([Programming
+ * Manual](http://literature.cdn.keysight.com/litweb/pdf/E3634-90001.pdf)).
  * Other single-channel Agilent power supplies might be supported too, but have
  * not been checked.
  *
  * The command set seems to be the same as E364xA, thus the implemetation
  * is inherited from there.
  */
-class AgilentE3634APs : public AgilentPs
-{
-public:
-  AgilentE3634APs(const std::string& name);
-  ~AgilentE3634APs() =default;
+class AgilentE3634APs : public AgilentPs {
+ public:
+    AgilentE3634APs(const std::string& name);
+    ~AgilentE3634APs() = default;
 };
 
-#endif //AGILENTE3634APS_H
+#endif  // AGILENTE3634APS_H
diff --git a/src/libPS/AgilentE364xAPs.h b/src/libPS/AgilentE364xAPs.h
index c4a1afda..c048d04b 100644
--- a/src/libPS/AgilentE364xAPs.h
+++ b/src/libPS/AgilentE364xAPs.h
@@ -7,15 +7,15 @@
 
 /**
  * Implementation for the Agilent E364xA Single Output
- * DC Power Supply ([Programming Manual](https://www.mouser.com/pdfdocs/3ugE3640-90001.pdf)).
- * Other single-channel Agilent power supplies might be supported too, but have
- * not been checked.
+ * DC Power Supply ([Programming
+ * Manual](https://www.mouser.com/pdfdocs/3ugE3640-90001.pdf)). Other
+ * single-channel Agilent power supplies might be supported too, but have not
+ * been checked.
  */
-class AgilentE364xAPs : public AgilentPs
-{
-public:
-  AgilentE364xAPs(const std::string& name);
-  ~AgilentE364xAPs() =default;
+class AgilentE364xAPs : public AgilentPs {
+ public:
+    AgilentE364xAPs(const std::string& name);
+    ~AgilentE364xAPs() = default;
 };
 
-#endif //AGILENTE364XAPS_H
+#endif  // AGILENTE364XAPS_H
diff --git a/src/libPS/AgilentPs.cpp b/src/libPS/AgilentPs.cpp
index c4484d09..4ea47ffc 100644
--- a/src/libPS/AgilentPs.cpp
+++ b/src/libPS/AgilentPs.cpp
@@ -5,16 +5,14 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(AgilentPs)
 
-AgilentPs::AgilentPs(const std::string& name, std::vector<std::string> models,  unsigned maxChannels) :
-SCPIPs(name, models, maxChannels)
-{ }
+AgilentPs::AgilentPs(const std::string& name, std::vector<std::string> models,
+                     unsigned maxChannels)
+    : SCPIPs(name, models, maxChannels) {}
 
-void AgilentPs::beepOff()
-{
-  m_com->send("SYST:BEEP:STAT OFF"); // disable beep
+void AgilentPs::beepOff() {
+    m_com->send("SYST:BEEP:STAT OFF");  // disable beep
 }
-
diff --git a/src/libPS/AgilentPs.h b/src/libPS/AgilentPs.h
index e9b87260..a60a6b28 100644
--- a/src/libPS/AgilentPs.h
+++ b/src/libPS/AgilentPs.h
@@ -6,33 +6,34 @@
 #include <string>
 
 #include "SCPIPs.h"
-
 #include "SerialCom.h"
 
 /**
  * Base implemetation for Agilent/Keysight power supplies that share
  * a very similar command set.
  *
- * Options are possible to add additional for error checking on 
- *  - model compatibility (list of strings partially matched against *idn?, empty means no check is performed)
- *  - channel checking (maximum number of channels, 0 means no check is performed)
+ * Options are possible to add additional for error checking on
+ *  - model compatibility (list of strings partially matched against *idn?,
+ * empty means no check is performed)
+ *  - channel checking (maximum number of channels, 0 means no check is
+ * performed)
  */
-class AgilentPs : public SCPIPs
-{
-public:
-  /**
-   * @param name Name of the power supply
-   * @param models List of supported models (empty means no check is performed) 
-   * @param maxChannels Maximum number of channels in the power supply (0 means no maximum)
-   */
-  AgilentPs(const std::string& name, std::vector<std::string> models={}, unsigned maxChannels=0);
-  ~AgilentPs() =default;
-
-  /** Disable the audible beep
-   */
-  void beepOff();
-
+class AgilentPs : public SCPIPs {
+ public:
+    /**
+     * @param name Name of the power supply
+     * @param models List of supported models (empty means no check is
+     * performed)
+     * @param maxChannels Maximum number of channels in the power supply (0
+     * means no maximum)
+     */
+    AgilentPs(const std::string& name, std::vector<std::string> models = {},
+              unsigned maxChannels = 0);
+    ~AgilentPs() = default;
+
+    /** Disable the audible beep
+     */
+    void beepOff();
 };
 
 #endif
-
diff --git a/src/libPS/Bk16XXPs.cpp b/src/libPS/Bk16XXPs.cpp
index 209b9549..9ed37278 100644
--- a/src/libPS/Bk16XXPs.cpp
+++ b/src/libPS/Bk16XXPs.cpp
@@ -5,180 +5,177 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(Bk16XXPs)
 
-Bk16XXPs::Bk16XXPs(const std::string& name): 
-IPowerSupply(name, {}){} 
+Bk16XXPs::Bk16XXPs(const std::string& name) : IPowerSupply(name, {}) {}
 
-bool Bk16XXPs::ping()
-{
-  const std::vector<std::string>& result = command("GETD");
-  return result.size()>0;
+bool Bk16XXPs::ping() {
+    const std::vector<std::string>& result = command("GETD");
+    return result.size() > 0;
 }
 
-void Bk16XXPs::checkCompatibilityList()
-{
-  logger(logWARNING)<<"No checkCompatibilityList function can be implemented for Bk16kk PS. This implementation is valid only for 1687B and 1688B ";
+void Bk16XXPs::checkCompatibilityList() {
+    logger(logWARNING)
+        << "No checkCompatibilityList function can be implemented for Bk16kk "
+           "PS. This implementation is valid only for 1687B and 1688B ";
 }
 
-void Bk16XXPs::reset()
-{
-  logger(logINFO)<<"No reset function can be implemented for Bk16kk PS ";
+void Bk16XXPs::reset() {
+    logger(logINFO) << "No reset function can be implemented for Bk16kk PS ";
 }
 
-std::string Bk16XXPs::identify()
-{
-  return "";
-}
+std::string Bk16XXPs::identify() { return ""; }
 
-void Bk16XXPs::turnOn(unsigned channel )
-{
-  command("SOUT0");
-}
+void Bk16XXPs::turnOn(unsigned channel) { command("SOUT0"); }
 
-void Bk16XXPs::turnOff(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void Bk16XXPs::turnOff(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  command("SOUT1");
+    command("SOUT1");
 }
 
-void Bk16XXPs::setCurrentLevel(double curr, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void Bk16XXPs::setCurrentLevel(double curr, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  curr *= 10;
-  int curr_int = (int)curr;
-  if (curr_int < 100)
-    command("CURR0" + std::to_string(curr_int));
-  else
-    command("CURR" + std::to_string(curr_int));
+    curr *= 10;
+    int curr_int = static_cast<int>(curr);
+    if (curr_int < 100)
+        command("CURR0" + std::to_string(curr_int));
+    else
+        command("CURR" + std::to_string(curr_int));
 }
 
-double Bk16XXPs::getCurrentLevel(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Bk16XXPs::getCurrentLevel(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  const std::vector<std::string>& ret = command("GETS");
+    const std::vector<std::string>& ret = command("GETS");
 
-  std::string volt_curr = ret[0];
-  int volt_curr_int = stoi(volt_curr);
-  int curr = volt_curr_int % 1000;
-  return (double)curr / 10.0;
+    std::string volt_curr = ret[0];
+    int volt_curr_int = stoi(volt_curr);
+    int curr = volt_curr_int % 1000;
+    return static_cast<double>(curr) / 10.0;
 }
 
+void Bk16XXPs::setCurrentProtect(double curr, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-
-void Bk16XXPs::setCurrentProtect(double curr, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
-
-  curr *= 10;
-  int curr_int = (int)curr;
-  if (curr_int < 100)
-    command("SOCP0" + std::to_string(curr_int));
-  else
-    command("SOCP" + std::to_string(curr_int));
+    curr *= 10;
+    int curr_int = static_cast<int>(curr);
+    if (curr_int < 100)
+        command("SOCP0" + std::to_string(curr_int));
+    else
+        command("SOCP" + std::to_string(curr_int));
 }
 
-double Bk16XXPs::getCurrentProtect(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Bk16XXPs::getCurrentProtect(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  const std::vector<std::string>& ret = command("GOCP");
-  const std::string& max_curr = ret[0];
-  std::string current = max_curr.substr(0, max_curr.find("\r"));
-  int curr_int = stoi(current);
-  double curr = floor((double)curr_int / 10);
-  return curr;
+    const std::vector<std::string>& ret = command("GOCP");
+    const std::string& max_curr = ret[0];
+    std::string current = max_curr.substr(0, max_curr.find("\r"));
+    int curr_int = stoi(current);
+    double curr = floor(   static_cast<double>(curr_int) / 10);
+    return curr;
 }
 
-double Bk16XXPs::measureCurrent(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Bk16XXPs::measureCurrent(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  const std::vector<std::string>& ret = command("GETD");
-  const std::string& volt_curr = ret[0];
-  int volt_curr_int = std::stoi(volt_curr);
-  double curr = floor((double)(volt_curr_int % 100000) / 10);
-  return curr / 100;
+    const std::vector<std::string>& ret = command("GETD");
+    const std::string& volt_curr = ret[0];
+    int volt_curr_int = std::stoi(volt_curr);
+    double curr = floor(static_cast<double>(volt_curr_int % 100000) / 10);
+    return curr / 100;
 }
 
-void Bk16XXPs::setVoltageLevel(double volt,unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
-  volt *= 10;
-  int volt_int = (int)volt;
-  if (volt_int < 100)
-    command("VOLT0" + std::to_string(volt_int));
-  else
-    command("VOLT" + std::to_string(volt_int));
+void Bk16XXPs::setVoltageLevel(double volt, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
+    volt *= 10;
+    int volt_int = static_cast<int>(volt);
+    if (volt_int < 100)
+        command("VOLT0" + std::to_string(volt_int));
+    else
+        command("VOLT" + std::to_string(volt_int));
 }
 
-double Bk16XXPs::getVoltageLevel(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Bk16XXPs::getVoltageLevel(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  const std::vector<std::string>& ret = command("GETS");
-  const std::string& volt_curr = ret[0];
+    const std::vector<std::string>& ret = command("GETS");
+    const std::string& volt_curr = ret[0];
 
-  int volt_curr_int = stoi(volt_curr);
-  double volt = floor((double)volt_curr_int / 1000);
-  return volt / 10;
+    int volt_curr_int = stoi(volt_curr);
+    double volt = floor(static_cast<double>(volt_curr_int) / 1000);
+    return volt / 10;
 }
 
-void Bk16XXPs::setVoltageProtect(double volt, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void Bk16XXPs::setVoltageProtect(double volt, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  volt *= 10;
-  int volt_int = (int)volt;
-  if (volt_int < 100)
-    command("SOVP0" + std::to_string(volt_int));
-  else
-    command("SOVP" + std::to_string(volt_int));
+    volt *= 10;
+    int volt_int = static_cast<int>(volt);
+    if (volt_int < 100)
+        command("SOVP0" + std::to_string(volt_int));
+    else
+        command("SOVP" + std::to_string(volt_int));
+}
+
+double Bk16XXPs::getVoltageProtect(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
+
+    const std::vector<std::string>& ret = command("GOVP");
+    const std::string& voltage = ret[0];
+    int volt_int = stoi(voltage);
+    double volt = floor(  static_cast<double>(volt_int) / 10);
+    return volt;
 }
-
-double Bk16XXPs::getVoltageProtect(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
-
-
-  const std::vector<std::string>& ret = command("GOVP");
-  const std::string& voltage = ret[0];
-  int volt_int = stoi(voltage);
-  double volt = floor((double)volt_int / 10);
-  return volt;
+
+double Bk16XXPs::measureVoltage(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
+
+    const std::vector<std::string>& ret = command("GETD");
+    const std::string& volt_curr = ret[0];
+    int volt_curr_int = stoi(volt_curr);
+    double volt = floor( static_cast<double>(volt_curr_int) / 100000);
+    return volt / 100;
 }
-
-double Bk16XXPs::measureVoltage(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
-
-  const std::vector<std::string>& ret = command("GETD");
-  const std::string& volt_curr = ret[0];
-  int volt_curr_int = stoi(volt_curr);
-  double volt = floor((double)volt_curr_int / 100000);
-  return volt / 100;
-}
-
-std::vector<std::string> Bk16XXPs::command(const std::string& cmd)
-{
-  m_com->send(cmd);
-  std::vector<std::string> ret;
-
-  // Read until we see the last "OK"
-  while(ret.size()==0 || ret.back()!="OK")
-    {
-      std::string response=m_com->receive();
-
-      // Tokenize
-      std::stringstream ss(response);
-      std::string line;
-      while(std::getline(ss, line, '\r'))
-	ret.push_back(line);
+
+std::vector<std::string> Bk16XXPs::command(const std::string& cmd) {
+    m_com->send(cmd);
+    std::vector<std::string> ret;
+
+    // Read until we see the last "OK"
+    while (ret.size() == 0 || ret.back() != "OK") {
+        std::string response = m_com->receive();
+
+        // Tokenize
+        std::stringstream ss(response);
+        std::string line;
+        while (std::getline(ss, line, '\r')) ret.push_back(line);
     }
-  return ret;
+    return ret;
 }
diff --git a/src/libPS/Bk16XXPs.h b/src/libPS/Bk16XXPs.h
index 381d10a9..4819ab3d 100644
--- a/src/libPS/Bk16XXPs.h
+++ b/src/libPS/Bk16XXPs.h
@@ -6,78 +6,76 @@
 #include <string>
 
 #include "IPowerSupply.h"
-
 #include "SerialCom.h"
 
 /** \brief BK 16xx
  *
  * Implementation for the BK 16xx power supply.
  *
- * [Progamming Manual](https://bkpmedia.s3.amazonaws.com/downloads/programming_manuals/en-us/168xB_programming_manual.pdf)
+ * [Progamming
+ * Manual](https://bkpmedia.s3.amazonaws.com/downloads/programming_manuals/en-us/168xB_programming_manual.pdf)
  */
-class Bk16XXPs : public IPowerSupply
-{
-public:
-  Bk16XXPs(const std::string& name);
-  ~Bk16XXPs() =default;
-
-  /** \name Communication
-   * @{
-   */
-
-  virtual bool ping();
-
-  virtual void checkCompatibilityList();
-
-  /** @} */
-
-  /** \name Power Supply Control
-   * @{
-   */
-
-  virtual void reset();
-  virtual std::string identify();
-  virtual void turnOn(unsigned channel);
-  virtual void turnOff(unsigned channel);
-
-  /** @} */
-  
-  /** \name Current Control and Measurement
-   * @{
-   */
-  virtual void   setCurrentLevel(double cur, unsigned channel = 0);
-  virtual double getCurrentLevel(unsigned channel = 0);
-  virtual void   setCurrentProtect(double maxcur , unsigned channel = 0);
-  virtual double getCurrentProtect(unsigned channel = 0);  
-  virtual double measureCurrent(unsigned channel = 0);
-
-  /** @} */
-  /** \name Voltage Control and Measurement
-   * @{
-   */
-
-  virtual void   setVoltageLevel(double volt, unsigned channel = 0);
-  virtual double getVoltageLevel(unsigned channel = 0);
-  virtual void   setVoltageProtect(double maxvolt , unsigned channel = 0 );
-  virtual double getVoltageProtect(unsigned channel = 0);
-  virtual double measureVoltage(unsigned channel = 0);
-
-  /** @} */
-
-private:
-  /**
-   * Sends a command and receives until the `OK` is seen.
-   *
-   * The returned data is further split by the `\r` character to 
-   * separate lines that typically indicate individual values. The
-   * `OK` is included as the last entry in the list.
-   *
-   * \param cmd Commmand to send
-   *
-   * \return Power supply response split at `\r`.
-   */
-  std::vector<std::string> command(const std::string& cmd);
+class Bk16XXPs : public IPowerSupply {
+ public:
+    Bk16XXPs(const std::string& name);
+    ~Bk16XXPs() = default;
+
+    /** \name Communication
+     * @{
+     */
+
+    virtual bool ping();
+
+    virtual void checkCompatibilityList();
+
+    /** @} */
+
+    /** \name Power Supply Control
+     * @{
+     */
+
+    virtual void reset();
+    virtual std::string identify();
+    virtual void turnOn(unsigned channel);
+    virtual void turnOff(unsigned channel);
+
+    /** @} */
+
+    /** \name Current Control and Measurement
+     * @{
+     */
+    virtual void setCurrentLevel(double cur, unsigned channel = 0);
+    virtual double getCurrentLevel(unsigned channel = 0);
+    virtual void setCurrentProtect(double maxcur, unsigned channel = 0);
+    virtual double getCurrentProtect(unsigned channel = 0);
+    virtual double measureCurrent(unsigned channel = 0);
+
+    /** @} */
+    /** \name Voltage Control and Measurement
+     * @{
+     */
+
+    virtual void setVoltageLevel(double volt, unsigned channel = 0);
+    virtual double getVoltageLevel(unsigned channel = 0);
+    virtual void setVoltageProtect(double maxvolt, unsigned channel = 0);
+    virtual double getVoltageProtect(unsigned channel = 0);
+    virtual double measureVoltage(unsigned channel = 0);
+
+    /** @} */
+
+ private:
+    /**
+     * Sends a command and receives until the `OK` is seen.
+     *
+     * The returned data is further split by the `\r` character to
+     * separate lines that typically indicate individual values. The
+     * `OK` is included as the last entry in the list.
+     *
+     * \param cmd Commmand to send
+     *
+     * \return Power supply response split at `\r`.
+     */
+    std::vector<std::string> command(const std::string& cmd);
 };
 
 #endif
-
diff --git a/src/libPS/DT54xxPs.cpp b/src/libPS/DT54xxPs.cpp
index b6825744..5ff16e2e 100644
--- a/src/libPS/DT54xxPs.cpp
+++ b/src/libPS/DT54xxPs.cpp
@@ -1,183 +1,174 @@
 #include "DT54xxPs.h"
 
-#include "TextSerialCom.h"
-
 #include <algorithm>
 #include <thread>
 
 #include "Logger.h"
+#include "TextSerialCom.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(DT54xxPs)
 
-DT54xxPs::DT54xxPs(const std::string& name) :
-IPowerSupply(name, {"DT5472"})
-{ }
+DT54xxPs::DT54xxPs(const std::string& name) : IPowerSupply(name, {"DT5472"}) {}
 
-void DT54xxPs::reset()
-{
-  command("SET","OFF");
-  command("SET","BDCLR");
+void DT54xxPs::reset() {
+    command("SET", "OFF");
+    command("SET", "BDCLR");
 
-  std::string result=identify();
-  if(result.empty())
-    throw std::runtime_error("No communication after reset.");
+    std::string result = identify();
+    if (result.empty())
+        throw std::runtime_error("No communication after reset.");
 }
 
-std::string DT54xxPs::identify()
-{
-  std::string idn=command("MON","BDNAME");
-  return idn;
+std::string DT54xxPs::identify() {
+    std::string idn = command("MON", "BDNAME");
+    return idn;
 }
-  
-bool DT54xxPs::ping()
-{
-  std::string result=command("MON","BDNAME");
-  return !result.empty();
+
+bool DT54xxPs::ping() {
+    std::string result = command("MON", "BDNAME");
+    return !result.empty();
 }
 
-void DT54xxPs::turnOn(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void DT54xxPs::turnOn(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  command("SET","ON");
+    command("SET", "ON");
 
-  while(status(channel)&Status::RampingUp)
-    {
-      double volt=measureVoltage(channel);
-      logger(logDEBUG) << __PRETTY_FUNCTION__ << " -> ramping up: " << volt << "V";
-      std::this_thread::sleep_for(std::chrono::seconds(1));
+    while (status(channel) & Status::RampingUp) {
+        double volt = measureVoltage(channel);
+        logger(logDEBUG) << __PRETTY_FUNCTION__ << " -> ramping up: " << volt
+                         << "V";
+        std::this_thread::sleep_for(std::chrono::seconds(1));
     }
 }
 
-void DT54xxPs::turnOff(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void DT54xxPs::turnOff(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  command("SET","OFF");
+    command("SET", "OFF");
 
-  while(status(channel)&Status::RampingDown)
-    {
-      double volt=measureVoltage(channel);
-      logger(logDEBUG) << __PRETTY_FUNCTION__ << " -> ramping down: " << volt << "V";
-      std::this_thread::sleep_for(std::chrono::seconds(1));
+    while (status(channel) & Status::RampingDown) {
+        double volt = measureVoltage(channel);
+        logger(logDEBUG) << __PRETTY_FUNCTION__ << " -> ramping down: " << volt
+                         << "V";
+        std::this_thread::sleep_for(std::chrono::seconds(1));
     }
 }
 
-void DT54xxPs::setCurrentLevel(double cur, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void DT54xxPs::setCurrentLevel(double cur, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  command("SET", "ISET", std::to_string(cur*1e6));
+    command("SET", "ISET", std::to_string(cur * 1e6));
 }
 
-double DT54xxPs::getCurrentLevel(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
-  return std::stod(command("MON","ISET"))/1e6;
+double DT54xxPs::getCurrentLevel(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
+    return std::stod(command("MON", "ISET")) / 1e6;
 }
 
-void DT54xxPs::setCurrentProtect(double maxcur, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
-  setCurrentLevel(maxcur, channel);
+void DT54xxPs::setCurrentProtect(double maxcur, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
+    setCurrentLevel(maxcur, channel);
 }
 
-double DT54xxPs::getCurrentProtect(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double DT54xxPs::getCurrentProtect(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return getCurrentLevel(channel);
+    return getCurrentLevel(channel);
 }
 
-double DT54xxPs::measureCurrent(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double DT54xxPs::measureCurrent(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return std::stod(command("MON","IMON"))/1e6;
+    return std::stod(command("MON", "IMON")) / 1e6;
 }
 
-void DT54xxPs::setVoltageLevel(double volt, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void DT54xxPs::setVoltageLevel(double volt, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  command("SET", "VSET", std::to_string(volt));
+    command("SET", "VSET", std::to_string(volt));
 }
 
-double DT54xxPs::getVoltageLevel(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double DT54xxPs::getVoltageLevel(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return std::stod(command("MON","VSET"));
+    return std::stod(command("MON", "VSET"));
 }
 
-void DT54xxPs::setVoltageProtect(double maxvolt, unsigned channel)
-{
-
-  setVoltageLevel(maxvolt, channel);
-
+void DT54xxPs::setVoltageProtect(double maxvolt, unsigned channel) {
+    setVoltageLevel(maxvolt, channel);
 }
 
-double DT54xxPs::getVoltageProtect(unsigned channel)
-{
-
-  return getVoltageLevel(channel);
+double DT54xxPs::getVoltageProtect(unsigned channel) {
+    return getVoltageLevel(channel);
 }
 
-double DT54xxPs::measureVoltage(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
-  return std::stod(command("MON","VMON"));
+double DT54xxPs::measureVoltage(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
+    return std::stod(command("MON", "VMON"));
 }
 
-uint16_t DT54xxPs::status(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+uint16_t DT54xxPs::status(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return std::stoi(command("MON","STAT"))&0xFFFF;
+    return std::stoi(command("MON", "STAT")) & 0xFFFF;
 }
 
-std::string DT54xxPs::command(const std::string& cmd, const std::string& par, const std::string& value)
-{
-  // Build command
-  std::string tosend="$CMD:"+cmd+",PAR:"+par;
-  if(!value.empty())
-    tosend+=",VAL:"+value;
+std::string DT54xxPs::command(const std::string& cmd, const std::string& par,
+                              const std::string& value) {
+    // Build command
+    std::string tosend = "$CMD:" + cmd + ",PAR:" + par;
+    if (!value.empty()) tosend += ",VAL:" + value;
 
-  // Send command and receive response
-  std::string resp=m_com->sendreceive(tosend);
+    // Send command and receive response
+    std::string resp = m_com->sendreceive(tosend);
 
-  // Parse response
-  if(resp.empty())
-    throw "DT54xx: No response :(";
+    // Parse response
+    if (resp.empty()) throw "DT54xx: No response :(";
 
-  std::string retvalue;
-  std::string cmdvalue;
-  
-  std::string token;
-  std::stringstream ss(resp);
-  while(std::getline(ss, token, ','))
-    {
-      size_t seppos=token.find(':');
-      if(seppos==std::string::npos)
-	continue; // Not a valid part
-      if(token.substr(0,seppos)=="VAL")
-	{ // This is the value part!
-	  retvalue=token.substr(seppos+1);
-	}
-      else if(token.substr(0,seppos)=="#CMD")
-	{ // This is the value part!
-	  cmdvalue=token.substr(seppos+1);
-	}
+    std::string retvalue;
+    std::string cmdvalue;
+
+    std::string token;
+    std::stringstream ss(resp);
+    while (std::getline(ss, token, ',')) {
+        size_t seppos = token.find(':');
+        if (seppos == std::string::npos) continue;  // Not a valid part
+        if (token.substr(0, seppos) == "VAL") {     // This is the value part!
+            retvalue = token.substr(seppos + 1);
+        } else if (token.substr(0, seppos) ==
+                   "#CMD") {  // This is the value part!
+            cmdvalue = token.substr(seppos + 1);
+        }
     }
 
-  if(cmdvalue.empty())
-    throw "DT54xx: No CMD in return statement :(";
+    if (cmdvalue.empty()) throw "DT54xx: No CMD in return statement :(";
 
-  if(cmdvalue=="ERR")
-    throw "DT54xx:: CMD shows an error :(";
+    if (cmdvalue == "ERR") throw "DT54xx:: CMD shows an error :(";
 
-  return retvalue;
+    return retvalue;
 }
-
diff --git a/src/libPS/DT54xxPs.h b/src/libPS/DT54xxPs.h
index ed03f6b9..21467231 100644
--- a/src/libPS/DT54xxPs.h
+++ b/src/libPS/DT54xxPs.h
@@ -1,7 +1,6 @@
 #ifndef DT54XXPS_H
 #define DT54XXPS_H
 
-
 #include <chrono>
 #include <memory>
 #include <string>
@@ -15,122 +14,120 @@
  *
  * Assumes direct USB connection.
  */
-class DT54xxPs : public IPowerSupply
-{
-public:
-  /**
-   * Interpretation of status bits.
-   * The value is the bitmask to select the bit in status() return value.
-   */
-  enum Status
-    {
-      On         =(1<< 0), // 1 : ON 0 : OFF
-      RampingUp  =(1<< 1), // 1 : Channel Ramping UP
-      RampingDown=(1<< 2), // 1 : Channel Ramping DOWN
-      OVC        =(1<< 3), // 1 : Over current
-      OVV        =(1<< 4), // 1 : Over voltage
-      UNV        =(1<< 5), // 1 : Under voltage
-      MAXV       =(1<< 6), // 1 : VOUT in MAXV protection
-      Trip       =(1<< 7), // 1 : Current generator
-      OVT        =(1<< 8), // 1 : Over temperature
-      Disabled   =(1<<10), // 1 : Ch disabled
-      Kill       =(1<<11), // 1 : Ch in KILL
-      Interlock  =(1<<12), // 1 : Ch in INTERLOCK
-      CalError   =(1<<13)  // 1 : Calibration Error
+class DT54xxPs : public IPowerSupply {
+ public:
+    /**
+     * Interpretation of status bits.
+     * The value is the bitmask to select the bit in status() return value.
+     */
+    enum Status {
+        On = (1 << 0),           // 1 : ON 0 : OFF
+        RampingUp = (1 << 1),    // 1 : Channel Ramping UP
+        RampingDown = (1 << 2),  // 1 : Channel Ramping DOWN
+        OVC = (1 << 3),          // 1 : Over current
+        OVV = (1 << 4),          // 1 : Over voltage
+        UNV = (1 << 5),          // 1 : Under voltage
+        MAXV = (1 << 6),         // 1 : VOUT in MAXV protection
+        Trip = (1 << 7),         // 1 : Current generator
+        OVT = (1 << 8),          // 1 : Over temperature
+        Disabled = (1 << 10),    // 1 : Ch disabled
+        Kill = (1 << 11),        // 1 : Ch in KILL
+        Interlock = (1 << 12),   // 1 : Ch in INTERLOCK
+        CalError = (1 << 13)     // 1 : Calibration Error
     };
 
-  DT54xxPs(const std::string& name);
-  ~DT54xxPs() =default;
-
-  /** \name Communication
-   * @{
-   */
-
-  virtual bool ping();
-
-  virtual std::string identify();
-
-  /** @} */
-
-  /** \name Power Supply Control
-   * @{
-   */
-
-  virtual void reset();
-
-  /** \brief Turn on power supply
-   * 
-   * Block until power supply finishes ramping.
-   *
-   * @param channel channel, if any
-   */
-  virtual void turnOn(unsigned channel);
-
-  /** \brief Turn off power supply
-   *
-   * Block until power supply finishes rampdown.
-   * @param channel channel, if any
-   */
-  virtual void turnOff(unsigned channel);
-
-  /** @} */
-  
-  /** \name Current Control and Measurement
-   * @{
-   */
-
-  virtual void   setCurrentLevel(double cur, unsigned channel = 0);
-  virtual double getCurrentLevel(unsigned channel = 0);
-  virtual void   setCurrentProtect(double maxcur , unsigned channel = 0);
-  virtual double getCurrentProtect(unsigned channel = 0);  
-  virtual double measureCurrent(unsigned channel = 0);
-
-  /** @} */
-
-  /** \name Voltage Control and Measurement
-   * @{
-   */
-
-  virtual void   setVoltageLevel(double volt, unsigned channel = 0);
-  virtual double getVoltageLevel(unsigned channel = 0);
-  virtual void   setVoltageProtect(double maxvolt , unsigned channel = 0 );
-  virtual double getVoltageProtect(unsigned channel = 0);
-  virtual double measureVoltage(unsigned channel = 0);
-
-  /** @} */
-
-  /** \name Model-specific functionality
-   * @{
-   */
-
-  /**
-   * Return the status of the Power Supply.
-   * Use with Status enum to interpret bits.
-   *
-   * @param channel Channel to query
-   *
-   * @return status bits
-   */
-  uint16_t status(unsigned channel = 0);
-
-  /** @} */
-
-private:
-  /**
-   * Build a command string and parse the response
-   *
-   * Throws an exception if any of the following errors are detected:
-   * - no response 
-   * - returned CMD value is ERR
-   *
-   * \param cmd CMD value
-   * \param par PAR value
-   * \param value VAL value (if empty, not appended)
-   *
-   * \return The returned VAL value.
-   */
-  std::string command(const std::string& cmd, const std::string& par, const std::string& value="");
+    DT54xxPs(const std::string& name);
+    ~DT54xxPs() = default;
+
+    /** \name Communication
+     * @{
+     */
+
+    virtual bool ping();
+
+    virtual std::string identify();
+
+    /** @} */
+
+    /** \name Power Supply Control
+     * @{
+     */
+
+    virtual void reset();
+
+    /** \brief Turn on power supply
+     *
+     * Block until power supply finishes ramping.
+     *
+     * @param channel channel, if any
+     */
+    virtual void turnOn(unsigned channel);
+
+    /** \brief Turn off power supply
+     *
+     * Block until power supply finishes rampdown.
+     * @param channel channel, if any
+     */
+    virtual void turnOff(unsigned channel);
+
+    /** @} */
+
+    /** \name Current Control and Measurement
+     * @{
+     */
+
+    virtual void setCurrentLevel(double cur, unsigned channel = 0);
+    virtual double getCurrentLevel(unsigned channel = 0);
+    virtual void setCurrentProtect(double maxcur, unsigned channel = 0);
+    virtual double getCurrentProtect(unsigned channel = 0);
+    virtual double measureCurrent(unsigned channel = 0);
+
+    /** @} */
+
+    /** \name Voltage Control and Measurement
+     * @{
+     */
+
+    virtual void setVoltageLevel(double volt, unsigned channel = 0);
+    virtual double getVoltageLevel(unsigned channel = 0);
+    virtual void setVoltageProtect(double maxvolt, unsigned channel = 0);
+    virtual double getVoltageProtect(unsigned channel = 0);
+    virtual double measureVoltage(unsigned channel = 0);
+
+    /** @} */
+
+    /** \name Model-specific functionality
+     * @{
+     */
+
+    /**
+     * Return the status of the Power Supply.
+     * Use with Status enum to interpret bits.
+     *
+     * @param channel Channel to query
+     *
+     * @return status bits
+     */
+    uint16_t status(unsigned channel = 0);
+
+    /** @} */
+
+ private:
+    /**
+     * Build a command string and parse the response
+     *
+     * Throws an exception if any of the following errors are detected:
+     * - no response
+     * - returned CMD value is ERR
+     *
+     * \param cmd CMD value
+     * \param par PAR value
+     * \param value VAL value (if empty, not appended)
+     *
+     * \return The returned VAL value.
+     */
+    std::string command(const std::string& cmd, const std::string& par,
+                        const std::string& value = "");
 };
 
-#endif // DT54XXPS_H
-
+#endif  // DT54XXPS_H
diff --git a/src/libPS/IPowerSupply.cpp b/src/libPS/IPowerSupply.cpp
index 8e933466..724def9a 100644
--- a/src/libPS/IPowerSupply.cpp
+++ b/src/libPS/IPowerSupply.cpp
@@ -2,81 +2,67 @@
 
 #include <iostream>
 #include <stdexcept>
+
 #include "Logger.h"
 
-IPowerSupply::IPowerSupply(const std::string& name, std::vector<std::string> models)
-{
-  m_name = name;
-  m_models = models;
+IPowerSupply::IPowerSupply(const std::string& name,
+                           std::vector<std::string> models) {
+    m_name = name;
+    m_models = models;
 }
 
-void IPowerSupply::setCom(std::shared_ptr<ICom> com)
-{
-  if(!com->is_open())
-    com->init();
+void IPowerSupply::setCom(std::shared_ptr<ICom> com) {
+    if (!com->is_open()) com->init();
 
-  m_com = com;
-  if(!ping())
-    throw std::runtime_error("Failed communication with the PS");
+    m_com = com;
+    if (!ping()) throw std::runtime_error("Failed communication with the PS");
 }
 
-void IPowerSupply::setConfiguration(const nlohmann::json& config)
-{  
-  m_config = config;
+void IPowerSupply::setConfiguration(const nlohmann::json& config) {
+    m_config = config;
 }
 
-const nlohmann::json& IPowerSupply::getConfiguration() const
-{
-  return m_config;
+const nlohmann::json& IPowerSupply::getConfiguration() const {
+    return m_config;
 }
 
-void IPowerSupply::checkCompatibilityList()
-{
-  // get model connected to the PS
-  std::string idn = identify();
+void IPowerSupply::checkCompatibilityList() {
+    // get model connected to the PS
+    std::string idn = identify();
 
-  // get list of models
-  std::vector<std::string> models = IPowerSupply::getListOfModels();
+    // get list of models
+    std::vector<std::string> models = IPowerSupply::getListOfModels();
 
-  if (models.empty()){
-    logger(logINFO) << "No model identifier implemented for this power supply. No check is performed.";
-    return;
-  }
+    if (models.empty()) {
+        logger(logINFO) << "No model identifier implemented for this power "
+                           "supply. No check is performed.";
+        return;
+    }
 
-  for(const std::string& model : models)
-    {
-      if(idn.find(model) != std::string::npos)
-	return;
+    for (const std::string& model : models) {
+        if (idn.find(model) != std::string::npos) return;
     }
-  
-  logger(logERROR)<< "Unknown power supply: " << idn;
-  throw std::runtime_error("Unknown power supply: " + idn);
 
+    logger(logERROR) << "Unknown power supply: " << idn;
+    throw std::runtime_error("Unknown power supply: " + idn);
 }
 
-std::vector<std::string> IPowerSupply::getListOfModels()
-{
-  return m_models;
-}
+std::vector<std::string> IPowerSupply::getListOfModels() { return m_models; }
 
-void IPowerSupply::setCurrentProtect(double cur, unsigned channel)
-{
-  logger(logWARNING) << "setCurrentProtect() not implemented for this PS.";
+void IPowerSupply::setCurrentProtect(double cur, unsigned channel) {
+    logger(logWARNING) << "setCurrentProtect() not implemented for this PS.";
 }
 
-double IPowerSupply::getCurrentProtect(unsigned channel)
-{
-  logger(logWARNING) << "getCurrentProtect() not implemented for this PS.";
-  return 0;
+double IPowerSupply::getCurrentProtect(unsigned channel) {
+    logger(logWARNING) << "getCurrentProtect() not implemented for this PS.";
+    return 0;
 }
 
-void IPowerSupply::setVoltageProtect(double volt, unsigned channel)
-{
-  logger(logWARNING) << "setVoltageProtect() not implemented for this PS.";
+void IPowerSupply::setVoltageProtect(double volt, unsigned channel) {
+    logger(logWARNING) << "setVoltageProtect() not implemented for this PS.";
 }
 
-double IPowerSupply::getVoltageProtect(unsigned channel)
-{
-  logger(logWARNING) << "getVoltageProtect() not implemented for this PS.";
-  return 0;
+double IPowerSupply::getVoltageProtect(unsigned channel) {
+    logger(logWARNING) << "getVoltageProtect() not implemented for this PS.";
+    return 0;
 }
diff --git a/src/libPS/IPowerSupply.h b/src/libPS/IPowerSupply.h
index dd9f21fb..299fe3eb 100644
--- a/src/libPS/IPowerSupply.h
+++ b/src/libPS/IPowerSupply.h
@@ -1,8 +1,8 @@
 #ifndef IPOWERSUPPLY_H
 #define IPOWERSUPPLY_H
 
-#include <string>
 #include <nlohmann/json.hpp>
+#include <string>
 
 #include "ICom.h"
 
@@ -14,192 +14,191 @@
     functionality is not implemented.
 
     The hardware configuration is given via a json object and can be harware
-    specific. 
+    specific.
     A typical workflow would be:
       IPowerSupply *ps;
       ps->setConfiguration(specificPSConfigJSON);
       ps->setCom(...);
       ps->checkCompatibilityList();
       ps->turnOn();
-      ps->setVoltage(1.2, 1); //to change the voltage      
+      ps->setVoltage(1.2, 1); //to change the voltage
       //....
       ps->turnOff();
 
-    More commonly the power supply will be retrieved from the equipment registry, 
-    which will take care of its configuration and connection already, e.g.:
-      EquipConf hw(completeConfigJSON);
-      td::shared_ptr<IPowerSupply> PS = hw.getPowerSupply("PS");
-      ps->turnOn();       
-      ps->setVoltage(1.2, 1); //to change the voltage
+    More commonly the power supply will be retrieved from the equipment
+   registry, which will take care of its configuration and connection already,
+   e.g.: EquipConf hw(completeConfigJSON); td::shared_ptr<IPowerSupply> PS =
+   hw.getPowerSupply("PS"); ps->turnOn(); ps->setVoltage(1.2, 1); //to change
+   the voltage
       //....
       ps->turnOff();
  */
-class IPowerSupply
-{
-public:
-  /** Constructor. 
-   * Note: do NOT do any active command in the constructor. Only initialize local variables.
-   * @param name Name of the power supply
-   * @param models List of tested models (empty means no check is performed)
-   */
-  IPowerSupply(const std::string& name, std::vector<std::string> models={});
-
-  /** Set communication object
-   *
-   * The object is initialized if not already.
-   *
-   * Communication with the power supply is checked
-   * after setting the communication object. If the device does not
-   * respond to `ping()`, an exception is thrown.
-   *
-   * \param com ICom instance for communicating with the power supply
-   */
-  void setCom(std::shared_ptr<ICom> com);
-
-  /** Store JSON hardware configuration 
-   * @param config JSON configuration for the given power supply only
-   */
-  virtual void setConfiguration(const nlohmann::json& config);
-
-  /** Retrieve hardware configuration 
-      @return hardware JSON configuration
-  */
-  const nlohmann::json& getConfiguration() const;
-
-  /** \name Communication
-   * @{
-   */
-
-  /** \brief Check if power-supply responds
-   *
-   * Send a message to the power suppy that does not
-   * change the internal state to check if communicaton
-   * is working.
-   *
-   * \return True if communication works, false otherwise
-   */
-  virtual bool ping() =0;
-
-  /*
-   * Check that the device model is supported by checking that 
-   * model identifier of the connected power supply contains 
-   * one of the supported models for that power supply
-   * Throws exception if compatibility is not found
-   * If the list of model identifiers is empty, no check is performed
-   */
-  virtual void checkCompatibilityList();
-
-  /** @} */
-
-  /** \name Power Supply Control
-   * @{
-   */
-
-  /** \brief Execute reset of the device  */
-  virtual void reset() = 0 ;  
-  
-  /** Return list of supported models. **/
-  virtual std::vector<std::string> getListOfModels();
-
-  /** Returns the model of the power supply connected. 
-   * PS classes should return an empty string if this functionality does not exist
-   **/
-  virtual std::string identify() = 0;
-
-  /** Turn on power supply. 
-   * @param channel channel, if any
-   */
-  virtual void turnOn(unsigned channel = 0) = 0;
-
-  /** \brief Turn off power supply
-   * @param channel channel, if any
-   */
-  virtual void turnOff(unsigned channel = 0) = 0;
-
-  /** @} */
-  
-  /** \name Current Control and Measurement
-   * @{
-   */
-
-  /** \brief Set current of PS
-   * @param cur current [A]
-   * @param channel channel (if any)
-   */
-  virtual void setCurrentLevel(double cur, unsigned channel = 0) = 0;
-
-  /** \brief Get set current of PS
-   * @param channel channel (if any)
-   * @return current, convert to [A]
-   */
-  virtual double getCurrentLevel(unsigned channel = 0) = 0;  
-
-  /** \brief Set current protection [optional]
-   * @param cur maximum current [A]
-   * @param channel channel (if any)
-   */
-  virtual void setCurrentProtect(double cur, unsigned channel = 0);
-
-  /** \brief Get current protection [optional]
-   * @param channel channel (if any)
-   * @return current, convert to [A]
-   */
-  virtual double getCurrentProtect(unsigned channel = 0);
-
-  /** \brief Get measured current
-   * @param channel channel (if any)
-   */
-  virtual double measureCurrent(unsigned channel = 0) = 0;
-
-  /** @} */
-
-  /** \name Voltage Control and Measurement
-   * @{
-   */
-  
-  /** \brief Set voltage of PS
-   * @param volt voltage [V]
-   * @param channel channel (if any)
-   */
-  virtual void setVoltageLevel(double volt, unsigned channel = 0) = 0;
-
-  /** \brief Get set voltage of PS.
-   * @param channel channel (if any)
-   * @return voltage, convert to [V]
-   */
-  virtual double getVoltageLevel(unsigned channel = 0) = 0;  
-
-  /** \brief Set voltage protection
-   * @param volt maximum current [A]
-   * @param channel channel (if any)
-   */
-  virtual void setVoltageProtect(double volt, unsigned channel = 0);
-
-  /** \brief Get voltage protection [optional]
-   * @param channel channel (if any)
-   * @return voltage, convert to [V]
-   */
-  virtual double getVoltageProtect(unsigned channel = 0);
-
-  /** \brief Get measured voltage 
-   * @param channel channel (if any)
-   */
-  virtual double measureVoltage(unsigned channel = 0) = 0;
-
-  /** @} */
+class IPowerSupply {
+ public:
+    /** Constructor.
+     * Note: do NOT do any active command in the constructor. Only initialize
+     * local variables.
+     * @param name Name of the power supply
+     * @param models List of tested models (empty means no check is performed)
+     */
+    IPowerSupply(const std::string& name, std::vector<std::string> models = {});
+
+    /** Set communication object
+     *
+     * The object is initialized if not already.
+     *
+     * Communication with the power supply is checked
+     * after setting the communication object. If the device does not
+     * respond to `ping()`, an exception is thrown.
+     *
+     * \param com ICom instance for communicating with the power supply
+     */
+    void setCom(std::shared_ptr<ICom> com);
+
+    /** Store JSON hardware configuration
+     * @param config JSON configuration for the given power supply only
+     */
+    virtual void setConfiguration(const nlohmann::json& config);
+
+    /** Retrieve hardware configuration
+        @return hardware JSON configuration
+    */
+    const nlohmann::json& getConfiguration() const;
+
+    /** \name Communication
+     * @{
+     */
+
+    /** \brief Check if power-supply responds
+     *
+     * Send a message to the power suppy that does not
+     * change the internal state to check if communicaton
+     * is working.
+     *
+     * \return True if communication works, false otherwise
+     */
+    virtual bool ping() = 0;
+
+    /*
+     * Check that the device model is supported by checking that
+     * model identifier of the connected power supply contains
+     * one of the supported models for that power supply
+     * Throws exception if compatibility is not found
+     * If the list of model identifiers is empty, no check is performed
+     */
+    virtual void checkCompatibilityList();
+
+    /** @} */
+
+    /** \name Power Supply Control
+     * @{
+     */
+
+    /** \brief Execute reset of the device  */
+    virtual void reset() = 0;
+
+    /** Return list of supported models. **/
+    virtual std::vector<std::string> getListOfModels();
+
+    /** Returns the model of the power supply connected.
+     * PS classes should return an empty string if this functionality does not
+     *exist
+     **/
+    virtual std::string identify() = 0;
+
+    /** Turn on power supply.
+     * @param channel channel, if any
+     */
+    virtual void turnOn(unsigned channel = 0) = 0;
+
+    /** \brief Turn off power supply
+     * @param channel channel, if any
+     */
+    virtual void turnOff(unsigned channel = 0) = 0;
+
+    /** @} */
+
+    /** \name Current Control and Measurement
+     * @{
+     */
+
+    /** \brief Set current of PS
+     * @param cur current [A]
+     * @param channel channel (if any)
+     */
+    virtual void setCurrentLevel(double cur, unsigned channel = 0) = 0;
+
+    /** \brief Get set current of PS
+     * @param channel channel (if any)
+     * @return current, convert to [A]
+     */
+    virtual double getCurrentLevel(unsigned channel = 0) = 0;
+
+    /** \brief Set current protection [optional]
+     * @param cur maximum current [A]
+     * @param channel channel (if any)
+     */
+    virtual void setCurrentProtect(double cur, unsigned channel = 0);
+
+    /** \brief Get current protection [optional]
+     * @param channel channel (if any)
+     * @return current, convert to [A]
+     */
+    virtual double getCurrentProtect(unsigned channel = 0);
+
+    /** \brief Get measured current
+     * @param channel channel (if any)
+     */
+    virtual double measureCurrent(unsigned channel = 0) = 0;
+
+    /** @} */
+
+    /** \name Voltage Control and Measurement
+     * @{
+     */
+
+    /** \brief Set voltage of PS
+     * @param volt voltage [V]
+     * @param channel channel (if any)
+     */
+    virtual void setVoltageLevel(double volt, unsigned channel = 0) = 0;
+
+    /** \brief Get set voltage of PS.
+     * @param channel channel (if any)
+     * @return voltage, convert to [V]
+     */
+    virtual double getVoltageLevel(unsigned channel = 0) = 0;
+
+    /** \brief Set voltage protection
+     * @param volt maximum current [A]
+     * @param channel channel (if any)
+     */
+    virtual void setVoltageProtect(double volt, unsigned channel = 0);
+
+    /** \brief Get voltage protection [optional]
+     * @param channel channel (if any)
+     * @return voltage, convert to [V]
+     */
+    virtual double getVoltageProtect(unsigned channel = 0);
+
+    /** \brief Get measured voltage
+     * @param channel channel (if any)
+     */
+    virtual double measureVoltage(unsigned channel = 0) = 0;
+
+    /** @} */
 
  protected:
-  /** Communication */
-  std::shared_ptr<ICom> m_com = nullptr;
-  
-  /** Store device configuration. */
-  nlohmann::json m_config;
+    /** Communication */
+    std::shared_ptr<ICom> m_com = nullptr;
 
-  /** Store device configuration name */
-  std::string m_name;
+    /** Store device configuration. */
+    nlohmann::json m_config;
 
-  std::vector<std::string> m_models;
+    /** Store device configuration name */
+    std::string m_name;
 
+    std::vector<std::string> m_models;
 };
 
 #endif
diff --git a/src/libPS/Keithley22XX.cpp b/src/libPS/Keithley22XX.cpp
index 7c3998e7..bd4d0c48 100644
--- a/src/libPS/Keithley22XX.cpp
+++ b/src/libPS/Keithley22XX.cpp
@@ -5,159 +5,140 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(Keithley22XX)
 
-Keithley22XX::Keithley22XX(const std::string& name) :
-IPowerSupply(name, {"2231A"})
-{ }
+Keithley22XX::Keithley22XX(const std::string& name)
+    : IPowerSupply(name, {"2231A"}) {}
 
-bool Keithley22XX::ping()
-{
-  std::string result = m_com->sendreceive("*IDN?");
-  return !result.empty();
+bool Keithley22XX::ping() {
+    std::string result = m_com->sendreceive("*IDN?");
+    return !result.empty();
 }
 
-void Keithley22XX::reset()
-{
-  m_com->send("OUTP:ALL 0");
-  m_com->send("*RST");
+void Keithley22XX::reset() {
+    m_com->send("OUTP:ALL 0");
+    m_com->send("*RST");
 
-  if(!ping())
-    throw std::runtime_error("No communication after reset.");
+    if (!ping()) throw std::runtime_error("No communication after reset.");
 }
 
-std::string Keithley22XX::identify()
-{
-  std::string idn=m_com->sendreceive("*IDN?");
-  return idn;
+std::string Keithley22XX::identify() {
+    std::string idn = m_com->sendreceive("*IDN?");
+    return idn;
 }
 
-void Keithley22XX::turnOn(unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void Keithley22XX::turnOn(unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  m_com->send("CHAN:OUTP 1");
+    m_com->send("INST CH" + std::to_string(channel));
+    m_com->send("CHAN:OUTP 1");
 }
 
-void Keithley22XX::turnOff(unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void Keithley22XX::turnOff(unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  m_com->send("CHAN:OUTP 0");
+    m_com->send("INST CH" + std::to_string(channel));
+    m_com->send("CHAN:OUTP 0");
 }
 
-bool Keithley22XX::isOn(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+bool Keithley22XX::isOn(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return m_com->sendreceive(":OUTPUT?")=="1";
+    return m_com->sendreceive(":OUTPUT?") == "1";
 }
 
-void Keithley22XX::setCurrentLevel(double cur, unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void Keithley22XX::setCurrentLevel(double cur, unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  m_com->send(":SOURCE:FUNC CURR");
-  m_com->send(":SOURCE:CURR " + std::to_string(cur));
+    m_com->send("INST CH" + std::to_string(channel));
+    m_com->send(":SOURCE:FUNC CURR");
+    m_com->send(":SOURCE:CURR " + std::to_string(cur));
 }
 
-double Keithley22XX::getCurrentLevel(unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double Keithley22XX::getCurrentLevel(unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  return std::stod(m_com->sendreceive(":SOURCE:CURR?"));
+    m_com->send("INST CH" + std::to_string(channel));
+    return std::stod(m_com->sendreceive(":SOURCE:CURR?"));
 }
 
-void Keithley22XX::setCurrentProtect(double maxcur, unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void Keithley22XX::setCurrentProtect(double maxcur, unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  m_com->send(":SENSE:CURR:PROTECTION " + std::to_string(maxcur));
+    m_com->send("INST CH" + std::to_string(channel));
+    m_com->send(":SENSE:CURR:PROTECTION " + std::to_string(maxcur));
 }
 
-double Keithley22XX::getCurrentProtect(unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double Keithley22XX::getCurrentProtect(unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  return std::stod(m_com->sendreceive(":SENSE:CURR:PROTECTION?"));
+    m_com->send("INST CH" + std::to_string(channel));
+    return std::stod(m_com->sendreceive(":SENSE:CURR:PROTECTION?"));
 }
 
-double Keithley22XX::measureCurrent(unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double Keithley22XX::measureCurrent(unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  if(!isOn(channel))
-    return 0.;
-  
-  m_com->send(":FORMAT:ELEMENTS CURR");
-  m_com->send("INST CH" + std::to_string(channel));
-  
-  return std::stod(m_com->sendreceive(":READ?"));
+    if (!isOn(channel)) return 0.;
+
+    m_com->send(":FORMAT:ELEMENTS CURR");
+    m_com->send("INST CH" + std::to_string(channel));
+
+    return std::stod(m_com->sendreceive(":READ?"));
 }
 
-void Keithley22XX::setVoltageLevel(double volt, unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void Keithley22XX::setVoltageLevel(double volt, unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  m_com->send(":SOURCE:FUNC VOLT");
-  m_com->send(":SOURCE:VOLT " + std::to_string(volt));
+    m_com->send("INST CH" + std::to_string(channel));
+    m_com->send(":SOURCE:FUNC VOLT");
+    m_com->send(":SOURCE:VOLT " + std::to_string(volt));
 }
 
-double Keithley22XX::getVoltageLevel(unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double Keithley22XX::getVoltageLevel(unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  return std::stod(m_com->sendreceive(":SOURCE:VOLT?"));
+    m_com->send("INST CH" + std::to_string(channel));
+    return std::stod(m_com->sendreceive(":SOURCE:VOLT?"));
 }
 
-void Keithley22XX::setVoltageProtect(double maxvolt, unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void Keithley22XX::setVoltageProtect(double maxvolt, unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  m_com->send(":SENSE:VOLT:PROTECTION " + std::to_string(maxvolt));
+    m_com->send("INST CH" + std::to_string(channel));
+    m_com->send(":SENSE:VOLT:PROTECTION " + std::to_string(maxvolt));
 }
 
-double Keithley22XX::getVoltageProtect(unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double Keithley22XX::getVoltageProtect(unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("INST CH" + std::to_string(channel));
-  return std::stod(m_com->sendreceive(":SENSE:VOLT:PROTECTION?"));
+    m_com->send("INST CH" + std::to_string(channel));
+    return std::stod(m_com->sendreceive(":SENSE:VOLT:PROTECTION?"));
 }
 
-double Keithley22XX::measureVoltage(unsigned channel)
-{
-  if(channel!=1 && channel!=2 && channel!=3)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double Keithley22XX::measureVoltage(unsigned channel) {
+    if (channel != 1 && channel != 2 && channel != 3)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  if(!isOn(channel))
-    return 0.;
+    if (!isOn(channel)) return 0.;
 
-  m_com->send(":FORMAT:ELEMENTS VOLT");
-  m_com->send("INST CH" + std::to_string(channel));
+    m_com->send(":FORMAT:ELEMENTS VOLT");
+    m_com->send("INST CH" + std::to_string(channel));
 
-  return std::stod(m_com->sendreceive(":READ?"));
+    return std::stod(m_com->sendreceive(":READ?"));
 }
-
diff --git a/src/libPS/Keithley22XX.h b/src/libPS/Keithley22XX.h
index f22d34c3..eebaa5fd 100644
--- a/src/libPS/Keithley22XX.h
+++ b/src/libPS/Keithley22XX.h
@@ -6,71 +6,69 @@
 #include <string>
 
 #include "IPowerSupply.h"
-
 #include "SerialCom.h"
 
 /** \brief Keithley 22xx
  *
  * Implementation for the Keithley 2231A power supply.
  *
- * [Programming Manual](https://download.tek.com/manual/077100401_Referencemanual.pdf)
+ * [Programming
+ * Manual](https://download.tek.com/manual/077100401_Referencemanual.pdf)
  *
  * Other Keithley 22xx power supplies might be supported too, but have
  * not been checked.
  *
  * WARNING: 2231 has not been tested either.
  */
-class Keithley22XX : public IPowerSupply
-{
-public:
-  Keithley22XX(const std::string& name);
-  ~Keithley22XX() =default;
+class Keithley22XX : public IPowerSupply {
+ public:
+    Keithley22XX(const std::string& name);
+    ~Keithley22XX() = default;
+
+    /** \name Communication
+     * @{
+     */
 
-  /** \name Communication
-   * @{
-   */
+    virtual bool ping();
 
-  virtual bool ping();
+    virtual std::string identify();
 
-  virtual std::string identify();
+    /** @} */
 
-  /** @} */
+    /** \name Power Supply Control
+     * @{
+     */
 
-  /** \name Power Supply Control
-   * @{
-   */
+    virtual void reset();
+    virtual void turnOn(unsigned channel);
+    virtual void turnOff(unsigned channel);
+    virtual bool isOn(unsigned channel);
 
-  virtual void reset();
-  virtual void turnOn(unsigned channel);
-  virtual void turnOff(unsigned channel);
-  virtual bool isOn(unsigned channel);
+    /** @} */
 
-  /** @} */
-  
-  /** \name Current Control and Measurement
-   * @{
-   */
+    /** \name Current Control and Measurement
+     * @{
+     */
 
-  virtual void   setCurrentLevel(double cur, unsigned channel = 0);
-  virtual double getCurrentLevel(unsigned channel = 0);
-  virtual void   setCurrentProtect(double maxcur , unsigned channel = 0);
-  virtual double getCurrentProtect(unsigned channel = 0);  
-  virtual double measureCurrent(unsigned channel = 0);
+    virtual void setCurrentLevel(double cur, unsigned channel = 0);
+    virtual double getCurrentLevel(unsigned channel = 0);
+    virtual void setCurrentProtect(double maxcur, unsigned channel = 0);
+    virtual double getCurrentProtect(unsigned channel = 0);
+    virtual double measureCurrent(unsigned channel = 0);
 
-  /** @} */
+    /** @} */
 
-  /** \name Voltage Control and Measurement
-   * @{
-   */
+    /** \name Voltage Control and Measurement
+     * @{
+     */
 
-  virtual void   setVoltageLevel(double volt, unsigned channel = 0);
-  virtual double getVoltageLevel(unsigned channel = 0);
-  virtual void   setVoltageProtect(double maxvolt , unsigned channel = 0 );
-  virtual double getVoltageProtect(unsigned channel = 0);
-  virtual double measureVoltage(unsigned channel = 0);
+    virtual void setVoltageLevel(double volt, unsigned channel = 0);
+    virtual double getVoltageLevel(unsigned channel = 0);
+    virtual void setVoltageProtect(double maxvolt, unsigned channel = 0);
+    virtual double getVoltageProtect(unsigned channel = 0);
+    virtual double measureVoltage(unsigned channel = 0);
 
-  /** @} */
+    /** @} */
 };
 
 #endif
-
diff --git a/src/libPS/Keithley24XX.cpp b/src/libPS/Keithley24XX.cpp
index 71fea455..f3d67dac 100644
--- a/src/libPS/Keithley24XX.cpp
+++ b/src/libPS/Keithley24XX.cpp
@@ -5,136 +5,141 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(Keithley24XX)
 
-Keithley24XX::Keithley24XX(const std::string& name) :
-IPowerSupply(name, {"2410","2400"})
-{ }
+Keithley24XX::Keithley24XX(const std::string& name)
+    : IPowerSupply(name, {"2410", "2400"}) {}
 
-bool Keithley24XX::ping()
-{
-  std::string result = m_com->sendreceive("*IDN?");
-  return !result.empty();
+bool Keithley24XX::ping() {
+    std::string result = m_com->sendreceive("*IDN?");
+    return !result.empty();
 }
 
-void Keithley24XX::reset()
-{
-  m_com->send("OUTPUT OFF");
-  m_com->send("*RST");
-  m_com->send(":TRIGGER:COUNT 1");
-  m_com->send(":FORMAT:ELEMENTS TIME,VOLT,CURR");
-  m_com->send(":SYST:BEEP:STAT OFF");//disable beep
+void Keithley24XX::reset() {
+    m_com->send("OUTPUT OFF");
+    m_com->send("*RST");
+    m_com->send(":TRIGGER:COUNT 1");
+    m_com->send(":FORMAT:ELEMENTS TIME,VOLT,CURR");
+    m_com->send(":SYST:BEEP:STAT OFF");  // disable beep
 
-  if(!ping())
-    throw std::runtime_error("No communication after reset.");
+    if (!ping()) throw std::runtime_error("No communication after reset.");
 }
 
-void Keithley24XX::turnOn(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void Keithley24XX::turnOn(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  m_com->send("OUTPUT ON");
+    m_com->send("OUTPUT ON");
 }
 
-void Keithley24XX::turnOff(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void Keithley24XX::turnOff(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  m_com->send("OUTPUT OFF");
+    m_com->send("OUTPUT OFF");
 }
 
-bool Keithley24XX::isOn(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+bool Keithley24XX::isOn(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return m_com->sendreceive(":OUTPUT?")=="1";
+    return m_com->sendreceive(":OUTPUT?") == "1";
 }
 
-std::string Keithley24XX::identify()
-{
-  std::string idn=m_com->sendreceive("*IDN?");
-  return idn;
+std::string Keithley24XX::identify() {
+    std::string idn = m_com->sendreceive("*IDN?");
+    return idn;
 }
 
-void Keithley24XX::setCurrentLevel(double cur, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void Keithley24XX::setCurrentLevel(double cur, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  m_com->send(":SOURCE:FUNC CURR");
-  m_com->send(":SOURCE:CURR " + to_string_with_precision(cur));  
+    m_com->send(":SOURCE:FUNC CURR");
+    m_com->send(":SOURCE:CURR " + to_string_with_precision(cur));
 }
 
-double Keithley24XX::getCurrentLevel(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Keithley24XX::getCurrentLevel(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return std::stod(m_com->sendreceive(":SOURCE:CURR?"));
+    return std::stod(m_com->sendreceive(":SOURCE:CURR?"));
 }
 
-void Keithley24XX::setCurrentProtect(double maxcur, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void Keithley24XX::setCurrentProtect(double maxcur, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  m_com->send(":SENSE:CURR:PROTECTION " + std::to_string(maxcur));
+    m_com->send(":SENSE:CURR:PROTECTION " + std::to_string(maxcur));
 }
 
-double Keithley24XX::getCurrentProtect(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Keithley24XX::getCurrentProtect(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return std::stod(m_com->sendreceive(":SENSE:CURR:PROTECTION?"));
+    return std::stod(m_com->sendreceive(":SENSE:CURR:PROTECTION?"));
 }
 
-double Keithley24XX::measureCurrent(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Keithley24XX::measureCurrent(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  if(!isOn(channel))
-    return 0.;
+    if (!isOn(channel)) return 0.;
 
-  m_com->send(":FORMAT:ELEMENTS CURR");
-  return std::stod(m_com->sendreceive(":READ?"));
+    m_com->send(":FORMAT:ELEMENTS CURR");
+    return std::stod(m_com->sendreceive(":READ?"));
 }
 
-void Keithley24XX::setVoltageLevel(double volt, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void Keithley24XX::setVoltageLevel(double volt, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  m_com->send(":SOURCE:FUNC VOLT");
-  m_com->send(":SOURCE:VOLT " + to_string_with_precision(volt));
+    m_com->send(":SOURCE:FUNC VOLT");
+    m_com->send(":SOURCE:VOLT " + to_string_with_precision(volt));
 }
 
-double Keithley24XX::getVoltageLevel(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Keithley24XX::getVoltageLevel(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return std::stod(m_com->sendreceive(":SOURCE:VOLT?"));
+    return std::stod(m_com->sendreceive(":SOURCE:VOLT?"));
 }
 
-void Keithley24XX::setVoltageProtect(double maxvolt, unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+void Keithley24XX::setVoltageProtect(double maxvolt, unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  m_com->send(":SENSE:VOLT:PROTECTION " + std::to_string(maxvolt));
+    m_com->send(":SENSE:VOLT:PROTECTION " + std::to_string(maxvolt));
 }
 
-double Keithley24XX::getVoltageProtect(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Keithley24XX::getVoltageProtect(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  return std::stod(m_com->sendreceive(":SENSE:VOLT:PROTECTION?"));
+    return std::stod(m_com->sendreceive(":SENSE:VOLT:PROTECTION?"));
 }
 
-double Keithley24XX::measureVoltage(unsigned channel)
-{
-  if (channel != 1) throw std::runtime_error("Set the channel to 1 for single channel power-supply");
+double Keithley24XX::measureVoltage(unsigned channel) {
+    if (channel != 1)
+        throw std::runtime_error(
+            "Set the channel to 1 for single channel power-supply");
 
-  if(!isOn(channel))
-    return 0.;
+    if (!isOn(channel)) return 0.;
 
-  m_com->send(":FORMAT:ELEMENTS VOLT");
-  return std::stod(m_com->sendreceive(":READ?"));
+    m_com->send(":FORMAT:ELEMENTS VOLT");
+    return std::stod(m_com->sendreceive(":READ?"));
 }
-
diff --git a/src/libPS/Keithley24XX.h b/src/libPS/Keithley24XX.h
index 73f0419e..e3d2fc65 100644
--- a/src/libPS/Keithley24XX.h
+++ b/src/libPS/Keithley24XX.h
@@ -4,90 +4,87 @@
 #include <chrono>
 #include <iomanip>
 #include <memory>
-#include <string>
 #include <sstream>
+#include <string>
 
 #include "IPowerSupply.h"
-
 #include "SerialCom.h"
 
 /** \brief Keithley 24xx
  *
  * Implementation for the Keithley 2410 power supply.
  *
- * [Programming Manual](https://download.tek.com/manual/2400S-900-01_K-Sep2011_User.pdf)
+ * [Programming
+ * Manual](https://download.tek.com/manual/2400S-900-01_K-Sep2011_User.pdf)
  *
  * Other Keithley 24xx power supplies might be supported too, but have
  * not been checked.
  */
-class Keithley24XX : public IPowerSupply
-{
-public:
-  Keithley24XX(const std::string& name);
-  ~Keithley24XX() =default;
-
-  /** \name Communication
-   * @{
-   */
-
-  virtual bool ping();
-
-  virtual std::string identify();
-
-  /** @} */
-
-  /** \name Power Supply Control
-   * @{
-   */
-
-  virtual void reset();
-  virtual void turnOn(unsigned channel);
-  virtual void turnOff(unsigned channel);
-  virtual bool isOn(unsigned channel);
-
-  /** @} */
-  
-  /** \name Current Control and Measurement
-   * @{
-   */
-
-  virtual void   setCurrentLevel(double cur, unsigned channel = 0);
-  virtual double getCurrentLevel(unsigned channel = 0);
-  virtual void   setCurrentProtect(double maxcur , unsigned channel = 0);
-  virtual double getCurrentProtect(unsigned channel = 0);  
-  virtual double measureCurrent(unsigned channel = 0);
-
-  /** @} */
-
-  /** \name Voltage Control and Measurement
-   * @{
-   */
-
-  virtual void   setVoltageLevel(double volt, unsigned channel = 0);
-  virtual double getVoltageLevel(unsigned channel = 0);
-  virtual void   setVoltageProtect(double maxvolt , unsigned channel = 0 );
-  virtual double getVoltageProtect(unsigned channel = 0);
-  virtual double measureVoltage(unsigned channel = 0);
-
-  /** @} */
-
-private:
-  /**
-   * Convert number to scientific notation
-   *
-   * \param a_value number to convert
-   * \param n number of digitcs after the decimal
-   *
-   * \return x.xxxxxxEyy
-   */
-  template <typename T>
-  std::string to_string_with_precision(const T a_value, const int n = 6)
-  {
-    std::ostringstream out;
-    out << std::setprecision(n) << a_value;
-    return out.str();
-  }
+class Keithley24XX : public IPowerSupply {
+ public:
+    Keithley24XX(const std::string& name);
+    ~Keithley24XX() = default;
+
+    /** \name Communication
+     * @{
+     */
+
+    virtual bool ping();
+
+    virtual std::string identify();
+
+    /** @} */
+
+    /** \name Power Supply Control
+     * @{
+     */
+
+    virtual void reset();
+    virtual void turnOn(unsigned channel);
+    virtual void turnOff(unsigned channel);
+    virtual bool isOn(unsigned channel);
+
+    /** @} */
+
+    /** \name Current Control and Measurement
+     * @{
+     */
+
+    virtual void setCurrentLevel(double cur, unsigned channel = 0);
+    virtual double getCurrentLevel(unsigned channel = 0);
+    virtual void setCurrentProtect(double maxcur, unsigned channel = 0);
+    virtual double getCurrentProtect(unsigned channel = 0);
+    virtual double measureCurrent(unsigned channel = 0);
+
+    /** @} */
+
+    /** \name Voltage Control and Measurement
+     * @{
+     */
+
+    virtual void setVoltageLevel(double volt, unsigned channel = 0);
+    virtual double getVoltageLevel(unsigned channel = 0);
+    virtual void setVoltageProtect(double maxvolt, unsigned channel = 0);
+    virtual double getVoltageProtect(unsigned channel = 0);
+    virtual double measureVoltage(unsigned channel = 0);
+
+    /** @} */
+
+ private:
+    /**
+     * Convert number to scientific notation
+     *
+     * \param a_value number to convert
+     * \param n number of digitcs after the decimal
+     *
+     * \return x.xxxxxxEyy
+     */
+    template <typename T>
+    std::string to_string_with_precision(const T a_value, const int n = 6) {
+        std::ostringstream out;
+        out << std::setprecision(n) << a_value;
+        return out.str();
+    }
 };
 
 #endif
-
diff --git a/src/libPS/PowerSupplyChannel.cpp b/src/libPS/PowerSupplyChannel.cpp
index 61b69607..10af3524 100644
--- a/src/libPS/PowerSupplyChannel.cpp
+++ b/src/libPS/PowerSupplyChannel.cpp
@@ -2,83 +2,80 @@
 
 #include "Logger.h"
 
-PowerSupplyChannel::PowerSupplyChannel(const std::string& name, std::shared_ptr<IPowerSupply> ps, unsigned channel)
-  : m_name(name), m_ps(ps), m_channel(channel)
-{ }
-
-std::string PowerSupplyChannel::getName() const
-{ return m_name; }
-
-std::shared_ptr<IPowerSupply> PowerSupplyChannel::getPowerSupply() const
-{ return m_ps; }
-
-unsigned PowerSupplyChannel::getChannel() const
-{ return m_channel; }
-
-void PowerSupplyChannel::setProgram(const nlohmann::json& settings)
-{ m_program=settings; }
-
-void PowerSupplyChannel::program()
-{
-  for (const auto &cmd : m_program.items())
-    {
-      if (cmd.key()=="maxvoltage")
-	{
-	  setVoltageProtect(cmd.value());
-	}
-      else if (cmd.key()=="maxcurrent")
-	{
-	  setCurrentProtect(cmd.value());
-	}
-      else if (cmd.key()=="voltage")
-	{
-	  setVoltageLevel(cmd.value());
-	}
-      else if (cmd.key()=="current")
-	{
-	  setCurrentLevel(cmd.value());
-	}
-      else
-	{
-	  logger(logWARNING) << "Unknow program option "<<cmd.key()<<" " <<cmd.value();
-	}	     
+PowerSupplyChannel::PowerSupplyChannel(const std::string& name,
+                                       std::shared_ptr<IPowerSupply> ps,
+                                       unsigned channel)
+    : m_name(name), m_ps(ps), m_channel(channel) {}
+
+std::string PowerSupplyChannel::getName() const { return m_name; }
+
+std::shared_ptr<IPowerSupply> PowerSupplyChannel::getPowerSupply() const {
+    return m_ps;
+}
+
+unsigned PowerSupplyChannel::getChannel() const { return m_channel; }
+
+void PowerSupplyChannel::setProgram(const nlohmann::json& settings) {
+    m_program = settings;
+}
+
+void PowerSupplyChannel::program() {
+    for (const auto& cmd : m_program.items()) {
+        if (cmd.key() == "maxvoltage") {
+            setVoltageProtect(cmd.value());
+        } else if (cmd.key() == "maxcurrent") {
+            setCurrentProtect(cmd.value());
+        } else if (cmd.key() == "voltage") {
+            setVoltageLevel(cmd.value());
+        } else if (cmd.key() == "current") {
+            setCurrentLevel(cmd.value());
+        } else {
+            logger(logWARNING)
+                << "Unknow program option " << cmd.key() << " " << cmd.value();
+        }
     }
 }
 
+void PowerSupplyChannel::turnOn() { m_ps->turnOn(m_channel); }
 
-  
-void PowerSupplyChannel::turnOn()
-{ m_ps->turnOn(m_channel); }
+void PowerSupplyChannel::turnOff() { m_ps->turnOff(m_channel); }
 
-void PowerSupplyChannel::turnOff()
-{ m_ps->turnOff(m_channel); }
+void PowerSupplyChannel::setCurrentLevel(double cur) {
+    m_ps->setCurrentLevel(cur, m_channel);
+}
 
-void PowerSupplyChannel::setCurrentLevel(double cur)
-{ m_ps->setCurrentLevel(cur, m_channel); }  
+double PowerSupplyChannel::getCurrentLevel() {
+    return m_ps->getCurrentLevel(m_channel);
+}
 
-double PowerSupplyChannel::getCurrentLevel()
-{ return m_ps->getCurrentLevel(m_channel); }  
+void PowerSupplyChannel::setCurrentProtect(double cur) {
+    m_ps->setCurrentProtect(cur, m_channel);
+}
 
-void PowerSupplyChannel::setCurrentProtect(double cur)
-{ m_ps->setCurrentProtect(cur, m_channel); }
+double PowerSupplyChannel::getCurrentProtect() {
+    return m_ps->getCurrentProtect(m_channel);
+}
 
-double PowerSupplyChannel::getCurrentProtect()
-{ return m_ps->getCurrentProtect(m_channel); }
+double PowerSupplyChannel::measureCurrent() {
+    return m_ps->measureCurrent(m_channel);
+}
 
-double PowerSupplyChannel::measureCurrent()
-{ return m_ps->measureCurrent(m_channel); }
- 
-void PowerSupplyChannel::setVoltageLevel(double volt)
-{ m_ps->setVoltageLevel(volt, m_channel); }
+void PowerSupplyChannel::setVoltageLevel(double volt) {
+    m_ps->setVoltageLevel(volt, m_channel);
+}
 
-double PowerSupplyChannel::getVoltageLevel()
-{ return m_ps->getVoltageLevel(m_channel); }
+double PowerSupplyChannel::getVoltageLevel() {
+    return m_ps->getVoltageLevel(m_channel);
+}
 
-void PowerSupplyChannel::setVoltageProtect(double volt)
-{ m_ps->setVoltageProtect(volt, m_channel); }
+void PowerSupplyChannel::setVoltageProtect(double volt) {
+    m_ps->setVoltageProtect(volt, m_channel);
+}
 
-double PowerSupplyChannel::getVoltageProtect()
-{ return m_ps->getVoltageProtect(m_channel); }
+double PowerSupplyChannel::getVoltageProtect() {
+    return m_ps->getVoltageProtect(m_channel);
+}
 
-double PowerSupplyChannel::measureVoltage()
-{ return m_ps->measureVoltage(m_channel); }
+double PowerSupplyChannel::measureVoltage() {
+    return m_ps->measureVoltage(m_channel);
+}
diff --git a/src/libPS/PowerSupplyChannel.h b/src/libPS/PowerSupplyChannel.h
index d1c3a071..069b5dd0 100644
--- a/src/libPS/PowerSupplyChannel.h
+++ b/src/libPS/PowerSupplyChannel.h
@@ -1,149 +1,149 @@
 #ifndef POWERSUPPLYCHANNEL_H
 #define POWERSUPPLYCHANNEL_H
 
-#include <string>
 #include <nlohmann/json.hpp>
+#include <string>
 
 #include "IPowerSupply.h"
 
 /** A single channel of a power supply.
  *
- * Represents a single channel of a physical, potentially multi-channel, 
+ * Represents a single channel of a physical, potentially multi-channel,
  * power supply (IPowerSupply).
- */ 
-class PowerSupplyChannel
-{
-public:
-  /** Create object corresponding to a single channel of a power supply.
-   *
-   * No commands are called here.
-   *
-   * @param name Name of the channel
-   * @param ps Reference to the physical power supply
-   * @param channel Channel number
-   */
-  PowerSupplyChannel(const std::string& name, std::shared_ptr<IPowerSupply> ps, unsigned channel);
-
-  /** Get name of channel
-   * @return channel name
-   */
-  std::string getName() const;
-
-  /** Get pointer to the underlaying physical power supply
-   * @return power supply pointer
-   */
-  std::shared_ptr<IPowerSupply> getPowerSupply() const;
-
-  /** Get physical channel in the power supply
-   * @return channel number in the device
-   */
-  unsigned getChannel() const;
-  
-  /** Settings to set on program.
-   *
-   * Commands (keys) map to
-   *  maxvoltage -> setVoltageProtect
-   *  maxcurrent -> setCurrentProtect
-   *  voltage -> setVoltageLevel
-   *  current -> setCurrentLevel
-   */
-  void setProgram(const nlohmann::json& settings);
-
-  /** Program the device according to the JSON configuration [optional] */
-  void program();
-
-  /** \name Power Supply Control
-   * @{
-   */
-  
-  /** Turn on power supply (channel)
-   *
-   * Warning: Not all power supplies support per-channel on/off control.
-   */  
-  void turnOn();
-
-  /** Turn off power supply 
-   *
-   * Warning: Not all power supplies support per-channel on/off control.
-   */
-  void turnOff();
-
-  /** @} */
-
-  /** \name Current Control and Measurement
-   * @{
-   */
-
-  /** Set current of PS
-   * @param cur current [A]
-   */
-  void setCurrentLevel(double cur);
-
-  /** Get current of PS
-   * @return current level [A]
-   */
-  double getCurrentLevel();
-  
-  /** Set current protection
-   * @param cur maximum current [A]
-   */
-  void setCurrentProtect(double cur);
-
-  /** \brief Get current protection [optional]
-   * @return current, convert to [A]
-   */
-  double getCurrentProtect();
-
-  /** Measure current of PS
-   * @return current, convert to [A]
-   */
-  double measureCurrent();
-
-  /** @} */
-
-  /** \name Voltage Control and Measurement
-   * @{
-   */
-
-  /** Set voltage of PS       
-   * @param volt voltage [V]
-   */
-  void setVoltageLevel(double volt);
-
-  /** Get voltage level of PS
-   * @return voltage level [V]
-   */
-  double getVoltageLevel();
-  
-  /** Set current protection [optional]
-   * @param volt maximum current [A]
-   */
-  void setVoltageProtect(double volt);  
-
-  /** \brief Get voltage protection of PS.
-   * @return voltage, convert to [V]
-   */
-  double getVoltageProtect();  
-
-  /** Measure voltage of PS.
-   * @return voltage, convert to [V]
-   */
-  double measureVoltage();
-
-  /** @} */
-
-private:
-  /** Store name of the channel */
-  std::string m_name;
-
-  /** Program to apply on program() */
-  nlohmann::json m_program;
-
-  /** Reference to the physical power supply */
-  std::shared_ptr<IPowerSupply> m_ps=nullptr;
-
-  /** Channel number */
-  unsigned m_channel;
+ */
+class PowerSupplyChannel {
+ public:
+    /** Create object corresponding to a single channel of a power supply.
+     *
+     * No commands are called here.
+     *
+     * @param name Name of the channel
+     * @param ps Reference to the physical power supply
+     * @param channel Channel number
+     */
+    PowerSupplyChannel(const std::string& name,
+                       std::shared_ptr<IPowerSupply> ps, unsigned channel);
+
+    /** Get name of channel
+     * @return channel name
+     */
+    std::string getName() const;
+
+    /** Get pointer to the underlaying physical power supply
+     * @return power supply pointer
+     */
+    std::shared_ptr<IPowerSupply> getPowerSupply() const;
+
+    /** Get physical channel in the power supply
+     * @return channel number in the device
+     */
+    unsigned getChannel() const;
+
+    /** Settings to set on program.
+     *
+     * Commands (keys) map to
+     *  maxvoltage -> setVoltageProtect
+     *  maxcurrent -> setCurrentProtect
+     *  voltage -> setVoltageLevel
+     *  current -> setCurrentLevel
+     */
+    void setProgram(const nlohmann::json& settings);
+
+    /** Program the device according to the JSON configuration [optional] */
+    void program();
+
+    /** \name Power Supply Control
+     * @{
+     */
+
+    /** Turn on power supply (channel)
+     *
+     * Warning: Not all power supplies support per-channel on/off control.
+     */
+    void turnOn();
+
+    /** Turn off power supply
+     *
+     * Warning: Not all power supplies support per-channel on/off control.
+     */
+    void turnOff();
+
+    /** @} */
+
+    /** \name Current Control and Measurement
+     * @{
+     */
+
+    /** Set current of PS
+     * @param cur current [A]
+     */
+    void setCurrentLevel(double cur);
+
+    /** Get current of PS
+     * @return current level [A]
+     */
+    double getCurrentLevel();
+
+    /** Set current protection
+     * @param cur maximum current [A]
+     */
+    void setCurrentProtect(double cur);
+
+    /** \brief Get current protection [optional]
+     * @return current, convert to [A]
+     */
+    double getCurrentProtect();
+
+    /** Measure current of PS
+     * @return current, convert to [A]
+     */
+    double measureCurrent();
+
+    /** @} */
+
+    /** \name Voltage Control and Measurement
+     * @{
+     */
+
+    /** Set voltage of PS
+     * @param volt voltage [V]
+     */
+    void setVoltageLevel(double volt);
+
+    /** Get voltage level of PS
+     * @return voltage level [V]
+     */
+    double getVoltageLevel();
+
+    /** Set current protection [optional]
+     * @param volt maximum current [A]
+     */
+    void setVoltageProtect(double volt);
+
+    /** \brief Get voltage protection of PS.
+     * @return voltage, convert to [V]
+     */
+    double getVoltageProtect();
+
+    /** Measure voltage of PS.
+     * @return voltage, convert to [V]
+     */
+    double measureVoltage();
+
+    /** @} */
+
+ private:
+    /** Store name of the channel */
+    std::string m_name;
+
+    /** Program to apply on program() */
+    nlohmann::json m_program;
+
+    /** Reference to the physical power supply */
+    std::shared_ptr<IPowerSupply> m_ps = nullptr;
+
+    /** Channel number */
+    unsigned m_channel;
 };
 
-#endif // POWERSUPPLYCHANNEL_H
+#endif  // POWERSUPPLYCHANNEL_H
diff --git a/src/libPS/PowerSupplyRegistry.cpp b/src/libPS/PowerSupplyRegistry.cpp
index 330cf351..1d9d7d22 100644
--- a/src/libPS/PowerSupplyRegistry.cpp
+++ b/src/libPS/PowerSupplyRegistry.cpp
@@ -4,30 +4,29 @@
 
 namespace EquipRegistry {
 
-  typedef ClassRegistry<IPowerSupply, std::string> RegistryPS;
+typedef ClassRegistry<IPowerSupply, std::string> RegistryPS;
 
-  static RegistryPS &registry()
-  {
+static RegistryPS& registry() {
     static RegistryPS instance;
     return instance;
-  }
+}
 
-  bool registerPowerSupply(const std::string& model, std::function<std::shared_ptr<IPowerSupply>(const std::string&)> f)
-  {
+bool registerPowerSupply(
+    const std::string& model,
+    std::function<std::shared_ptr<IPowerSupply>(const std::string&)> f) {
     return registry().registerClass(model, f);
-  }
-  
-  std::shared_ptr<IPowerSupply> createPowerSupply(const std::string& model, const std::string& name) {
+}
+
+std::shared_ptr<IPowerSupply> createPowerSupply(const std::string& model,
+                                                const std::string& name) {
     auto result = registry().makeClass(model, name);
-    if(result == nullptr) {
-      std::cout << "No Power Supply (IPowerSupply) of type " << model << ", matching the name '" << name << "' found\n";
+    if (result == nullptr) {
+        std::cout << "No Power Supply (IPowerSupply) of type " << model
+                  << ", matching the name '" << name << "' found\n";
     }
     return result;
-  }
-  
-  std::vector<std::string> listPowerSupply() {
-        return registry().listClasses();
-  }
-
 }
 
+std::vector<std::string> listPowerSupply() { return registry().listClasses(); }
+
+}  // namespace EquipRegistry
diff --git a/src/libPS/PowerSupplyRegistry.h b/src/libPS/PowerSupplyRegistry.h
index b175f443..ba533705 100644
--- a/src/libPS/PowerSupplyRegistry.h
+++ b/src/libPS/PowerSupplyRegistry.h
@@ -1,25 +1,30 @@
-#include "ClassRegistry.h"
-#include "IPowerSupply.h"
-
+#include <functional>
+#include <memory>
 #include <string>
 #include <vector>
-#include <memory>
-#include <functional>
+
+#include "ClassRegistry.h"
+#include "IPowerSupply.h"
 
 // Configuration helpers and registry for specific PS implementations
 namespace EquipRegistry {
-  /** Register new PS type into registry */
-  bool registerPowerSupply(const std::string& model,
-                           std::function<std::shared_ptr<IPowerSupply>(const std::string&)> f);
+/** Register new PS type into registry */
+bool registerPowerSupply(
+    const std::string& model,
+    std::function<std::shared_ptr<IPowerSupply>(const std::string&)> f);
 
-  /** Get new instance of given power supply type */
-  std::shared_ptr<IPowerSupply> createPowerSupply(const std::string& model, const std::string& name);
+/** Get new instance of given power supply type */
+std::shared_ptr<IPowerSupply> createPowerSupply(const std::string& model,
+                                                const std::string& name);
 
-  /** List available Ps types */
-  std::vector<std::string> listPowerSupply();  
-}
+/** List available Ps types */
+std::vector<std::string> listPowerSupply();
+}  // namespace EquipRegistry
 
-#define REGISTER_POWERSUPPLY(model) \
-  static bool _registered_##model = \
-    EquipRegistry::registerPowerSupply(#model, \
-    std::function<std::shared_ptr<IPowerSupply>(const std::string&)>([](const std::string& name) { return std::shared_ptr<IPowerSupply>(new model(name)); }));
+#define REGISTER_POWERSUPPLY(model)                                       \
+    static bool _registered_##model = EquipRegistry::registerPowerSupply( \
+        #model,                                                           \
+        std::function<std::shared_ptr<IPowerSupply>(const std::string&)>( \
+            [](const std::string& name) {                                 \
+                return std::shared_ptr<IPowerSupply>(new model(name));    \
+            }));
diff --git a/src/libPS/RS_HMPXXXX.h b/src/libPS/RS_HMPXXXX.h
index a77191c4..e8f70e90 100644
--- a/src/libPS/RS_HMPXXXX.h
+++ b/src/libPS/RS_HMPXXXX.h
@@ -6,24 +6,21 @@
 #include <string>
 
 #include "SCPIPs.h"
-
 #include "SerialCom.h"
 
 /** \brief ROHDE&SWARZ HMP4040
  * Implementation for the ROHDE&SWARZ HMP4040 power supply.
  *
- * [Programming Manual](https://cdn.rohde-schwarz.com/pws/dl_downloads/dl_common_library/dl_manuals/gb_1/h/hmp_serie/HMP_SCPI_ProgrammersManual_en_01.pdf)
+ * [Programming
+ * Manual](https://cdn.rohde-schwarz.com/pws/dl_downloads/dl_common_library/dl_manuals/gb_1/h/hmp_serie/HMP_SCPI_ProgrammersManual_en_01.pdf)
  *
  * Others in the HMP series (HMP2020, HMP2030, HMP4030 and HMP4040) might
  * be also supported, but have not been tested.
  */
-class RS_HMPXXXX : public SCPIPs
-{
-public:
-  RS_HMPXXXX(const std::string& name);
-  ~RS_HMPXXXX() =default;
-
+class RS_HMPXXXX : public SCPIPs {
+ public:
+    RS_HMPXXXX(const std::string& name);
+    ~RS_HMPXXXX() = default;
 };
 
 #endif
-
diff --git a/src/libPS/RigolDP832.h b/src/libPS/RigolDP832.h
index d61b1e99..90846634 100644
--- a/src/libPS/RigolDP832.h
+++ b/src/libPS/RigolDP832.h
@@ -6,25 +6,22 @@
 #include <string>
 
 #include "SCPIPs.h"
-
 #include "SerialCom.h"
 
 /** \brief Rigol DP832
  *
  * Implementation for the Rigol DP832 power supply.
- * 
- * [Programming Manual](http://beyondmeasure.rigoltech.com/acton/attachment/1579/f-03a1/1/-/-/-/-/DP800%20Programming%20Guide.pdf)
+ *
+ * [Programming
+ * Manual](http://beyondmeasure.rigoltech.com/acton/attachment/1579/f-03a1/1/-/-/-/-/DP800%20Programming%20Guide.pdf)
  *
  * Other Rigol DP8xx power supplies might be supported too, but
  * have not been checked.
  */
-class RigolDP832 : public SCPIPs
-{
-public:
-  RigolDP832(const std::string& name);
-  ~RigolDP832() =default;
-
+class RigolDP832 : public SCPIPs {
+ public:
+    RigolDP832(const std::string& name);
+    ~RigolDP832() = default;
 };
 
 #endif
-
diff --git a/src/libPS/SCPIPs.cpp b/src/libPS/SCPIPs.cpp
index 2e969218..ca91671d 100644
--- a/src/libPS/SCPIPs.cpp
+++ b/src/libPS/SCPIPs.cpp
@@ -5,144 +5,112 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(SCPIPs)
 
-SCPIPs::SCPIPs(const std::string& name, std::vector<std::string> models,  unsigned maxChannels) :
-IPowerSupply(name, models), m_maxChannels(maxChannels)
-{ }
+SCPIPs::SCPIPs(const std::string& name, std::vector<std::string> models,
+               unsigned maxChannels)
+    : IPowerSupply(name, models), m_maxChannels(maxChannels) {}
 
-bool SCPIPs::ping()
-{
-  std::string result = m_com->sendreceive("*IDN?");
-  return !result.empty();
+bool SCPIPs::ping() {
+    std::string result = m_com->sendreceive("*IDN?");
+    return !result.empty();
 }
 
-void SCPIPs::reset()
-{
-  send("*RST");
+void SCPIPs::reset() {
+    send("*RST");
 
-  if(!ping())
-    throw std::runtime_error("No communication after reset.");
+    if (!ping()) throw std::runtime_error("No communication after reset.");
 }
 
-std::string SCPIPs::identify()
-{
-  std::string idn=m_com->sendreceive("*IDN?");
-  return idn;
+std::string SCPIPs::identify() {
+    std::string idn = m_com->sendreceive("*IDN?");
+    return idn;
 }
 
-void SCPIPs::turnOn(unsigned channel)
-{
-  send("OUTPUT ON", channel);
-}
+void SCPIPs::turnOn(unsigned channel) { send("OUTPUT ON", channel); }
 
-void SCPIPs::turnOff(unsigned channel)
-{
-  send("OUTPUT OFF", channel);
-}
+void SCPIPs::turnOff(unsigned channel) { send("OUTPUT OFF", channel); }
 
-void SCPIPs::setChannel(unsigned channel)
-{
-  if(m_maxChannels>0)
-    { // In-range channel check
-      if(channel>m_maxChannels)
-	throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void SCPIPs::setChannel(unsigned channel) {
+    if (m_maxChannels > 0) {  // In-range channel check
+        if (channel > m_maxChannels)
+            throw std::runtime_error("Invalid channel: " +
+                                     std::to_string(channel));
     }
 
-  if(m_maxChannels==1) return; // No need to change channel
+    if (m_maxChannels == 1) return;  // No need to change channel
 
-  send("INST:NSEL " + std::to_string(channel));
+    send("INST:NSEL " + std::to_string(channel));
 }
 
-void SCPIPs::setCurrentLevel(double cur, unsigned channel)
-{
-  send("CURRENT " + std::to_string(cur), channel);
+void SCPIPs::setCurrentLevel(double cur, unsigned channel) {
+    send("CURRENT " + std::to_string(cur), channel);
 }
 
-double SCPIPs::getCurrentLevel(unsigned channel)
-{
-  return std::stod(sendreceive("CURRENT?", channel));
+double SCPIPs::getCurrentLevel(unsigned channel) {
+    return std::stod(sendreceive("CURRENT?", channel));
 }
 
-void SCPIPs::setCurrentProtect(double maxcur, unsigned channel)
-{
-  send("CURRENT " + std::to_string(maxcur), channel);
+void SCPIPs::setCurrentProtect(double maxcur, unsigned channel) {
+    send("CURRENT " + std::to_string(maxcur), channel);
 }
 
-double SCPIPs::getCurrentProtect(unsigned channel)
-{
-  return getCurrentLevel();
-}
+double SCPIPs::getCurrentProtect(unsigned channel) { return getCurrentLevel(); }
 
-double SCPIPs::measureCurrent(unsigned channel)
-{
-  return std::stod(sendreceive("MEAS:CURR?", channel));
+double SCPIPs::measureCurrent(unsigned channel) {
+    return std::stod(sendreceive("MEAS:CURR?", channel));
 }
 
-void SCPIPs::setVoltageLevel(double volt, unsigned channel)
-{
-  send("VOLTAGE " + std::to_string(volt), channel);
+void SCPIPs::setVoltageLevel(double volt, unsigned channel) {
+    send("VOLTAGE " + std::to_string(volt), channel);
 }
 
-double SCPIPs::getVoltageLevel(unsigned channel)
-{
-  return std::stod(sendreceive("VOLTAGE?", channel));
+double SCPIPs::getVoltageLevel(unsigned channel) {
+    return std::stod(sendreceive("VOLTAGE?", channel));
 }
 
-void SCPIPs::setVoltageProtect(double maxvolt, unsigned channel)
-{
-  send("VOLTAGE " + std::to_string(maxvolt), channel);
+void SCPIPs::setVoltageProtect(double maxvolt, unsigned channel) {
+    send("VOLTAGE " + std::to_string(maxvolt), channel);
 }
 
-double SCPIPs::getVoltageProtect(unsigned channel)
-{
-  return getVoltageLevel();
-}
+double SCPIPs::getVoltageProtect(unsigned channel) { return getVoltageLevel(); }
 
-double SCPIPs::measureVoltage(unsigned channel)
-{
-  return std::stod(sendreceive("MEAS:VOLT?", channel));
+double SCPIPs::measureVoltage(unsigned channel) {
+    return std::stod(sendreceive("MEAS:VOLT?", channel));
 }
 
-void SCPIPs::send(const std::string& cmd)
-{
-  m_com->send(cmd);
-  std::string opcreply=m_com->sendreceive("*OPC?");
-  if(opcreply!="1")
-    throw std::runtime_error("SCPI command not completed");
+void SCPIPs::send(const std::string& cmd) {
+    m_com->send(cmd);
+    std::string opcreply = m_com->sendreceive("*OPC?");
+    if (opcreply != "1") throw std::runtime_error("SCPI command not completed");
 }
 
-void SCPIPs::send(const std::string& cmd, unsigned channel)
-{
-  if(m_maxChannels>0)
-    { // In-range channel check
-      if(channel>m_maxChannels)
-	throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void SCPIPs::send(const std::string& cmd, unsigned channel) {
+    if (m_maxChannels > 0) {  // In-range channel check
+        if (channel > m_maxChannels)
+            throw std::runtime_error("Invalid channel: " +
+                                     std::to_string(channel));
     }
 
-  if(m_maxChannels!=1)
-    m_com->send("INST:NSEL "+std::to_string(channel));
+    if (m_maxChannels != 1) m_com->send("INST:NSEL " + std::to_string(channel));
 
-  send(cmd);
+    send(cmd);
 }
 
-std::string SCPIPs::sendreceive(const std::string& cmd)
-{
-  return m_com->sendreceive(cmd);
+std::string SCPIPs::sendreceive(const std::string& cmd) {
+    return m_com->sendreceive(cmd);
 }
 
-std::string SCPIPs::sendreceive(const std::string& cmd, unsigned channel)
-{
-  if(m_maxChannels>0)
-    { // In-range channel check
-      if(channel>m_maxChannels)
-	throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+std::string SCPIPs::sendreceive(const std::string& cmd, unsigned channel) {
+    if (m_maxChannels > 0) {  // In-range channel check
+        if (channel > m_maxChannels)
+            throw std::runtime_error("Invalid channel: " +
+                                     std::to_string(channel));
     }
 
-  if(m_maxChannels!=1)
-    m_com->send("INST:NSEL "+std::to_string(channel));
+    if (m_maxChannels != 1) m_com->send("INST:NSEL " + std::to_string(channel));
 
-  return sendreceive(cmd);
+    return sendreceive(cmd);
 }
diff --git a/src/libPS/SCPIPs.h b/src/libPS/SCPIPs.h
index 1479f88a..1089f07a 100644
--- a/src/libPS/SCPIPs.h
+++ b/src/libPS/SCPIPs.h
@@ -6,154 +6,157 @@
 #include <string>
 
 #include "IPowerSupply.h"
-
 #include "SerialCom.h"
 
 /**
  * Base implemetation for Agilent/Keysight power supplies that share
  * a very similar command set.
  *
- * Options are possible to add additional for error checking on 
- *  - model compatibility (list of strings partially matched against *idn?, empty means no check is performed)
- *  - channel checking (maximum number of channels, 0 means no check is performed)
+ * Options are possible to add additional for error checking on
+ *  - model compatibility (list of strings partially matched against *idn?,
+ * empty means no check is performed)
+ *  - channel checking (maximum number of channels, 0 means no check is
+ * performed)
  */
-class SCPIPs : public IPowerSupply
-{
-public:
-  /**
-   * @param name Name of the power supply
-   * @param models List of supported models (empty means no check is performed) 
-   * @param maxChannels Maximum number of channels in the power supply (0 means no maximum)
-   */
-  SCPIPs(const std::string& name, std::vector<std::string> models={}, unsigned maxChannels=0);
-  ~SCPIPs() =default;
-
-  /** \name Communication
-   * @{
-   */
-
-  virtual bool ping();
-
-  /** @} */
-
-  /** \name Power Supply Control
-   * @{
-
-  /**
-   * Returns the model identifier of the PS connected
-   *
-   */
-  virtual std::string identify();
-
-  virtual void reset();
-
-  /** Turn on all channels
-   *
-   * Many Agilent power supplies don't have channel-specific enable
-   * control.
-   *
-   * @param channel ignored
-   */
-  virtual void turnOn(unsigned channel);
-
-  /** Turn off all channels
-   *
-   * Many Agilent power supplies don't have channel-specific enable
-   * control.
-   *
-   * @param channel ignored
-   */
-  virtual void turnOff(unsigned channel);
-
-  /** @} */
-  
-  /** \name Current Control and Measurement
-   * @{
-   */
-
-  virtual void   setCurrentLevel(double cur, unsigned channel = 0);
-  virtual double getCurrentLevel(unsigned channel = 0);
-  virtual void   setCurrentProtect(double maxcur , unsigned channel = 0);
-  virtual double getCurrentProtect(unsigned channel = 0);  
-  virtual double measureCurrent(unsigned channel = 0);
-
-  /** @} */
-
-  /** \name Voltage Control and Measurement
-   * @{
-   */
-
-  virtual void   setVoltageLevel(double volt, unsigned channel = 0);
-  virtual double getVoltageLevel(unsigned channel = 0);
-  virtual void   setVoltageProtect(double maxvolt , unsigned channel = 0 );
-  virtual double getVoltageProtect(unsigned channel = 0);
-  virtual double measureVoltage(unsigned channel = 0);
-
-  /** @} */
-
-protected:
-  //\brief Send power supply command and wait for operation complete.
-  /**
-   * Sends `cmd` to the power supply followed up `*OPC?`. Then blocks until
-   * a response is received. This prevents the program from terminating 
-   * before the program is processed.
-   *
-   * An error is thrown if no response to `*OPC?` is seen.
-   *
-   * \param cmd Power supply command to transmit.
-   */
-  void send(const std::string& cmd);
-
-  //! \brief Add channel set to power supply send
-  /**
-   * Sends `":INST:NSEL "+channel` before the actual command. This is
-   * done without injecting `*OPC?`.
-   *
-   * The rest is achieved using `SCIPPs::send(constd std::string& cmd)`.
-   *
-   * \param cmd Power supply command to transmit.
-   * \param channel Target channel
-   */
-  void send(const std::string& cmd, unsigned channel);
-
-  //\brief Send power supply command and return response.
-  /**
-   * Wrapper around `ICom::sendreceive`.
-   *
-   * \param cmd Power supply command to transmit.
-   *
-   * \return Parameter response.
-   */
-  std::string sendreceive(const std::string& cmd);
-
-  //! \brief Add channel set to power supply sendreceive
-  /**
-   * Sends `":INST:NSEL "+channel` before the actual command. This is
-   * done without injecting `*OPC?`.
-   *
-   * The rest is achieved using `SCIPPs::sendreceive(constd std::string& cmd)`.
-   *
-   * \param cmd Power supply command to transmit.
-   * \param channel Target channel
-   *
-   * \return Response for `cmd`
-   */
-  std::string sendreceive(const std::string& cmd, unsigned channel);
-
-private:
-  /** PS limitations @{ */
-
-  //! Maximum number of channels, 0 means unlimited
-  uint32_t m_maxChannels =0;
-
-  /** Set channel for following commands
-   *
-   * In-range check is performed.
-   */
-  void setChannel(unsigned channel);
-
-  /** @} */
+class SCPIPs : public IPowerSupply {
+ public:
+    /**
+     * @param name Name of the power supply
+     * @param models List of supported models (empty means no check is
+     * performed)
+     * @param maxChannels Maximum number of channels in the power supply (0
+     * means no maximum)
+     */
+    SCPIPs(const std::string& name, std::vector<std::string> models = {},
+           unsigned maxChannels = 0);
+    ~SCPIPs() = default;
+
+    /** \name Communication
+     * @{
+     */
+
+    virtual bool ping();
+
+    /** @} */
+
+    /** \name Power Supply Control
+     * @{
+
+    /**
+     * Returns the model identifier of the PS connected
+     *
+     */
+    virtual std::string identify();
+
+    virtual void reset();
+
+    /** Turn on all channels
+     *
+     * Many Agilent power supplies don't have channel-specific enable
+     * control.
+     *
+     * @param channel ignored
+     */
+    virtual void turnOn(unsigned channel);
+
+    /** Turn off all channels
+     *
+     * Many Agilent power supplies don't have channel-specific enable
+     * control.
+     *
+     * @param channel ignored
+     */
+    virtual void turnOff(unsigned channel);
+
+    /** @} */
+
+    /** \name Current Control and Measurement
+     * @{
+     */
+
+    virtual void setCurrentLevel(double cur, unsigned channel = 0);
+    virtual double getCurrentLevel(unsigned channel = 0);
+    virtual void setCurrentProtect(double maxcur, unsigned channel = 0);
+    virtual double getCurrentProtect(unsigned channel = 0);
+    virtual double measureCurrent(unsigned channel = 0);
+
+    /** @} */
+
+    /** \name Voltage Control and Measurement
+     * @{
+     */
+
+    virtual void setVoltageLevel(double volt, unsigned channel = 0);
+    virtual double getVoltageLevel(unsigned channel = 0);
+    virtual void setVoltageProtect(double maxvolt, unsigned channel = 0);
+    virtual double getVoltageProtect(unsigned channel = 0);
+    virtual double measureVoltage(unsigned channel = 0);
+
+    /** @} */
+
+ protected:
+    //\brief Send power supply command and wait for operation complete.
+    /**
+     * Sends `cmd` to the power supply followed up `*OPC?`. Then blocks until
+     * a response is received. This prevents the program from terminating
+     * before the program is processed.
+     *
+     * An error is thrown if no response to `*OPC?` is seen.
+     *
+     * \param cmd Power supply command to transmit.
+     */
+    void send(const std::string& cmd);
+
+    //! \brief Add channel set to power supply send
+    /**
+     * Sends `":INST:NSEL "+channel` before the actual command. This is
+     * done without injecting `*OPC?`.
+     *
+     * The rest is achieved using `SCIPPs::send(constd std::string& cmd)`.
+     *
+     * \param cmd Power supply command to transmit.
+     * \param channel Target channel
+     */
+    void send(const std::string& cmd, unsigned channel);
+
+    //\brief Send power supply command and return response.
+    /**
+     * Wrapper around `ICom::sendreceive`.
+     *
+     * \param cmd Power supply command to transmit.
+     *
+     * \return Parameter response.
+     */
+    std::string sendreceive(const std::string& cmd);
+
+    //! \brief Add channel set to power supply sendreceive
+    /**
+     * Sends `":INST:NSEL "+channel` before the actual command. This is
+     * done without injecting `*OPC?`.
+     *
+     * The rest is achieved using `SCIPPs::sendreceive(constd std::string&
+     * cmd)`.
+     *
+     * \param cmd Power supply command to transmit.
+     * \param channel Target channel
+     *
+     * \return Response for `cmd`
+     */
+    std::string sendreceive(const std::string& cmd, unsigned channel);
+
+ private:
+    /** PS limitations @{ */
+
+    //! Maximum number of channels, 0 means unlimited
+    uint32_t m_maxChannels = 0;
+
+    /** Set channel for following commands
+     *
+     * In-range check is performed.
+     */
+    void setChannel(unsigned channel);
+
+    /** @} */
 };
 
 #endif
-
diff --git a/src/libPS/SorensenPs.cpp b/src/libPS/SorensenPs.cpp
index 6d92f2c9..0560894b 100644
--- a/src/libPS/SorensenPs.cpp
+++ b/src/libPS/SorensenPs.cpp
@@ -5,115 +5,102 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(SorensenPs)
 
-SorensenPs::SorensenPs(const std::string& name) :
-IPowerSupply(name, {"60-20DP"})
-{ }
+SorensenPs::SorensenPs(const std::string& name)
+    : IPowerSupply(name, {"60-20DP"}) {}
 
-bool SorensenPs::ping()
-{
-  std::string result = m_com->sendreceive("*IDN?");
-  return !result.empty();
+bool SorensenPs::ping() {
+    std::string result = m_com->sendreceive("*IDN?");
+    return !result.empty();
 }
 
-void SorensenPs::reset()
-{
-  m_com->send("OPALL 0");
-  m_com->send("*RST");
+void SorensenPs::reset() {
+    m_com->send("OPALL 0");
+    m_com->send("*RST");
 
-  if(!ping())
-    throw std::runtime_error("No communication after reset.");
+    if (!ping()) throw std::runtime_error("No communication after reset.");
 }
 
-std::string SorensenPs::identify()
-{
-  std::string idn=m_com->sendreceive("*IDN?");
-  return idn;
+std::string SorensenPs::identify() {
+    std::string idn = m_com->sendreceive("*IDN?");
+    return idn;
 }
 
-void SorensenPs::turnOn(unsigned channel)
-{
-  if(channel!=1 && channel!=2)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void SorensenPs::turnOn(unsigned channel) {
+    if (channel != 1 && channel != 2)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("OP"+std::to_string(channel)+" 1");
+    m_com->send("OP" + std::to_string(channel) + " 1");
 }
 
-void SorensenPs::turnOff(unsigned channel)
-{
-  if(channel!=1 && channel!=2)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void SorensenPs::turnOff(unsigned channel) {
+    if (channel != 1 && channel != 2)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("OP"+std::to_string(channel)+" 0");
+    m_com->send("OP" + std::to_string(channel) + " 0");
 }
 
-void SorensenPs::setCurrentLevel(double cur, unsigned channel)
-{
-  if(channel!=1 && channel!=2)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void SorensenPs::setCurrentLevel(double cur, unsigned channel) {
+    if (channel != 1 && channel != 2)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("I" + std::to_string(channel)+" "+std::to_string(cur));
+    m_com->send("I" + std::to_string(channel) + " " + std::to_string(cur));
 }
 
-double SorensenPs::getCurrentLevel(unsigned channel)
-{
-  if(channel!=1 && channel!=2)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double SorensenPs::getCurrentLevel(unsigned channel) {
+    if (channel != 1 && channel != 2)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  return std::stod(m_com->sendreceive("I" + std::to_string(channel) + "?").substr(3));
+    return std::stod(
+        m_com->sendreceive("I" + std::to_string(channel) + "?").substr(3));
 }
 
-void SorensenPs::setCurrentProtect(double maxcur, unsigned channel)
-{
-  setCurrentLevel(maxcur, channel);
+void SorensenPs::setCurrentProtect(double maxcur, unsigned channel) {
+    setCurrentLevel(maxcur, channel);
 }
 
-double SorensenPs::getCurrentProtect(unsigned channel)
-{
-  return getCurrentLevel(channel);
+double SorensenPs::getCurrentProtect(unsigned channel) {
+    return getCurrentLevel(channel);
 }
 
-double SorensenPs::measureCurrent(unsigned channel)
-{
-  if(channel!=1 && channel!=2)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double SorensenPs::measureCurrent(unsigned channel) {
+    if (channel != 1 && channel != 2)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  return std::stod(m_com->sendreceive("I" + std::to_string(channel) + "O?").substr(0,5));
+    return std::stod(
+        m_com->sendreceive("I" + std::to_string(channel) + "O?").substr(0, 5));
 }
 
-void SorensenPs::setVoltageLevel(double volt, unsigned channel)
-{
-  if(channel!=1 && channel!=2)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void SorensenPs::setVoltageLevel(double volt, unsigned channel) {
+    if (channel != 1 && channel != 2)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("V" + std::to_string(channel)+" "+std::to_string(volt));
+    m_com->send("V" + std::to_string(channel) + " " + std::to_string(volt));
 }
 
-double SorensenPs::getVoltageLevel(unsigned channel)
-{
-  if(channel!=1 && channel!=2)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double SorensenPs::getVoltageLevel(unsigned channel) {
+    if (channel != 1 && channel != 2)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  return std::stod(m_com->sendreceive("V" + std::to_string(channel) + "?").substr(3));
+    return std::stod(
+        m_com->sendreceive("V" + std::to_string(channel) + "?").substr(3));
 }
 
-void SorensenPs::setVoltageProtect(double maxvolt, unsigned channel)
-{
-  setVoltageLevel(maxvolt, channel);
+void SorensenPs::setVoltageProtect(double maxvolt, unsigned channel) {
+    setVoltageLevel(maxvolt, channel);
 }
 
-double SorensenPs::getVoltageProtect(unsigned channel)
-{
-  return getVoltageLevel(channel);
+double SorensenPs::getVoltageProtect(unsigned channel) {
+    return getVoltageLevel(channel);
 }
 
-double SorensenPs::measureVoltage(unsigned channel)
-{
-  if(channel!=1 && channel!=2)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double SorensenPs::measureVoltage(unsigned channel) {
+    if (channel != 1 && channel != 2)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  return std::stod(m_com->sendreceive("V" + std::to_string(channel) + "O?").substr(0,5));
+    return std::stod(
+        m_com->sendreceive("V" + std::to_string(channel) + "O?").substr(0, 5));
 }
diff --git a/src/libPS/SorensenPs.h b/src/libPS/SorensenPs.h
index f088bd32..70ad8448 100644
--- a/src/libPS/SorensenPs.h
+++ b/src/libPS/SorensenPs.h
@@ -6,68 +6,66 @@
 #include <string>
 
 #include "IPowerSupply.h"
-
 #include "SerialCom.h"
 
 /** \brief Sorensen XPF 60-20DP
  *
  * Implementation for the Sorensen XPF 60-20DP power supply.
  *
- * [Programming Manual](http://www.sorensen.com/products/XPF/downloads/XPF_60-20DP_Operation_Manual_M370417-01_Rev_A.pdf)
+ * [Programming
+ * Manual](http://www.sorensen.com/products/XPF/downloads/XPF_60-20DP_Operation_Manual_M370417-01_Rev_A.pdf)
  *
  * Other Sorensen power supplies might be supported too, but
  * have not been checked.
  */
-class SorensenPs : public IPowerSupply
-{
-public:
-  SorensenPs(const std::string& name);
-  ~SorensenPs() =default;
+class SorensenPs : public IPowerSupply {
+ public:
+    SorensenPs(const std::string& name);
+    ~SorensenPs() = default;
+
+    /** \name Communication
+     * @{
+     */
 
-  /** \name Communication
-   * @{
-   */
+    virtual bool ping();
 
-  virtual bool ping();
+    virtual std::string identify();
 
-  virtual std::string identify();
+    /** @} */
 
-  /** @} */
+    /** \name Power Supply Control
+     * @{
+     */
 
-  /** \name Power Supply Control
-   * @{
-   */
+    virtual void reset();
+    virtual void turnOn(unsigned channel);
+    virtual void turnOff(unsigned channel);
 
-  virtual void reset();
-  virtual void turnOn(unsigned channel);
-  virtual void turnOff(unsigned channel);
+    /** @} */
 
-  /** @} */
-  
-  /** \name Current Control and Measurement
-   * @{
-   */
+    /** \name Current Control and Measurement
+     * @{
+     */
 
-  virtual void   setCurrentLevel(double cur, unsigned channel = 0);
-  virtual double getCurrentLevel(unsigned channel = 0);
-  virtual void   setCurrentProtect(double maxcur , unsigned channel = 0);
-  virtual double getCurrentProtect(unsigned channel = 0);  
-  virtual double measureCurrent(unsigned channel = 0);
+    virtual void setCurrentLevel(double cur, unsigned channel = 0);
+    virtual double getCurrentLevel(unsigned channel = 0);
+    virtual void setCurrentProtect(double maxcur, unsigned channel = 0);
+    virtual double getCurrentProtect(unsigned channel = 0);
+    virtual double measureCurrent(unsigned channel = 0);
 
-  /** @} */
+    /** @} */
 
-  /** \name Voltage Control and Measurement
-   * @{
-   */
+    /** \name Voltage Control and Measurement
+     * @{
+     */
 
-  virtual void   setVoltageLevel(double volt, unsigned channel = 0);
-  virtual double getVoltageLevel(unsigned channel = 0);
-  virtual void   setVoltageProtect(double maxvolt , unsigned channel = 0 );
-  virtual double getVoltageProtect(unsigned channel = 0);
-  virtual double measureVoltage(unsigned channel = 0);
+    virtual void setVoltageLevel(double volt, unsigned channel = 0);
+    virtual double getVoltageLevel(unsigned channel = 0);
+    virtual void setVoltageProtect(double maxvolt, unsigned channel = 0);
+    virtual double getVoltageProtect(unsigned channel = 0);
+    virtual double measureVoltage(unsigned channel = 0);
 
-  /** @} */
+    /** @} */
 };
 
 #endif
-
diff --git a/src/libPS/TTIPs.cpp b/src/libPS/TTIPs.cpp
index 300a267d..6c258d2f 100644
--- a/src/libPS/TTIPs.cpp
+++ b/src/libPS/TTIPs.cpp
@@ -5,122 +5,110 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(TTIPs)
 
-TTIPs::TTIPs(const std::string& name, std::vector<std::string> models, unsigned nChannels) :
-IPowerSupply(name, models), m_nchan(nChannels)
-{ }
+TTIPs::TTIPs(const std::string& name, std::vector<std::string> models,
+             unsigned nChannels)
+    : IPowerSupply(name, models), m_nchan(nChannels) {}
 
-bool TTIPs::ping()
-{
-  std::string result = m_com->sendreceive("*IDN?");
-  return !result.empty();
+bool TTIPs::ping() {
+    std::string result = m_com->sendreceive("*IDN?");
+    return !result.empty();
 }
 
-void TTIPs::reset()
-{
-  m_com->send("OPALL 0");
-  m_com->send("*RST");
+void TTIPs::reset() {
+    m_com->send("OPALL 0");
+    m_com->send("*RST");
 
-  if(!ping())
-    throw std::runtime_error("No communication after reset.");
+    if (!ping()) throw std::runtime_error("No communication after reset.");
 }
 
-std::string TTIPs::identify()
-{
-  std::string idn=m_com->sendreceive("*IDN?");
-  return idn;
+std::string TTIPs::identify() {
+    std::string idn = m_com->sendreceive("*IDN?");
+    return idn;
 }
 
-void TTIPs::turnOn(unsigned channel)
-{
-  if(channel<1 || channel > m_nchan)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void TTIPs::turnOn(unsigned channel) {
+    if (channel < 1 || channel > m_nchan)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("OP"+std::to_string(channel)+" 1");
+    m_com->send("OP" + std::to_string(channel) + " 1");
 }
 
-void TTIPs::turnOff(unsigned channel)
-{
-  if(channel<1 || channel > m_nchan)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void TTIPs::turnOff(unsigned channel) {
+    if (channel < 1 || channel > m_nchan)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("OP"+std::to_string(channel)+" 0");
+    m_com->send("OP" + std::to_string(channel) + " 0");
 }
 
-void TTIPs::setCurrentLevel(double cur, unsigned channel)
-{
-  if(channel<1 || channel > m_nchan)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+void TTIPs::setCurrentLevel(double cur, unsigned channel) {
+    if (channel < 1 || channel > m_nchan)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  m_com->send("I" + std::to_string(channel)+" "+std::to_string(cur));
+    m_com->send("I" + std::to_string(channel) + " " + std::to_string(cur));
 }
 
-double TTIPs::getCurrentLevel(unsigned channel)
-{
-  if(channel<1 || channel > m_nchan)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double TTIPs::getCurrentLevel(unsigned channel) {
+    if (channel < 1 || channel > m_nchan)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  std::string repl = m_com->sendreceive("I" + std::to_string(channel) + "?");
-  return std::stod(repl.substr(("I" + std::to_string(channel)+" ").length(),repl.length()));
+    std::string repl = m_com->sendreceive("I" + std::to_string(channel) + "?");
+    return std::stod(repl.substr(("I" + std::to_string(channel) + " ").length(),
+                                 repl.length()));
 }
 
-void TTIPs::setCurrentProtect(double maxcur, unsigned channel)
-{
-  setCurrentLevel(maxcur, channel);
+void TTIPs::setCurrentProtect(double maxcur, unsigned channel) {
+    setCurrentLevel(maxcur, channel);
 }
 
-double TTIPs::getCurrentProtect(unsigned channel)
-{
-  return getCurrentLevel(channel);
+double TTIPs::getCurrentProtect(unsigned channel) {
+    return getCurrentLevel(channel);
 }
 
-double TTIPs::measureCurrent(unsigned channel)
-{
-  if(channel<1 || channel > m_nchan)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double TTIPs::measureCurrent(unsigned channel) {
+    if (channel < 1 || channel > m_nchan)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  std::string repl = m_com->sendreceive("I" + std::to_string(channel) + "O?");
-  size_t apos = repl.find("A");
-  if(apos!=std::string::npos) repl = repl.substr(0,apos);//skip "A" at end
-  return std::stod(repl);
+    std::string repl = m_com->sendreceive("I" + std::to_string(channel) + "O?");
+    size_t apos = repl.find("A");
+    if (apos != std::string::npos)
+        repl = repl.substr(0, apos);  // skip "A" at end
+    return std::stod(repl);
 }
 
-void TTIPs::setVoltageLevel(double volt, unsigned channel)
-{
-  if(channel<1 || channel > m_nchan)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
-  m_com->send("V" + std::to_string(channel)+" "+std::to_string(volt));
+void TTIPs::setVoltageLevel(double volt, unsigned channel) {
+    if (channel < 1 || channel > m_nchan)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
+    m_com->send("V" + std::to_string(channel) + " " + std::to_string(volt));
 }
 
-double TTIPs::getVoltageLevel(unsigned channel)
-{
-  if(channel<1 || channel > m_nchan)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double TTIPs::getVoltageLevel(unsigned channel) {
+    if (channel < 1 || channel > m_nchan)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  std::string repl = m_com->sendreceive("V" + std::to_string(channel) + "?");
-  return std::stod(repl.substr(("V" + std::to_string(channel)+" ").length(),repl.length()));
+    std::string repl = m_com->sendreceive("V" + std::to_string(channel) + "?");
+    return std::stod(repl.substr(("V" + std::to_string(channel) + " ").length(),
+                                 repl.length()));
 }
 
-void TTIPs::setVoltageProtect(double maxvolt, unsigned channel)
-{
-  setVoltageLevel(maxvolt, channel);
+void TTIPs::setVoltageProtect(double maxvolt, unsigned channel) {
+    setVoltageLevel(maxvolt, channel);
 }
 
-double TTIPs::getVoltageProtect(unsigned channel)
-{
-  return getVoltageLevel(channel);
+double TTIPs::getVoltageProtect(unsigned channel) {
+    return getVoltageLevel(channel);
 }
 
-double TTIPs::measureVoltage(unsigned channel)
-{
-  if(channel<1 || channel > m_nchan)
-    throw std::runtime_error("Invalid channel: "+std::to_string(channel));
+double TTIPs::measureVoltage(unsigned channel) {
+    if (channel < 1 || channel > m_nchan)
+        throw std::runtime_error("Invalid channel: " + std::to_string(channel));
 
-  std::string repl = m_com->sendreceive("V" + std::to_string(channel) + "O?");
-  size_t vpos = repl.find("V");
-  if(vpos!=std::string::npos) repl = repl.substr(0,vpos);//skip "V" at end
-  return std::stod(repl);
+    std::string repl = m_com->sendreceive("V" + std::to_string(channel) + "O?");
+    size_t vpos = repl.find("V");
+    if (vpos != std::string::npos)
+        repl = repl.substr(0, vpos);  // skip "V" at end
+    return std::stod(repl);
 }
diff --git a/src/libPS/TTIPs.h b/src/libPS/TTIPs.h
index 2750e8a4..02843f0f 100644
--- a/src/libPS/TTIPs.h
+++ b/src/libPS/TTIPs.h
@@ -6,7 +6,6 @@
 #include <string>
 
 #include "IPowerSupply.h"
-
 #include "SerialCom.h"
 
 /** \brief TTi PSUs
@@ -14,59 +13,58 @@
  * Implementation for TTi power supplies.
  *
  */
-class TTIPs : public IPowerSupply
-{
-public:
-  TTIPs(const std::string& name, std::vector<std::string> models={}, unsigned nChannels=0);
-  ~TTIPs() =default;
+class TTIPs : public IPowerSupply {
+ public:
+    TTIPs(const std::string& name, std::vector<std::string> models = {},
+          unsigned nChannels = 0);
+    ~TTIPs() = default;
+
+    /** \name Communication
+     * @{
+     */
 
-  /** \name Communication
-   * @{
-   */
+    virtual bool ping();
 
-  virtual bool ping();
+    virtual std::string identify();
 
-  virtual std::string identify();
+    /** @} */
 
-  /** @} */
+    /** \name Power Supply Control
+     * @{
+     */
 
-  /** \name Power Supply Control
-   * @{
-   */
+    virtual void reset();
+    virtual void turnOn(unsigned channel);
+    virtual void turnOff(unsigned channel);
 
-  virtual void reset();
-  virtual void turnOn(unsigned channel);
-  virtual void turnOff(unsigned channel);
+    /** @} */
 
-  /** @} */
-  
-  /** \name Current Control and Measurement
-   * @{
-   */
+    /** \name Current Control and Measurement
+     * @{
+     */
 
-  virtual void   setCurrentLevel(double cur, unsigned channel = 0);
-  virtual double getCurrentLevel(unsigned channel = 0);
-  virtual void   setCurrentProtect(double maxcur , unsigned channel = 0);
-  virtual double getCurrentProtect(unsigned channel = 0);  
-  virtual double measureCurrent(unsigned channel = 0);
+    virtual void setCurrentLevel(double cur, unsigned channel = 0);
+    virtual double getCurrentLevel(unsigned channel = 0);
+    virtual void setCurrentProtect(double maxcur, unsigned channel = 0);
+    virtual double getCurrentProtect(unsigned channel = 0);
+    virtual double measureCurrent(unsigned channel = 0);
 
-  /** @} */
+    /** @} */
 
-  /** \name Voltage Control and Measurement
-   * @{
-   */
+    /** \name Voltage Control and Measurement
+     * @{
+     */
 
-  virtual void   setVoltageLevel(double volt, unsigned channel = 0);
-  virtual double getVoltageLevel(unsigned channel = 0);
-  virtual void   setVoltageProtect(double maxvolt , unsigned channel = 0 );
-  virtual double getVoltageProtect(unsigned channel = 0);
-  virtual double measureVoltage(unsigned channel = 0);
+    virtual void setVoltageLevel(double volt, unsigned channel = 0);
+    virtual double getVoltageLevel(unsigned channel = 0);
+    virtual void setVoltageProtect(double maxvolt, unsigned channel = 0);
+    virtual double getVoltageProtect(unsigned channel = 0);
+    virtual double measureVoltage(unsigned channel = 0);
 
-  /** @} */
+    /** @} */
 
- private: 
-  uint m_nchan;
+ private:
+    uint m_nchan;
 };
 
 #endif
-
diff --git a/src/libPS/TTIXXXDPPs.h b/src/libPS/TTIXXXDPPs.h
index ee1a81ab..c011bf29 100644
--- a/src/libPS/TTIXXXDPPs.h
+++ b/src/libPS/TTIXXXDPPs.h
@@ -13,13 +13,10 @@
  * such as PL330DP.
  *
  */
-class TTIXXXDPPs : public TTIPs
-{
-public:
-  TTIXXXDPPs(const std::string& name);
-  ~TTIXXXDPPs() =default;
-
+class TTIXXXDPPs : public TTIPs {
+ public:
+    TTIXXXDPPs(const std::string& name);
+    ~TTIXXXDPPs() = default;
 };
 
 #endif
-
diff --git a/src/libPS/TTIXXXSPPs.h b/src/libPS/TTIXXXSPPs.h
index 33f8bcbd..b365eaee 100644
--- a/src/libPS/TTIXXXSPPs.h
+++ b/src/libPS/TTIXXXSPPs.h
@@ -13,13 +13,10 @@
  * such as PL330DP.
  *
  */
-class TTIXXXSPPs : public TTIPs
-{
-public:
-  TTIXXXSPPs(const std::string& name);
-  ~TTIXXXSPPs() =default;
-
+class TTIXXXSPPs : public TTIPs {
+ public:
+    TTIXXXSPPs(const std::string& name);
+    ~TTIXXXSPPs() = default;
 };
 
 #endif
-
diff --git a/src/libPS/TTIXXXTPPs.cpp b/src/libPS/TTIXXXTPPs.cpp
index 8f65907a..aec28418 100644
--- a/src/libPS/TTIXXXTPPs.cpp
+++ b/src/libPS/TTIXXXTPPs.cpp
@@ -5,10 +5,9 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(TTIXXXTPPs)
 
-TTIXXXTPPs::TTIXXXTPPs(const std::string& name) :
-TTIPs(name, {"MX180TP","QL355TP"}, 3)
-{ }
+TTIXXXTPPs::TTIXXXTPPs(const std::string& name)
+    : TTIPs(name, {"MX180TP", "QL355TP"}, 3) {}
diff --git a/src/libPS/TTIXXXTPPs.h b/src/libPS/TTIXXXTPPs.h
index eb8e3334..27fe44bb 100644
--- a/src/libPS/TTIXXXTPPs.h
+++ b/src/libPS/TTIXXXTPPs.h
@@ -8,15 +8,15 @@
  * Implementation for the TTi triple channel power supplies
  * such as MX180TP, QL355TP
  *
- * [Progamming Manual](http://resources.aimtti.com/manuals/MX180T+MX180TP_Instruction_Manual-Iss5.pdf)
+ * [Progamming
+ * Manual](http://resources.aimtti.com/manuals/MX180T+MX180TP_Instruction_Manual-Iss5.pdf)
  *
  * Similar to other TTi power supplies, so based on generic TTi class
  */
-class TTIXXXTPPs : public TTIPs
-{
-public:
-  TTIXXXTPPs(const std::string& name);
-  ~TTIXXXTPPs() =default;
+class TTIXXXTPPs : public TTIPs {
+ public:
+    TTIXXXTPPs(const std::string& name);
+    ~TTIXXXTPPs() = default;
 };
 
 #endif
diff --git a/src/libPS/python.cpp b/src/libPS/python.cpp
old mode 100755
new mode 100644
index a48089d0..8aee6645
--- a/src/libPS/python.cpp
+++ b/src/libPS/python.cpp
@@ -1,436 +1,279 @@
-#include "pybind11_json/pybind11_json.hpp"
-#include "nlohmann/json.hpp"
 #include <pybind11/pybind11.h>
 #include <pybind11/stl.h>
 
-#include "IPowerSupply.h"
-#include "SCPIPs.h"
-#include "AgilentPs.h"
 #include "AgilentE3631APs.h"
-#include "AgilentE364xAPs.h"
 #include "AgilentE3634APs.h"
-
+#include "AgilentE364xAPs.h"
+#include "AgilentPs.h"
 #include "Bk16XXPs.h"
 #include "DT54xxPs.h"
+#include "IPowerSupply.h"
 #include "Keithley22XX.h"
 #include "Keithley24XX.h"
 #include "PowerSupplyChannel.h"
 #include "RS_HMPXXXX.h"
 #include "RigolDP832.h"
+#include "SCPIPs.h"
 #include "SorensenPs.h"
-#include "TTIXXXSPPs.h"
 #include "TTIXXXDPPs.h"
+#include "TTIXXXSPPs.h"
 #include "TTIXXXTPPs.h"
+#include "nlohmann/json.hpp"
+#include "pybind11_json/pybind11_json.hpp"
 
 namespace py = pybind11;
 namespace nl = nlohmann;
 
 class PyIPowerSupply : public IPowerSupply {
-public:
+ public:
     /* Inherit the constructors */
     using IPowerSupply::IPowerSupply;
 
-    void setConfiguration(const nl::json& config) override {
-      PYBIND11_OVERLOAD(
-          void,
-          IPowerSupply,
-          setConfiguration,
-          config
-      );
-    }
-    bool ping() override {
-      PYBIND11_OVERLOAD_PURE(
-          bool,
-          IPowerSupply,
-          ping,
-      );
+    void setConfiguration(const nl::json &config) override {
+        PYBIND11_OVERLOAD(void, IPowerSupply, setConfiguration, config);
     }
+    bool ping() override { PYBIND11_OVERLOAD_PURE(bool, IPowerSupply, ping, ); }
     void checkCompatibilityList() override {
-      PYBIND11_OVERLOAD(
-        void,
-        IPowerSupply,
-        checkCompatibilityList,
-      );
+        PYBIND11_OVERLOAD(void, IPowerSupply, checkCompatibilityList, );
     }
     void reset() override {
-      PYBIND11_OVERLOAD_PURE(
-        void,
-        IPowerSupply,
-        reset,
-      );
+        PYBIND11_OVERLOAD_PURE(void, IPowerSupply, reset, );
     }
     std::vector<std::string> getListOfModels() override {
-      PYBIND11_OVERLOAD(
-        std::vector<std::string>,
-        IPowerSupply,
-        getListOfModels,
-      );
+        PYBIND11_OVERLOAD(std::vector<std::string>, IPowerSupply,
+                          getListOfModels, );
     }
     std::string identify() override {
-      PYBIND11_OVERLOAD_PURE(
-        std::string,
-        IPowerSupply,
-        identify,
-      );
+        PYBIND11_OVERLOAD_PURE(std::string, IPowerSupply, identify, );
     }
     void turnOn(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        void,
-        IPowerSupply,
-        turnOn,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(void, IPowerSupply, turnOn, channel);
     }
     void turnOff(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        void,
-        IPowerSupply,
-        turnOff,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(void, IPowerSupply, turnOff, channel);
     }
     void setCurrentLevel(double cur, unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        void,
-        IPowerSupply,
-        setCurrentLevel,
-        cur,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(void, IPowerSupply, setCurrentLevel, cur,
+                               channel);
     }
     double getCurrentLevel(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        double,
-        IPowerSupply,
-        getCurrentLevel,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(double, IPowerSupply, getCurrentLevel, channel);
     }
     void setCurrentProtect(double cur, unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        void,
-        IPowerSupply,
-        setCurrentProtect,
-        cur,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(void, IPowerSupply, setCurrentProtect, cur,
+                               channel);
     }
     double getCurrentProtect(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        double,
-        IPowerSupply,
-        getCurrentProtect,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(double, IPowerSupply, getCurrentProtect,
+                               channel);
     }
     double measureCurrent(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        double,
-        IPowerSupply,
-        measureCurrent,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(double, IPowerSupply, measureCurrent, channel);
     }
     void setVoltageLevel(double volt, unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        void,
-        IPowerSupply,
-        setVoltageLevel,
-        volt,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(void, IPowerSupply, setVoltageLevel, volt,
+                               channel);
     }
     double getVoltageLevel(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        double,
-        IPowerSupply,
-        getVoltageLevel,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(double, IPowerSupply, getVoltageLevel, channel);
     }
     void setVoltageProtect(double volt, unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        void,
-        IPowerSupply,
-        setVoltageProtect,
-        volt,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(void, IPowerSupply, setVoltageProtect, volt,
+                               channel);
     }
     double getVoltageProtect(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        double,
-        IPowerSupply,
-        getVoltageProtect,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(double, IPowerSupply, getVoltageProtect,
+                               channel);
     }
     double measureVoltage(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD_PURE(
-        double,
-        IPowerSupply,
-        measureVoltage,
-        channel
-      );
+        PYBIND11_OVERLOAD_PURE(double, IPowerSupply, measureVoltage, channel);
     }
-
 };
 
 // template trampoline to reduce code duplication
-template <class PSBase = AgilentPs> class PyPS: public PSBase {
-public:
+template <class PSBase = AgilentPs>
+class PyPS : public PSBase {
+ public:
     /* Inherit the constructors */
     using PSBase::PSBase;
 
-    bool ping() override {
-      PYBIND11_OVERLOAD(
-        bool,
-        PSBase,
-        ping,
-      );
-    }
+    bool ping() override { PYBIND11_OVERLOAD(bool, PSBase, ping, ); }
     std::string identify() override {
-      PYBIND11_OVERLOAD(
-        std::string,
-        PSBase,
-        identify,
-      );
-    }
-    void reset() override {
-      PYBIND11_OVERLOAD(
-        void,
-        PSBase,
-        reset,
-      );
+        PYBIND11_OVERLOAD(std::string, PSBase, identify, );
     }
+    void reset() override { PYBIND11_OVERLOAD(void, PSBase, reset, ); }
     void turnOn(unsigned channel) override {
-      PYBIND11_OVERLOAD(
-        void,
-        PSBase,
-        turnOn,
-        channel
-      );
+        PYBIND11_OVERLOAD(void, PSBase, turnOn, channel);
     }
     void turnOff(unsigned channel) override {
-      PYBIND11_OVERLOAD(
-        void,
-        PSBase,
-        turnOff,
-        channel
-      );
+        PYBIND11_OVERLOAD(void, PSBase, turnOff, channel);
     }
     void setCurrentLevel(double cur, unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        void,
-        PSBase,
-        setCurrentLevel,
-        cur,
-        channel
-      );
+        PYBIND11_OVERLOAD(void, PSBase, setCurrentLevel, cur, channel);
     }
     double getCurrentLevel(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        double,
-        PSBase,
-        getCurrentLevel,
-        channel
-      );
+        PYBIND11_OVERLOAD(double, PSBase, getCurrentLevel, channel);
     }
     void setCurrentProtect(double cur, unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        void,
-        PSBase,
-        setCurrentProtect,
-        cur,
-        channel
-      );
+        PYBIND11_OVERLOAD(void, PSBase, setCurrentProtect, cur, channel);
     }
     double getCurrentProtect(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        double,
-        PSBase,
-        getCurrentProtect,
-        channel
-      );
+        PYBIND11_OVERLOAD(double, PSBase, getCurrentProtect, channel);
     }
     double measureCurrent(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        double,
-        PSBase,
-        measureCurrent,
-        channel
-      );
+        PYBIND11_OVERLOAD(double, PSBase, measureCurrent, channel);
     }
     void setVoltageLevel(double volt, unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        void,
-        PSBase,
-        setVoltageLevel,
-        volt,
-        channel
-      );
+        PYBIND11_OVERLOAD(void, PSBase, setVoltageLevel, volt, channel);
     }
     double getVoltageLevel(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        double,
-        PSBase,
-        getVoltageLevel,
-        channel
-      );
+        PYBIND11_OVERLOAD(double, PSBase, getVoltageLevel, channel);
     }
     void setVoltageProtect(double volt, unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        void,
-        PSBase,
-        setVoltageProtect,
-        volt,
-        channel
-      );
+        PYBIND11_OVERLOAD(void, PSBase, setVoltageProtect, volt, channel);
     }
     double getVoltageProtect(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        double,
-        PSBase,
-        getVoltageProtect,
-        channel
-      );
+        PYBIND11_OVERLOAD(double, PSBase, getVoltageProtect, channel);
     }
     double measureVoltage(unsigned channel = 0) override {
-      PYBIND11_OVERLOAD(
-        double,
-        PSBase,
-        measureVoltage,
-        channel
-      );
+        PYBIND11_OVERLOAD(double, PSBase, measureVoltage, channel);
     }
 };
 
-
-
-void register_ps(py::module& m){
-  py::class_<IPowerSupply, PyIPowerSupply, std::shared_ptr<IPowerSupply>>(m, "IPowerSupply")
-    .def(py::init<const std::string &>())
-    .def("setCom", &IPowerSupply::setCom)
-    .def("setConfiguration", &IPowerSupply::setConfiguration)
-    .def("getConfiguration", &IPowerSupply::getConfiguration)
-    .def("ping", &IPowerSupply::ping)
-    .def("checkCompatibilityList", &IPowerSupply::checkCompatibilityList)
-    .def("reset", &IPowerSupply::reset)
-    .def("getListOfModels", &IPowerSupply::getListOfModels)
-    .def("identify", &IPowerSupply::identify)
-    .def("turnOn", &IPowerSupply::turnOn,
-         py::arg("channel") = 0)
-    .def("turnOff", &IPowerSupply::turnOff,
-         py::arg("channel") = 0)
-    .def("setCurrentLevel", &IPowerSupply::setCurrentLevel,
-         py::arg("current"), py::arg("channel") = 0)
-    .def("getCurrentLevel", &IPowerSupply::getCurrentLevel,
-         py::arg("channel") = 0)
-    .def("setCurrentProtect", &IPowerSupply::setCurrentProtect,
-         py::arg("current"), py::arg("channel") = 0)
-    .def("getCurrentProtect", &IPowerSupply::getCurrentProtect,
-         py::arg("channel") = 0)
-    .def("measureCurrent", &IPowerSupply::measureCurrent,
-         py::arg("channel") = 0)
-    .def("setVoltageLevel", &IPowerSupply::setVoltageLevel,
-         py::arg("voltage"), py::arg("channel") = 0)
-    .def("getVoltageLevel", &IPowerSupply::getVoltageLevel,
-         py::arg("channel") = 0)
-    .def("setVoltageProtect", &IPowerSupply::setVoltageProtect,
-         py::arg("voltage"), py::arg("channel") = 0)
-    .def("getVoltageProtect", &IPowerSupply::getVoltageProtect,
-         py::arg("channel") = 0)
-    .def("measureVoltage", &IPowerSupply::measureVoltage,
-         py::arg("channel") = 0);
-
-  py::class_<SCPIPs, PyPS<SCPIPs>, IPowerSupply, std::shared_ptr<SCPIPs>>(m, "SCPIPs")
-    .def(py::init<const std::string&, std::vector<std::string>&, unsigned>(),
-         py::arg("name"), py::arg("models") = py::list(), py::arg("maxChannels") = 0
-    );
-
-  py::class_<AgilentPs, SCPIPs, std::shared_ptr<AgilentPs>>(m, "AgilentPs")
-    .def(py::init<const std::string&, std::vector<std::string>&, unsigned>(),
-         py::arg("name"), py::arg("models") = py::list(), py::arg("maxChannels") = 0
-    )
-    .def("beepOff", &AgilentPs::beepOff);
-
-  py::class_<AgilentE3631APs, AgilentPs, std::shared_ptr<AgilentE3631APs>>(m, "AgilentE3631APs")
-    .def(py::init<const std::string &>());
-
-  py::class_<AgilentE364xAPs, AgilentPs, std::shared_ptr<AgilentE364xAPs>>(m, "AgilentE364xAPs")
-    .def(py::init<const std::string &>());
-
-  py::class_<AgilentE3634APs, AgilentPs, std::shared_ptr<AgilentE3634APs>>(m, "AgilentE3634APs")
-    .def(py::init<const std::string &>());
-
-  py::class_<Bk16XXPs, PyPS<Bk16XXPs>, IPowerSupply, std::shared_ptr<Bk16XXPs>>(m, "Bk16XXPs")
-    .def(py::init<const std::string &>());
-
-  py::class_<DT54xxPs, PyPS<DT54xxPs>, IPowerSupply, std::shared_ptr<DT54xxPs>> py_DT54xxPs(m, "DT54xxPs");
-
-  py_DT54xxPs
-    .def(py::init<const std::string &>())
-    .def("status", &DT54xxPs::status);
-
-  py::enum_<DT54xxPs::Status>(py_DT54xxPs, "Status")
-    .value("On", DT54xxPs::Status::On)
-    .value("RampingUp", DT54xxPs::Status::RampingUp)
-    .value("RampingDown", DT54xxPs::Status::RampingDown)
-    .value("OVC", DT54xxPs::Status::OVC)
-    .value("OVV", DT54xxPs::Status::OVV)
-    .value("UNV", DT54xxPs::Status::UNV)
-    .value("MAXV", DT54xxPs::Status::MAXV)
-    .value("Trip", DT54xxPs::Status::Trip)
-    .value("OVT", DT54xxPs::Status::OVT)
-    .value("Disabled", DT54xxPs::Status::Disabled)
-    .value("Kill", DT54xxPs::Status::Kill)
-    .value("Interlock", DT54xxPs::Status::Interlock)
-    .value("CalError", DT54xxPs::Status::CalError);
-
-
-  py::class_<Keithley22XX, PyPS<Keithley22XX>, IPowerSupply, std::shared_ptr<Keithley22XX>>(m, "Keithley22XX")
-    .def(py::init<const std::string &>());
-
-  py::class_<Keithley24XX, PyPS<Keithley24XX>, IPowerSupply, std::shared_ptr<Keithley24XX>>(m, "Keithley24XX")
-    .def(py::init<const std::string &>());
-
-
-  py::class_<RS_HMPXXXX, SCPIPs, std::shared_ptr<RS_HMPXXXX>>(m, "RS_HMPXXXX")
-    .def(py::init<const std::string &>());
-
-
-  py::class_<RigolDP832, SCPIPs, std::shared_ptr<RigolDP832>>(m, "RigolDP832")
-    .def(py::init<const std::string &>());
-
-
-  py::class_<SorensenPs, PyPS<SorensenPs>, IPowerSupply, std::shared_ptr<SorensenPs>>(m, "SorensenPs")
-    .def(py::init<const std::string &>());
-
-
-  py::class_<TTIXXXTPPs, PyPS<TTIXXXTPPs>, IPowerSupply, std::shared_ptr<TTIXXXTPPs>>(m, "TTIXXXTPPs")
-    .def(py::init<const std::string &>());
-
-  py::class_<TTIXXXDPPs, PyPS<TTIXXXDPPs>, IPowerSupply, std::shared_ptr<TTIXXXDPPs>>(m, "TTIXXXDPPs")
-    .def(py::init<const std::string &>());
-
-  py::class_<TTIXXXSPPs, PyPS<TTIXXXSPPs>, IPowerSupply, std::shared_ptr<TTIXXXSPPs>>(m, "TTIXXXSPPs")
-    .def(py::init<const std::string &>());
-
-  py::class_<PowerSupplyChannel, std::shared_ptr<PowerSupplyChannel>>(m, "PowerSupplyChannel")
-    .def(py::init<const std::string &, std::shared_ptr<IPowerSupply>, unsigned>())
-    .def("getName", &PowerSupplyChannel::getName)
-    .def("getPowerSupply", &PowerSupplyChannel::getPowerSupply)
-    .def("getChannel", &PowerSupplyChannel::getChannel)
-    .def("setProgram", &PowerSupplyChannel::setProgram)
-    .def("program", &PowerSupplyChannel::program)
-    .def("turnOn", &PowerSupplyChannel::turnOn)
-    .def("turnOff", &PowerSupplyChannel::turnOff)
-    .def("setCurrentLevel", &PowerSupplyChannel::setCurrentLevel)
-    .def("getCurrentLevel", &PowerSupplyChannel::getCurrentLevel)
-    .def("setCurrentProtect", &PowerSupplyChannel::setCurrentProtect)
-    .def("measureCurrent", &PowerSupplyChannel::measureCurrent)
-    .def("setVoltageLevel", &PowerSupplyChannel::setVoltageLevel)
-    .def("getVoltageLevel", &PowerSupplyChannel::getVoltageLevel)
-    .def("setVoltageProtect", &PowerSupplyChannel::setVoltageProtect)
-    .def("measureVoltage", &PowerSupplyChannel::measureVoltage);
+void register_ps(py::module &m) {
+    py::class_<IPowerSupply, PyIPowerSupply, std::shared_ptr<IPowerSupply>>(
+        m, "IPowerSupply")
+        .def(py::init<const std::string &>())
+        .def("setCom", &IPowerSupply::setCom)
+        .def("setConfiguration", &IPowerSupply::setConfiguration)
+        .def("getConfiguration", &IPowerSupply::getConfiguration)
+        .def("ping", &IPowerSupply::ping)
+        .def("checkCompatibilityList", &IPowerSupply::checkCompatibilityList)
+        .def("reset", &IPowerSupply::reset)
+        .def("getListOfModels", &IPowerSupply::getListOfModels)
+        .def("identify", &IPowerSupply::identify)
+        .def("turnOn", &IPowerSupply::turnOn, py::arg("channel") = 0)
+        .def("turnOff", &IPowerSupply::turnOff, py::arg("channel") = 0)
+        .def("setCurrentLevel", &IPowerSupply::setCurrentLevel,
+             py::arg("current"), py::arg("channel") = 0)
+        .def("getCurrentLevel", &IPowerSupply::getCurrentLevel,
+             py::arg("channel") = 0)
+        .def("setCurrentProtect", &IPowerSupply::setCurrentProtect,
+             py::arg("current"), py::arg("channel") = 0)
+        .def("getCurrentProtect", &IPowerSupply::getCurrentProtect,
+             py::arg("channel") = 0)
+        .def("measureCurrent", &IPowerSupply::measureCurrent,
+             py::arg("channel") = 0)
+        .def("setVoltageLevel", &IPowerSupply::setVoltageLevel,
+             py::arg("voltage"), py::arg("channel") = 0)
+        .def("getVoltageLevel", &IPowerSupply::getVoltageLevel,
+             py::arg("channel") = 0)
+        .def("setVoltageProtect", &IPowerSupply::setVoltageProtect,
+             py::arg("voltage"), py::arg("channel") = 0)
+        .def("getVoltageProtect", &IPowerSupply::getVoltageProtect,
+             py::arg("channel") = 0)
+        .def("measureVoltage", &IPowerSupply::measureVoltage,
+             py::arg("channel") = 0);
+
+    py::class_<SCPIPs, PyPS<SCPIPs>, IPowerSupply, std::shared_ptr<SCPIPs>>(
+        m, "SCPIPs")
+        .def(py::init<const std::string &, std::vector<std::string> &,
+                      unsigned>(),
+             py::arg("name"), py::arg("models") = py::list(),
+             py::arg("maxChannels") = 0);
+
+    py::class_<AgilentPs, SCPIPs, std::shared_ptr<AgilentPs>>(m, "AgilentPs")
+        .def(py::init<const std::string &, std::vector<std::string> &,
+                      unsigned>(),
+             py::arg("name"), py::arg("models") = py::list(),
+             py::arg("maxChannels") = 0)
+        .def("beepOff", &AgilentPs::beepOff);
+
+    py::class_<AgilentE3631APs, AgilentPs, std::shared_ptr<AgilentE3631APs>>(
+        m, "AgilentE3631APs")
+        .def(py::init<const std::string &>());
+
+    py::class_<AgilentE364xAPs, AgilentPs, std::shared_ptr<AgilentE364xAPs>>(
+        m, "AgilentE364xAPs")
+        .def(py::init<const std::string &>());
+
+    py::class_<AgilentE3634APs, AgilentPs, std::shared_ptr<AgilentE3634APs>>(
+        m, "AgilentE3634APs")
+        .def(py::init<const std::string &>());
+
+    py::class_<Bk16XXPs, PyPS<Bk16XXPs>, IPowerSupply,
+               std::shared_ptr<Bk16XXPs>>(m, "Bk16XXPs")
+        .def(py::init<const std::string &>());
+
+    py::class_<DT54xxPs, PyPS<DT54xxPs>, IPowerSupply,
+               std::shared_ptr<DT54xxPs>>
+        py_DT54xxPs(m, "DT54xxPs");
+
+    py_DT54xxPs.def(py::init<const std::string &>())
+        .def("status", &DT54xxPs::status);
+
+    py::enum_<DT54xxPs::Status>(py_DT54xxPs, "Status")
+        .value("On", DT54xxPs::Status::On)
+        .value("RampingUp", DT54xxPs::Status::RampingUp)
+        .value("RampingDown", DT54xxPs::Status::RampingDown)
+        .value("OVC", DT54xxPs::Status::OVC)
+        .value("OVV", DT54xxPs::Status::OVV)
+        .value("UNV", DT54xxPs::Status::UNV)
+        .value("MAXV", DT54xxPs::Status::MAXV)
+        .value("Trip", DT54xxPs::Status::Trip)
+        .value("OVT", DT54xxPs::Status::OVT)
+        .value("Disabled", DT54xxPs::Status::Disabled)
+        .value("Kill", DT54xxPs::Status::Kill)
+        .value("Interlock", DT54xxPs::Status::Interlock)
+        .value("CalError", DT54xxPs::Status::CalError);
+
+    py::class_<Keithley22XX, PyPS<Keithley22XX>, IPowerSupply,
+               std::shared_ptr<Keithley22XX>>(m, "Keithley22XX")
+        .def(py::init<const std::string &>());
+
+    py::class_<Keithley24XX, PyPS<Keithley24XX>, IPowerSupply,
+               std::shared_ptr<Keithley24XX>>(m, "Keithley24XX")
+        .def(py::init<const std::string &>());
+
+    py::class_<RS_HMPXXXX, SCPIPs, std::shared_ptr<RS_HMPXXXX>>(m, "RS_HMPXXXX")
+        .def(py::init<const std::string &>());
+
+    py::class_<RigolDP832, SCPIPs, std::shared_ptr<RigolDP832>>(m, "RigolDP832")
+        .def(py::init<const std::string &>());
+
+    py::class_<SorensenPs, PyPS<SorensenPs>, IPowerSupply,
+               std::shared_ptr<SorensenPs>>(m, "SorensenPs")
+        .def(py::init<const std::string &>());
+
+    py::class_<TTIXXXTPPs, PyPS<TTIXXXTPPs>, IPowerSupply,
+               std::shared_ptr<TTIXXXTPPs>>(m, "TTIXXXTPPs")
+        .def(py::init<const std::string &>());
+
+    py::class_<TTIXXXDPPs, PyPS<TTIXXXDPPs>, IPowerSupply,
+               std::shared_ptr<TTIXXXDPPs>>(m, "TTIXXXDPPs")
+        .def(py::init<const std::string &>());
+
+    py::class_<TTIXXXSPPs, PyPS<TTIXXXSPPs>, IPowerSupply,
+               std::shared_ptr<TTIXXXSPPs>>(m, "TTIXXXSPPs")
+        .def(py::init<const std::string &>());
+
+    py::class_<PowerSupplyChannel, std::shared_ptr<PowerSupplyChannel>>(
+        m, "PowerSupplyChannel")
+        .def(py::init<const std::string &, std::shared_ptr<IPowerSupply>,
+                      unsigned>())
+        .def("getName", &PowerSupplyChannel::getName)
+        .def("getPowerSupply", &PowerSupplyChannel::getPowerSupply)
+        .def("getChannel", &PowerSupplyChannel::getChannel)
+        .def("setProgram", &PowerSupplyChannel::setProgram)
+        .def("program", &PowerSupplyChannel::program)
+        .def("turnOn", &PowerSupplyChannel::turnOn)
+        .def("turnOff", &PowerSupplyChannel::turnOff)
+        .def("setCurrentLevel", &PowerSupplyChannel::setCurrentLevel)
+        .def("getCurrentLevel", &PowerSupplyChannel::getCurrentLevel)
+        .def("setCurrentProtect", &PowerSupplyChannel::setCurrentProtect)
+        .def("measureCurrent", &PowerSupplyChannel::measureCurrent)
+        .def("setVoltageLevel", &PowerSupplyChannel::setVoltageLevel)
+        .def("getVoltageLevel", &PowerSupplyChannel::getVoltageLevel)
+        .def("setVoltageProtect", &PowerSupplyChannel::setVoltageProtect)
+        .def("measureVoltage", &PowerSupplyChannel::measureVoltage);
 }
diff --git a/src/libScope/PS6000.cpp b/src/libScope/PS6000.cpp
index 91fef5ef..30269650 100644
--- a/src/libScope/PS6000.cpp
+++ b/src/libScope/PS6000.cpp
@@ -1,548 +1,510 @@
 #include "PS6000.h"
 
+#include <math.h>
+
+#include <chrono>
 #include <iostream>
 #include <sstream>
 #include <thread>
-#include <chrono>
-
-#include <math.h>
 
-PS6000::PS6000()
-  : PicoScope()
-{ }
+PS6000::PS6000() : PicoScope() {}
 
-PS6000::~PS6000()
-{
-  // Cleanup the buffers
-  for(uint ch=0;ch<4;ch++)
-    {
-      if(m_buffers[ch]!=nullptr)
-	{
-	  delete[] m_buffers[ch];
-	  m_buffers[ch]=nullptr;
-	}
+PS6000::~PS6000() {
+    // Cleanup the buffers
+    for (uint ch = 0; ch < 4; ch++) {
+        if (m_buffers[ch] != nullptr) {
+            delete[] m_buffers[ch];
+            m_buffers[ch] = nullptr;
+        }
     }
- }
+}
 
-void PS6000::open()
-{
-  m_openStatus = ps6000OpenUnit(&m_handle, 0);
+void PS6000::open() {
+    m_openStatus = ps6000OpenUnit(&m_handle, 0);
 
-  if(m_openStatus==PICO_OK || m_openStatus==PICO_USB3_0_DEVICE_NON_USB3_0_PORT)
-    ;
-  else if(m_openStatus==PICO_NOT_FOUND)
-    throw std::string("Picoscope not found");
-  else
-    throw std::string("Unable to open Picoscope due to unknown error");
+    if (m_openStatus == PICO_OK ||
+        m_openStatus == PICO_USB3_0_DEVICE_NON_USB3_0_PORT) {
+    } else if (m_openStatus == PICO_NOT_FOUND) {
+        throw std::string("Picoscope not found");
+    } else {
+        throw std::string("Unable to open Picoscope due to unknown error");
+    }
 
-  initInfo();
-  configChannels();
+    initInfo();
+    configChannels();
 }
 
-void PS6000::close()
-{
-  ps6000CloseUnit(m_handle);
-  m_handle=0;
+void PS6000::close() {
+    ps6000CloseUnit(m_handle);
+    m_handle = 0;
 }
 
-void PS6000::initInfo()
-{
-  int16_t r=20;
-  int8_t line[20];
-
-  // 
-  // Read variant type
-  ps6000GetUnitInfo(m_handle, line, sizeof(line), &r, PICO_VARIANT_INFO);
-
-  int32_t variant;
-  std::stringstream ss;
-  ss << line;
-  ss >> std::hex >> variant;
-
-  //
-  // Configure based on variant
-  switch(variant)
-    {
-    case PS6402:
-      m_model         = PS6402;
-      m_firstRange    = PS6000_50MV;
-      m_lastRange     = PS6000_20V;
-      m_channelCount  = 4;
-      m_AWG           = true;
-      m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) 
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6402A:
-      m_model		= PS6402A;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = false;
-      m_awgBufferSize = 0;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) 
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6402B:
-      m_model		= PS6402B;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = true;
-      m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++)
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6402C:
-      m_model	      = PS6402C;
-      m_firstRange    = PS6000_50MV;
-      m_lastRange     = PS6000_20V;
-      m_channelCount  = 4;
-      m_AWG           = false;
-      m_awgBufferSize = 0;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++)
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6402D:
-      m_model		= PS6402D;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = true;
-      m_awgBufferSize = PS640X_C_D_MAX_SIG_GEN_BUFFER_SIZE;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++)
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6403:
-      m_model		= PS6403;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = true;
-      m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) 
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6403A:
-      m_model		= PS6403;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = false;
-      m_awgBufferSize = 0;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) 
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6403B:
-      m_model		= PS6403B;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = true;
-      m_AWG = MAX_SIG_GEN_BUFFER_SIZE;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++)
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6403C:
-      m_model		= PS6403C;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = false;
-      m_awgBufferSize = 0;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++)
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6403D:
-      m_model		= PS6403D;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = true;
-      m_awgBufferSize = PS640X_C_D_MAX_SIG_GEN_BUFFER_SIZE;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++)
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6404:
-      m_model	      = PS6404;
-      m_firstRange    = PS6000_50MV;
-      m_lastRange     = PS6000_20V;
-      m_channelCount  = 4;
-      m_AWG           = true;
-      m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) 
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6404A:
-      m_model		= PS6404;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = false;
-      m_awgBufferSize = 0;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) 
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6404B:
-      m_model		= PS6404B;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = true;
-      m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++)
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6404C:
-      m_model		= PS6404C;
-      m_firstRange = PS6000_50MV;
-      m_lastRange = PS6000_20V;
-      m_channelCount = 4;
-      m_AWG = true;
-      m_awgBufferSize = 0;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++)
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6404D:
-      m_model         = PS6404D;
-      m_firstRange    = PS6000_50MV;
-      m_lastRange     = PS6000_20V;
-      m_channelCount  = 4;
-      m_AWG           = true;
-      m_awgBufferSize = PS640X_C_D_MAX_SIG_GEN_BUFFER_SIZE;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++)
-	{
-	  m_channelSettings[i].range = PS6000_5V;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_1M;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    case PS6407:
-      m_model	     = PS6407;
-      m_firstRange   = PS6000_100MV;
-      m_lastRange    = PS6000_100MV;
-      m_channelCount = 4;
-      m_AWG          = true;
-
-      for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) 
-	{
-	  m_channelSettings[i].range = PS6000_100MV;
-	  m_channelSettings[i].DCcoupled = PS6000_DC_50R;
-	  m_channelSettings[i].enabled = true;
-	}
-      break;
-
-    default:
-      break;
+void PS6000::initInfo() {
+    int16_t r = 20;
+    int8_t line[20];
+
+    //
+    // Read variant type
+    ps6000GetUnitInfo(m_handle, line, sizeof(line), &r, PICO_VARIANT_INFO);
+
+    int32_t variant;
+    std::stringstream ss;
+    ss << line;
+    ss >> std::hex >> variant;
+
+    //
+    // Configure based on variant
+    switch (variant) {
+        case PS6402:
+            m_model = PS6402;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6402A:
+            m_model = PS6402A;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = false;
+            m_awgBufferSize = 0;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6402B:
+            m_model = PS6402B;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6402C:
+            m_model = PS6402C;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = false;
+            m_awgBufferSize = 0;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6402D:
+            m_model = PS6402D;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_awgBufferSize = PS640X_C_D_MAX_SIG_GEN_BUFFER_SIZE;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6403:
+            m_model = PS6403;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6403A:
+            m_model = PS6403;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = false;
+            m_awgBufferSize = 0;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6403B:
+            m_model = PS6403B;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_AWG = MAX_SIG_GEN_BUFFER_SIZE;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6403C:
+            m_model = PS6403C;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = false;
+            m_awgBufferSize = 0;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6403D:
+            m_model = PS6403D;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_awgBufferSize = PS640X_C_D_MAX_SIG_GEN_BUFFER_SIZE;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6404:
+            m_model = PS6404;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6404A:
+            m_model = PS6404;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = false;
+            m_awgBufferSize = 0;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6404B:
+            m_model = PS6404B;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_awgBufferSize = MAX_SIG_GEN_BUFFER_SIZE;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6404C:
+            m_model = PS6404C;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_awgBufferSize = 0;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6404D:
+            m_model = PS6404D;
+            m_firstRange = PS6000_50MV;
+            m_lastRange = PS6000_20V;
+            m_channelCount = 4;
+            m_AWG = true;
+            m_awgBufferSize = PS640X_C_D_MAX_SIG_GEN_BUFFER_SIZE;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_5V;
+                m_channelSettings[i].DCcoupled = PS6000_DC_1M;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        case PS6407:
+            m_model = PS6407;
+            m_firstRange = PS6000_100MV;
+            m_lastRange = PS6000_100MV;
+            m_channelCount = 4;
+            m_AWG = true;
+
+            for (uint i = 0; i < PS6000_MAX_CHANNELS; i++) {
+                m_channelSettings[i].range = PS6000_100MV;
+                m_channelSettings[i].DCcoupled = PS6000_DC_50R;
+                m_channelSettings[i].enabled = true;
+            }
+            break;
+
+        default:
+            break;
     }
 }
 
-void PS6000::initBuffer(unsigned short ch,bool init)
-{
-  PICO_STATUS status;
+void PS6000::initBuffer(unsigned short ch, bool init) {
+    PICO_STATUS status;
 
-  if(init && m_buffers[ch]==nullptr)
-    {
-      m_buffers[ch]=new int16_t[PS6000_BUFFER_SIZE];
+    if (init && m_buffers[ch] == nullptr) {
+        m_buffers[ch] = new int16_t[PS6000_BUFFER_SIZE];
 
-      status=ps6000SetDataBuffer(m_handle, (PS6000_CHANNEL)ch, &m_buffers[ch][0], PS6000_BUFFER_SIZE, PS6000_RATIO_MODE_NONE);
-      if(status!=PICO_OK)
-	throw std::string("Unable to set data buffer: "+status);
-    }
-  else if(!init && m_buffers[ch]!=nullptr)
-    {
-      delete[] m_buffers[ch];
-      m_buffers[ch]=nullptr;
+        status =
+            ps6000SetDataBuffer(m_handle, (PS6000_CHANNEL)ch, &m_buffers[ch][0],
+                                PS6000_BUFFER_SIZE, PS6000_RATIO_MODE_NONE);
+        if (status != PICO_OK)
+            throw std::string("Unable to set data buffer: " + status);
+    } else if (!init && m_buffers[ch] != nullptr) {
+        delete[] m_buffers[ch];
+        m_buffers[ch] = nullptr;
     }
 }
 
-void PS6000::setTrigger(uint8_t ch, float threshold, Direction direction)
-{
-  if(ch>=m_channelCount)
-    throw std::string("Channel out of range"); //: "+ch+"/"+m_channelCount);
-
-  float chfactor=((float)m_availRanges[m_channelSettings[ch].range])/PS6000_MAX_VALUE;
-  
-  PS6000_THRESHOLD_DIRECTION dir=PS6000_NONE;
-  switch(direction)
-    {
-    case Rising:
-      dir=PS6000_RISING;
-      break;
-    case Falling:
-      dir=PS6000_FALLING;
-      break;
+void PS6000::setTrigger(uint8_t ch, float threshold, Direction direction) {
+    if (ch >= m_channelCount)
+        throw std::string(
+            "Channel out of range");  //: "+ch+"/"+m_channelCount);
+
+    float chfactor =
+        (static_cast<float>(m_availRanges[m_channelSettings[ch].range])) /
+        PS6000_MAX_VALUE;
+
+    PS6000_THRESHOLD_DIRECTION dir = PS6000_NONE;
+    switch (direction) {
+        case Rising:
+            dir = PS6000_RISING;
+            break;
+        case Falling:
+            dir = PS6000_FALLING;
+            break;
     }
 
-  ps6000SetSimpleTrigger(m_handle, true, (PS6000_CHANNEL)ch, threshold/chfactor, dir, 0, 0);
-}
- 
-void PS6000::unsetTrigger(uint8_t ch)
-{
-  ps6000SetSimpleTrigger(m_handle, false, (PS6000_CHANNEL)ch, 0, PS6000_NONE, 0, 0);
+    ps6000SetSimpleTrigger(m_handle, true, (PS6000_CHANNEL)ch,
+                           threshold / chfactor, dir, 0, 0);
 }
 
-void PS6000::setTriggerPosition(float percentage)
-{
-  m_triggerPosition=percentage;
+void PS6000::unsetTrigger(uint8_t ch) {
+    ps6000SetSimpleTrigger(m_handle, false, (PS6000_CHANNEL)ch, 0, PS6000_NONE,
+                           0, 0);
 }
 
-float PS6000::getTriggerPosition()
-{
-  return m_triggerPosition;
+void PS6000::setTriggerPosition(float percentage) {
+    m_triggerPosition = percentage;
 }
 
-void PS6000::setEnable(unsigned short ch, bool enable)
-{
-  if(ch>=m_channelCount)
-    throw std::string("Channel out of range"); //: "+ch+"/"+m_channelCount);
+float PS6000::getTriggerPosition() { return m_triggerPosition; }
 
-  m_channelSettings[ch].enabled=enable;
-  initBuffer(ch, enable);
+void PS6000::setEnable(unsigned short ch, bool enable) {
+    if (ch >= m_channelCount)
+        throw std::string(
+            "Channel out of range");  //: "+ch+"/"+m_channelCount);
+
+    m_channelSettings[ch].enabled = enable;
+    initBuffer(ch, enable);
 }
 
-bool PS6000::getEnable(unsigned short ch) const
-{
-  if(ch>=m_channelCount)
-    throw std::string("Channel out of range"); //: "+ch+"/"+m_channelCount);
+bool PS6000::getEnable(unsigned short ch) const {
+    if (ch >= m_channelCount)
+        throw std::string(
+            "Channel out of range");  //: "+ch+"/"+m_channelCount);
 
-  return m_channelSettings[ch].enabled;
+    return m_channelSettings[ch].enabled;
 }
 
-void PS6000::setRange(unsigned short ch, unsigned int range)
-{
-  if(ch>=m_channelCount)
-    throw std::string("Channel out of range"); //: "+ch+"/"+m_channelCount);
+void PS6000::setRange(unsigned short ch, unsigned int range) {
+    if (ch >= m_channelCount)
+        throw std::string(
+            "Channel out of range");  //: "+ch+"/"+m_channelCount);
 
-  int16_t thisRangeIdx=PS6000_MAX_RANGES;
-  for(int16_t rangeIdx=0;rangeIdx<PS6000_MAX_RANGES;rangeIdx++)
-    if(m_availRanges[rangeIdx]==range)
-      thisRangeIdx=rangeIdx;
+    int16_t thisRangeIdx = PS6000_MAX_RANGES;
+    for (int16_t rangeIdx = 0; rangeIdx < PS6000_MAX_RANGES; rangeIdx++)
+        if (m_availRanges[rangeIdx] == range) thisRangeIdx = rangeIdx;
 
-  if(thisRangeIdx==PS6000_MAX_RANGES)
-    throw std::string("Invalid range");
+    if (thisRangeIdx == PS6000_MAX_RANGES) throw std::string("Invalid range");
 
-  m_channelSettings[ch].range=thisRangeIdx;
+    m_channelSettings[ch].range = thisRangeIdx;
 }
 
-unsigned int PS6000::getRange(unsigned short ch) const
-{
-  if(ch>=m_channelCount)
-    throw std::string("Channel out of range"); //: "+ch+"/"+m_channelCount);
+unsigned int PS6000::getRange(unsigned short ch) const {
+    if (ch >= m_channelCount)
+        throw std::string(
+            "Channel out of range");  //: "+ch+"/"+m_channelCount);
 
-  return m_availRanges[m_channelSettings[ch].range];
+    return m_availRanges[m_channelSettings[ch].range];
 }
 
-void PS6000::setPeriod(float period)
-{
-  if(period<=3.2e-9)
-    {
-      m_timebase=logf(period*5000000000)/logf(2);
-      m_period=pow(2,m_timebase)/5000000000;
+void PS6000::setPeriod(float period) {
+    if (period <= 3.2e-9) {
+        m_timebase = logf(period * 5000000000) / logf(2);
+        m_period = pow(2, m_timebase) / 5000000000;
+    } else {
+        m_timebase = period * 156250000 + 4;
+        m_period = (static_cast<float>(m_timebase - 4)) / 156250000;
     }
-  else
-    {
-      m_timebase=period*156250000+4;
-      m_period=((float)(m_timebase-4))/156250000;
-    } 
 }
 
-float PS6000::getPeriod() const
-{ return m_period; }
+float PS6000::getPeriod() const { return m_period; }
 
-void PS6000::configChannels()
-{
-  ps6000SetEts(m_handle, PS6000_ETS_OFF, 0, 0, 0); // Turn off ETS
+void PS6000::configChannels() {
+    ps6000SetEts(m_handle, PS6000_ETS_OFF, 0, 0, 0);  // Turn off ETS
 
-  for(int16_t i = 0; i < m_channelCount; i++) // reset channels to most recent settings
+    for (int16_t i = 0; i < m_channelCount;
+         i++)  // reset channels to most recent settings
     {
-      ps6000SetChannel(m_handle, (PS6000_CHANNEL) (PS6000_CHANNEL_A + i),
-		       m_channelSettings[PS6000_CHANNEL_A + i].enabled,
-		       (PS6000_COUPLING)m_channelSettings[PS6000_CHANNEL_A + i].DCcoupled,
-		       (PS6000_RANGE)m_channelSettings[PS6000_CHANNEL_A + i].range, 0, PS6000_BW_FULL);
-
-      initBuffer(i, m_channelSettings[PS6000_CHANNEL_A + i].enabled);
+        ps6000SetChannel(
+            m_handle, (PS6000_CHANNEL)(PS6000_CHANNEL_A + i),
+            m_channelSettings[PS6000_CHANNEL_A + i].enabled,
+            (PS6000_COUPLING)m_channelSettings[PS6000_CHANNEL_A + i].DCcoupled,
+            (PS6000_RANGE)m_channelSettings[PS6000_CHANNEL_A + i].range, 0,
+            PS6000_BW_FULL);
+
+        initBuffer(i, m_channelSettings[PS6000_CHANNEL_A + i].enabled);
     }
 }
 
-void PS6000::setSamples(uint32_t samples)
-{ 
-  if(samples>PS6000_BUFFER_SIZE)
-    throw std::string("Requested number of samples too big");
-  m_samples=samples; 
+void PS6000::setSamples(uint32_t samples) {
+    if (samples > PS6000_BUFFER_SIZE)
+        throw std::string("Requested number of samples too big");
+    m_samples = samples;
 }
 
-uint32_t PS6000::getSamples()
-{ return m_samples; }
-
-void PS6000::run(std::vector<std::vector<float>> &results)
-{
-  // figure out sampling rate
-  uint32_t realSampleCount=m_samples;
-
-  ps6000GetTimebase2(m_handle, m_timebase, m_samples, &m_period, 0, &realSampleCount, 0);
-  m_period*=1e-9;
-
-  // Gather data
-  uint32_t pretriggerSamples=m_samples*m_triggerPosition;
-  ps6000RunBlock(m_handle, pretriggerSamples, m_samples-pretriggerSamples, m_timebase, 1, nullptr, 0, nullptr, nullptr);
-
-  int16_t ready=0;
-  do
-    {
-      std::this_thread::sleep_for(std::chrono::microseconds(100));
-      ps6000IsReady(m_handle, &ready);
-    } 
-  while(ready==0);
-
-  ps6000GetValues(m_handle, 0, &realSampleCount, 1, PS6000_RATIO_MODE_NONE, 0, nullptr);
-
-  //
-  // Store the data
-  for(int16_t ch = 0, i=0; ch < m_channelCount; ch++)
-    {
-      if(m_channelSettings[ch].enabled)
-   	{
-	  float chfactor=((float)m_availRanges[m_channelSettings[ch].range])/PS6000_MAX_VALUE;
-  	  for(uint j=0;j<realSampleCount;j++)
-	    results[i][j]=m_buffers[ch][j]*chfactor;
-	  i++;
-	}
+uint32_t PS6000::getSamples() { return m_samples; }
+
+void PS6000::run(std::vector<std::vector<float>> &results) {
+    // figure out sampling rate
+    uint32_t realSampleCount = m_samples;
+
+    ps6000GetTimebase2(m_handle, m_timebase, m_samples, &m_period, 0,
+                       &realSampleCount, 0);
+    m_period *= 1e-9;
+
+    // Gather data
+    uint32_t pretriggerSamples = m_samples * m_triggerPosition;
+    ps6000RunBlock(m_handle, pretriggerSamples, m_samples - pretriggerSamples,
+                   m_timebase, 1, nullptr, 0, nullptr, nullptr);
+
+    int16_t ready = 0;
+    do {
+        std::this_thread::sleep_for(std::chrono::microseconds(100));
+        ps6000IsReady(m_handle, &ready);
+    } while (ready == 0);
+
+    ps6000GetValues(m_handle, 0, &realSampleCount, 1, PS6000_RATIO_MODE_NONE, 0,
+                    nullptr);
+
+    //
+    // Store the data
+    for (int16_t ch = 0, i = 0; ch < m_channelCount; ch++) {
+        if (m_channelSettings[ch].enabled) {
+            float chfactor = (static_cast<float>(
+                                 m_availRanges[m_channelSettings[ch].range])) /
+                             PS6000_MAX_VALUE;
+            for (uint j = 0; j < realSampleCount; j++)
+                results[i][j] = m_buffers[ch][j] * chfactor;
+            i++;
+        }
     }
 
-  //
-  // Cleanup
-  ps6000Stop(m_handle);
+    //
+    // Cleanup
+    ps6000Stop(m_handle);
 }
 
-void PS6000::run(std::vector<std::vector<int16_t>> &results)
-{
-  // figure out sampling rate
-  uint32_t realSampleCount=m_samples;
-
-  ps6000GetTimebase2(m_handle, m_timebase, m_samples, &m_period, 0, &realSampleCount, 0);
-  m_period*=1e-9;
-
-  // Gather data
-  uint32_t pretriggerSamples=m_samples*m_triggerPosition;
-  ps6000RunBlock(m_handle, pretriggerSamples, m_samples-pretriggerSamples, m_timebase, 1, nullptr, 0, nullptr, nullptr);
-
-  int16_t ready=0;
-  do
-    {
-      std::this_thread::sleep_for(std::chrono::microseconds(100));
-      ps6000IsReady(m_handle, &ready);
-    } 
-  while(ready==0);
-
-  ps6000GetValues(m_handle, 0, &realSampleCount, 1, PS6000_RATIO_MODE_NONE, 0, nullptr);
-
-  //
-  // Store the data
-  for(int16_t ch = 0, i=0; ch < m_channelCount; ch++)
-    {
-      if(m_channelSettings[ch].enabled)
-   	{
-  	  for(uint j=0;j<realSampleCount;j++)
-	    results[i][j]=m_buffers[ch][j];
-	  i++;
-	}
+void PS6000::run(std::vector<std::vector<int16_t>> &results) {
+    // figure out sampling rate
+    uint32_t realSampleCount = m_samples;
+
+    ps6000GetTimebase2(m_handle, m_timebase, m_samples, &m_period, 0,
+                       &realSampleCount, 0);
+    m_period *= 1e-9;
+
+    // Gather data
+    uint32_t pretriggerSamples = m_samples * m_triggerPosition;
+    ps6000RunBlock(m_handle, pretriggerSamples, m_samples - pretriggerSamples,
+                   m_timebase, 1, nullptr, 0, nullptr, nullptr);
+
+    int16_t ready = 0;
+    do {
+        std::this_thread::sleep_for(std::chrono::microseconds(100));
+        ps6000IsReady(m_handle, &ready);
+    } while (ready == 0);
+
+    ps6000GetValues(m_handle, 0, &realSampleCount, 1, PS6000_RATIO_MODE_NONE, 0,
+                    nullptr);
+
+    //
+    // Store the data
+    for (int16_t ch = 0, i = 0; ch < m_channelCount; ch++) {
+        if (m_channelSettings[ch].enabled) {
+            for (uint j = 0; j < realSampleCount; j++)
+                results[i][j] = m_buffers[ch][j];
+            i++;
+        }
     }
 
-  //
-  // Cleanup
-  ps6000Stop(m_handle);
+    //
+    // Cleanup
+    ps6000Stop(m_handle);
 }
 
-void PS6000::printInfo() const
-{
-  std::cout << "Picoscope 6000 Series" << std::endl;
-  std::cout << " Model: " << std::hex << m_model << std::dec << std::endl;
-  std::cout << " Channels: " << m_channelCount << std::endl;
+void PS6000::printInfo() const {
+    std::cout << "Picoscope 6000 Series" << std::endl;
+    std::cout << " Model: " << std::hex << m_model << std::dec << std::endl;
+    std::cout << " Channels: " << m_channelCount << std::endl;
 }
diff --git a/src/libScope/PS6000.h b/src/libScope/PS6000.h
index b31a8a84..cd8980cd 100644
--- a/src/libScope/PS6000.h
+++ b/src/libScope/PS6000.h
@@ -1,115 +1,103 @@
 #ifndef PS6000_H
 #define PS6000_H
 
-#include "PicoScope.h"
-
 #include <libps6000-1.4/ps6000Api.h>
 
 #include <string>
 
-#define PS6000_BUFFER_SIZE 2097152 // This is a random number
+#include "PicoScope.h"
+
+#define PS6000_BUFFER_SIZE 2097152  // This is a random number
 
-struct CHANNEL_SETTINGS
-{
-  int16_t DCcoupled;
-  int16_t range;
-  int16_t enabled;
+struct CHANNEL_SETTINGS {
+    int16_t DCcoupled;
+    int16_t range;
+    int16_t enabled;
 };
 
-class PS6000 : public PicoScope
-{
-public:
-  enum Model {
-    NONE = 0,
-    PS6402  = 0x6402, //Bandwidth: 350MHz, Memory: 32MS, AWG
-    PS6402A = 0x6402A, //Bandwidth: 250MHz, Memory: 128MS, FG
-    PS6402B = 0x6402B, //Bandwidth: 250MHz, Memory: 256MS, AWG
-    PS6402C = 0x6402C, //Bandwidth: 350MHz, Memory: 256MS, AWG
-    PS6402D = 0x6402D, //Bandwidth: 350MHz, Memory: 512MS, AWG
-    PS6403  = 0x6403, //Bandwidth: 350MHz, Memory: 1GS, AWG
-    PS6403A = 0x6403A, //Bandwidth: 350MHz, Memory: 256MS, FG
-    PS6403B = 0x6403B, //Bandwidth: 350MHz, Memory: 512MS, AWG
-    PS6403C = 0x6403C, //Bandwidth: 350MHz, Memory: 512MS, AWG
-    PS6403D = 0x6403D, //Bandwidth: 350MHz, Memory: 1GS, AWG
-    PS6404  = 0x6404, //Bandwidth: 500MHz, Memory: 1GS, AWG
-    PS6404A = 0x6404A, //Bandwidth: 500MHz, Memory: 512MS, FG
-    PS6404B = 0x6404B, //Bandwidth: 500MHz, Memory: 1GS, AWG
-    PS6404C = 0x6404C, //Bandwidth: 350MHz, Memory: 1GS, AWG
-    PS6404D = 0x6404D, //Bandwidth: 350MHz, Memory: 2GS, AWG
-    PS6407  = 0x6407, //Bandwidth: 1GHz,	 Memory: 2GS, AWG
-  };
-
-  PS6000();
-  virtual ~PS6000();
-
-  virtual void open();
-  virtual void close();
-
-  virtual void setTrigger  (uint8_t ch, float threshold, Direction direction);
-  virtual void unsetTrigger(uint8_t ch);
-
-  virtual void setTriggerPosition(float percentage);
-  virtual float getTriggerPosition();
-
-  virtual void setEnable(unsigned short ch, bool enable);
-  virtual bool getEnable(unsigned short ch) const;
-
-  virtual void setRange(unsigned short ch, unsigned int range);
-  virtual unsigned int getRange(unsigned short ch) const;
-
-  virtual void  setPeriod(float period);
-  virtual float getPeriod() const;
-
-  virtual void configChannels();
-
-  virtual void     setSamples(uint32_t samples);
-  virtual uint32_t getSamples();
-
-  virtual void run(std::vector<std::vector<float>> &results);
-  virtual void run(std::vector<std::vector<int16_t>> &results);
-
-  virtual void printInfo() const;
-
-private:
-  PICO_STATUS m_openStatus;
-  int16_t m_handle =0;
-
-  Model m_model = NONE;
-
-  int16_t m_channelCount;
-  bool m_AWG;
-  int32_t m_awgBufferSize;
-  CHANNEL_SETTINGS m_channelSettings[PS6000_MAX_CHANNELS];
-
-  float m_period;
-  uint32_t m_timebase=0;
-
-  uint32_t m_samples=PS6000_BUFFER_SIZE;
-  float m_triggerPosition=0.;
-
-  // Buffers
-  int16_t* m_buffers[4]={nullptr, nullptr, nullptr, nullptr};
-
-  // Available ranges
-  PS6000_RANGE m_firstRange;
-  PS6000_RANGE m_lastRange;
-
-  uint16_t m_availRanges [PS6000_MAX_RANGES] = {	10,
-							20,
-							50,
-						       100,
-						       200,
-						       500,
-						      1000,
-						      2000,
-						      5000,
-						     10000,
-						     20000,
-						     50000};
-
-  void initInfo();
-
-  void initBuffer  (unsigned short ch,bool init=true);
+class PS6000 : public PicoScope {
+ public:
+    enum Model {
+        NONE = 0,
+        PS6402 = 0x6402,    // Bandwidth: 350MHz, Memory: 32MS, AWG
+        PS6402A = 0x6402A,  // Bandwidth: 250MHz, Memory: 128MS, FG
+        PS6402B = 0x6402B,  // Bandwidth: 250MHz, Memory: 256MS, AWG
+        PS6402C = 0x6402C,  // Bandwidth: 350MHz, Memory: 256MS, AWG
+        PS6402D = 0x6402D,  // Bandwidth: 350MHz, Memory: 512MS, AWG
+        PS6403 = 0x6403,    // Bandwidth: 350MHz, Memory: 1GS, AWG
+        PS6403A = 0x6403A,  // Bandwidth: 350MHz, Memory: 256MS, FG
+        PS6403B = 0x6403B,  // Bandwidth: 350MHz, Memory: 512MS, AWG
+        PS6403C = 0x6403C,  // Bandwidth: 350MHz, Memory: 512MS, AWG
+        PS6403D = 0x6403D,  // Bandwidth: 350MHz, Memory: 1GS, AWG
+        PS6404 = 0x6404,    // Bandwidth: 500MHz, Memory: 1GS, AWG
+        PS6404A = 0x6404A,  // Bandwidth: 500MHz, Memory: 512MS, FG
+        PS6404B = 0x6404B,  // Bandwidth: 500MHz, Memory: 1GS, AWG
+        PS6404C = 0x6404C,  // Bandwidth: 350MHz, Memory: 1GS, AWG
+        PS6404D = 0x6404D,  // Bandwidth: 350MHz, Memory: 2GS, AWG
+        PS6407 = 0x6407,    // Bandwidth: 1GHz, Memory: 2GS, AWG
+    };
+
+    PS6000();
+    virtual ~PS6000();
+
+    virtual void open();
+    virtual void close();
+
+    virtual void setTrigger(uint8_t ch, float threshold, Direction direction);
+    virtual void unsetTrigger(uint8_t ch);
+
+    virtual void setTriggerPosition(float percentage);
+    virtual float getTriggerPosition();
+
+    virtual void setEnable(unsigned short ch, bool enable);
+    virtual bool getEnable(unsigned short ch) const;
+
+    virtual void setRange(unsigned short ch, unsigned int range);
+    virtual unsigned int getRange(unsigned short ch) const;
+
+    virtual void setPeriod(float period);
+    virtual float getPeriod() const;
+
+    virtual void configChannels();
+
+    virtual void setSamples(uint32_t samples);
+    virtual uint32_t getSamples();
+
+    virtual void run(std::vector<std::vector<float>> &results);
+    virtual void run(std::vector<std::vector<int16_t>> &results);
+
+    virtual void printInfo() const;
+
+ private:
+    PICO_STATUS m_openStatus;
+    int16_t m_handle = 0;
+
+    Model m_model = NONE;
+
+    int16_t m_channelCount;
+    bool m_AWG;
+    int32_t m_awgBufferSize;
+    CHANNEL_SETTINGS m_channelSettings[PS6000_MAX_CHANNELS];
+
+    float m_period;
+    uint32_t m_timebase = 0;
+
+    uint32_t m_samples = PS6000_BUFFER_SIZE;
+    float m_triggerPosition = 0.;
+
+    // Buffers
+    int16_t *m_buffers[4] = {nullptr, nullptr, nullptr, nullptr};
+
+    // Available ranges
+    PS6000_RANGE m_firstRange;
+    PS6000_RANGE m_lastRange;
+
+    uint16_t m_availRanges[PS6000_MAX_RANGES] = {
+        10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000};
+
+    void initInfo();
+
+    void initBuffer(unsigned short ch, bool init = true);
 };
 
-#endif // PS6000_H
+#endif  // PS6000_H
diff --git a/src/libScope/PicoScope.h b/src/libScope/PicoScope.h
index 46a2f834..c3bc1885 100644
--- a/src/libScope/PicoScope.h
+++ b/src/libScope/PicoScope.h
@@ -1,53 +1,53 @@
 #ifndef PICOSCOPE_H
 #define PICOSCOPE_H
 
-#include <vector>
-
 #include <stdint.h>
 
-class PicoScope
-{
-public:
-  enum Direction {Rising, Falling};
+#include <vector>
+
+class PicoScope {
+ public:
+    enum Direction { Rising, Falling };
 
-  PicoScope();
-  virtual ~PicoScope();
+    PicoScope();
+    virtual ~PicoScope();
 
-  //
-  // Initialization
-  virtual void open() =0;
-  virtual void close() =0;
+    //
+    // Initialization
+    virtual void open() = 0;
+    virtual void close() = 0;
 
-  //
-  // Trigger configuration
-  virtual void setTrigger  (uint8_t ch, float threshold, Direction direction) =0;
-  virtual void unsetTrigger(uint8_t ch) =0;
+    //
+    // Trigger configuration
+    virtual void setTrigger(uint8_t ch, float threshold,
+                            Direction direction) = 0;
+    virtual void unsetTrigger(uint8_t ch) = 0;
 
-  virtual void setTriggerPosition(float percentage) =0;
-  virtual float getTriggerPosition() =0;
+    virtual void setTriggerPosition(float percentage) = 0;
+    virtual float getTriggerPosition() = 0;
 
-  //
-  // Channel configurations
-  virtual void setEnable(unsigned short ch, bool enable) =0;
-  virtual bool getEnable(unsigned short ch) const =0;
+    //
+    // Channel configurations
+    virtual void setEnable(unsigned short ch, bool enable) = 0;
+    virtual bool getEnable(unsigned short ch) const = 0;
 
-  virtual void setRange(unsigned short ch, unsigned int range) =0;
-  virtual unsigned int getRange(unsigned short ch) const =0;
+    virtual void setRange(unsigned short ch, unsigned int range) = 0;
+    virtual unsigned int getRange(unsigned short ch) const = 0;
 
-  virtual void setPeriod(float period) =0;
-  virtual float getPeriod() const =0;
+    virtual void setPeriod(float period) = 0;
+    virtual float getPeriod() const = 0;
 
-  virtual void configChannels() =0;
+    virtual void configChannels() = 0;
 
-  //
-  // Running stuff
-  virtual void     setSamples(uint32_t samples) =0;
-  virtual uint32_t getSamples() =0;
+    //
+    // Running stuff
+    virtual void setSamples(uint32_t samples) = 0;
+    virtual uint32_t getSamples() = 0;
 
-  virtual void run(std::vector<std::vector<float>> &results) =0;
-  virtual void run(std::vector<std::vector<int16_t>> &results) =0;
+    virtual void run(std::vector<std::vector<float>> &results) = 0;
+    virtual void run(std::vector<std::vector<int16_t>> &results) = 0;
 
-  virtual void printInfo() const =0;
+    virtual void printInfo() const = 0;
 };
 
-#endif // PICOSCOPE_H
+#endif  // PICOSCOPE_H
diff --git a/src/libScope/Tektronix654C.cpp b/src/libScope/Tektronix654C.cpp
index 3baa1346..3b741599 100644
--- a/src/libScope/Tektronix654C.cpp
+++ b/src/libScope/Tektronix654C.cpp
@@ -1,24 +1,24 @@
-// Tektronix programmer manual can be found at https://www.tek.com/manual/tds-family-programmer-manual
+// Tektronix programmer manual can be found at
+// https://www.tek.com/manual/tds-family-programmer-manual
 
 #include "Tektronix654C.h"
-#include "Logger.h"
+
+#include <unistd.h>
+
 #include <fstream>
-#include <string>
-#include <sstream>
 #include <iostream>
-#include <unistd.h>
+#include <sstream>
+#include <string>
 
-Tektronix654C::Tektronix654C(std::string dev, unsigned addr) 
-{
+#include "Logger.h"
+
+Tektronix654C::Tektronix654C(std::string dev, unsigned addr) {
     m_com = new SerialCom(dev, B9600);
     m_addr = addr;
     m_com->send("++auto 0\n\r");
 }
 
-Tektronix654C::~Tektronix654C() 
-{
-    delete m_com;
-}
+Tektronix654C::~Tektronix654C() { delete m_com; }
 
 void Tektronix654C::send(std::string cmd) {
     m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
@@ -36,87 +36,82 @@ std::string Tektronix654C::receive(std::string cmd) {
     m_com->send("++read eoi\n\r");
     std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
     std::string buf;
-    buf=m_com->receive();
+    buf = m_com->receive();
     logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
     return buf;
 }
 
 std::string Tektronix654C::init() {
-     this->send("VERBOSE ON"); 
-     this->send("DATA:WIDTH 2"); // sets data width to 16bit precision DATA:WIDTH { 1 (8 bit)| 2 (16 bit) }
-     return this->receive("*IDN?");
-     return this->receive("DATa:SOUrce?");		
+    this->send("VERBOSE ON");
+    this->send("DATA:WIDTH 2");  // sets data width to 16bit precision
+                                 // DATA:WIDTH { 1 (8 bit)| 2 (16 bit) }
+    return this->receive("*IDN?");
+    return this->receive("DATa:SOUrce?");
 }
 
-//reads the time_base
-std::string Tektronix654C::timeBase(){
-  return this->receive("HORizontal:MAIn:SCAle?");
+// reads the time_base
+std::string Tektronix654C::timeBase() {
+    return this->receive("HORizontal:MAIn:SCAle?");
 }
 
-//retrieves channel vertical position of the "zero voltage baseline" in divisions (could be pos or neg value)
+// retrieves channel vertical position of the "zero voltage baseline" in
+// divisions (could be pos or neg value)
 std::string Tektronix654C::verticalPos(std::string ch) {
-  return this->receive("CH"+ ch + ":POSition?");
+    return this->receive("CH" + ch + ":POSition?");
 }
 
-//retrieves volts/division ([V]/div)
+// retrieves volts/division ([V]/div)
 std::string Tektronix654C::voltDiv(std::string ch) {
- return this->receive("CH"+ ch + ":VOLts?");
+    return this->receive("CH" + ch + ":VOLts?");
 }
 
-//reads waveform data as string
-std::string Tektronix654C::read() 
-{
-  return this->receive("CURVE?").substr(0, std::string::npos); //std::string::npos (until the end of string) retrieves data all at once
+// reads waveform data as string
+std::string Tektronix654C::read() {
+    return this->receive("CURVE?").substr(
+        0, std::string::npos);  // std::string::npos (until the end of string)
+                                // retrieves data all at once
 }
 
-//reads waveform data as string one character at a time
-std::string Tektronix654C::read1char(int n) 
-{
-  return this->receive("CURVE?").substr(n, 1);
+// reads waveform data as string one character at a time
+std::string Tektronix654C::read1char(int n) {
+    return this->receive("CURVE?").substr(n, 1);
 }
 
-//reads waveform data (not string) and displays it to terminal 
-std::string Tektronix654C::curve() {
-  return this->receive("CURVE?");	
-}
+// reads waveform data (not string) and displays it to terminal
+std::string Tektronix654C::curve() { return this->receive("CURVE?"); }
 
-//sets oscilloscope channel to read from
-void Tektronix654C::setCh(std::string ch) {
-    this->send("DATA:SOURCE CH" + ch);
-}
+// sets oscilloscope channel to read from
+void Tektronix654C::setCh(std::string ch) { this->send("DATA:SOURCE CH" + ch); }
 
-//sets oscilloscope reference to read from
+// sets oscilloscope reference to read from
 void Tektronix654C::setRef(std::string ref) {
     this->send("DATA:SOURCE REF" + ref);
 }
 
-//resets waves on scope screen
-void Tektronix654C::rstWave(){
+// resets waves on scope screen
+void Tektronix654C::rstWave() {
     this->send("TRIGGER:MAIN:MODE AUTO");
     std::this_thread::sleep_for(std::chrono::milliseconds(500));
     this->send("TRIGger:MAIn:MODe NORMal");
 }
 
-//Sets the format of the waveform data { ASCIi | RIBinary | RPBinary | SRIbinary | SRPbinary}
+// Sets the format of the waveform data { ASCIi | RIBinary | RPBinary |
+// SRIbinary | SRPbinary}
 void Tektronix654C::setData(std::string data) {
     this->send("DATA:ENCDG " + data);
 }
 
-//Stores a waveform from CH<x> in one of four reference memory locations ( oscilloscipe Ref1, Ref2, Ref3, Ref4 )
+// Stores a waveform from CH<x> in one of four reference memory locations (
+// oscilloscipe Ref1, Ref2, Ref3, Ref4 )
 void Tektronix654C::saveWaveToRef(std::string ch, std::string ref) {
-    this->send("SAVe:WAVEform CH" + ch +",REF" + ref);
+    this->send("SAVe:WAVEform CH" + ch + ",REF" + ref);
 }
 
-//sets port of screenshot (picture) to GPIB
-void Tektronix654C::hardCopyPort() {
-    this->send("HARDCopy:PORT FILE");
-}
+// sets port of screenshot (picture) to GPIB
+void Tektronix654C::hardCopyPort() { this->send("HARDCopy:PORT FILE"); }
 
-//sets picture type
+// sets picture type
 void Tektronix654C::hardCopyFormat() {
- this->send("HARDCopy:PALEtte HARDCOPY");
-this->send("HARDCopy:FORMat BMPCOLOR");
+    this->send("HARDCopy:PALEtte HARDCOPY");
+    this->send("HARDCopy:FORMat BMPCOLOR");
 }
-
-
-
diff --git a/src/libScope/Tektronix654C.h b/src/libScope/Tektronix654C.h
index 592df410..724b42e8 100644
--- a/src/libScope/Tektronix654C.h
+++ b/src/libScope/Tektronix654C.h
@@ -8,41 +8,41 @@
 // Notes: Assuming Prologix GPIB to USB
 // ###################
 
+#include <chrono>
 #include <iostream>
 #include <string>
 #include <thread>
-#include <chrono>
 
 #include "SerialCom.h"
 
 class Tektronix654C {
-    public:
-        Tektronix654C(std::string dev, unsigned addr);
-        ~Tektronix654C();
-
-        std::string init();
-	std::string curve();
-        std::string read();
-	std::string read1char(int n);
-        void setCh(std::string ch);
-	void setRef(std::string ref);
-	void setData(std::string data);
-	void saveWaveToRef(std::string ch, std::string ref); 
-	void hardCopyPort();
-	void hardCopyFormat();
-	std::string verticalPos(std::string ch);
-	std::string voltDiv(std::string ch);
-	std::string timeBase();
-	void rstWave();
-
-    private:
-        SerialCom *m_com;
-        unsigned m_addr;
-
-        void send(std::string cmd);
-        std::string receive(std::string cmd);
-        
-        std::chrono::milliseconds m_wait{300};
+ public:
+    Tektronix654C(std::string dev, unsigned addr);
+    ~Tektronix654C();
+
+    std::string init();
+    std::string curve();
+    std::string read();
+    std::string read1char(int n);
+    void setCh(std::string ch);
+    void setRef(std::string ref);
+    void setData(std::string data);
+    void saveWaveToRef(std::string ch, std::string ref);
+    void hardCopyPort();
+    void hardCopyFormat();
+    std::string verticalPos(std::string ch);
+    std::string voltDiv(std::string ch);
+    std::string timeBase();
+    void rstWave();
+
+ private:
+    SerialCom *m_com;
+    unsigned m_addr;
+
+    void send(std::string cmd);
+    std::string receive(std::string cmd);
+
+    std::chrono::milliseconds m_wait{300};
 };
 
 #endif
diff --git a/src/libUtils/ClassRegistry.h b/src/libUtils/ClassRegistry.h
index 939a8a24..8786b34f 100644
--- a/src/libUtils/ClassRegistry.h
+++ b/src/libUtils/ClassRegistry.h
@@ -1,27 +1,24 @@
 #ifndef LABREMOTE_CLASS_REGISTRY_H
 #define LABREMOTE_CLASS_REGISTRY_H
 
-#include <vector>
 #include <functional>
 #include <map>
-#include <string>
 #include <memory>
 #include <stdexcept>
+#include <string>
+#include <vector>
 
 namespace EquipRegistry {
 
 template <typename T, typename... A>
 class ClassRegistry {
-
     typedef std::function<std::shared_ptr<T>(A... args)> FunctionType;
     typedef std::map<std::string, FunctionType> MapType;
 
     MapType registry;
 
  public:
-
-    bool registerClass(const std::string& name,
-                       FunctionType func) {
+    bool registerClass(const std::string& name, FunctionType func) {
         registry[name] = func;
         return true;
     }
@@ -29,20 +26,20 @@ class ClassRegistry {
     std::shared_ptr<T> makeClass(const std::string& name, A... args) {
         try {
             return registry.at(name)(args...);
-        } catch(std::out_of_range &e) {
+        } catch (std::out_of_range& e) {
             return nullptr;
         }
     }
 
     std::vector<std::string> listClasses() {
         std::vector<std::string> known;
-        for (auto &i: registry) {
+        for (auto& i : registry) {
             known.push_back(i.first);
         }
         return known;
     }
 };
 
-} //namespace EquipRegistry
+}  // namespace EquipRegistry
 
 #endif
diff --git a/src/libUtils/Logger.cpp b/src/libUtils/Logger.cpp
index 40a2b7a3..a0597334 100644
--- a/src/libUtils/Logger.cpp
+++ b/src/libUtils/Logger.cpp
@@ -1,52 +1,41 @@
 #include "Logger.h"
 
-loglevel_e logIt::loglevel =  logINFO;
+loglevel_e logIt::loglevel = logINFO;
 
 const std::string logIt::logString[] = {
-					"\033[1;31m[ERROR]   : \033[0m",
-					"\033[1;33m[WARNING] : \033[0m",
-					"\033[1;32m[INFO]    : \033[0m",
-					"\033[1;34m[DEBUG]   : \033[0m",
-					"\033[1;34m[DEBUG1]  : \033[0m" ,
-					"\033[1;34m[DEBUG2]  : \033[0m" ,
-					"\033[1;34m[DEBUG3]  : \033[0m" ,
-					"\033[1;34m[DEBUG4]  : \033[0m"
-};
+    "\033[1;31m[ERROR]   : \033[0m", "\033[1;33m[WARNING] : \033[0m",
+    "\033[1;32m[INFO]    : \033[0m", "\033[1;34m[DEBUG]   : \033[0m",
+    "\033[1;34m[DEBUG1]  : \033[0m", "\033[1;34m[DEBUG2]  : \033[0m",
+    "\033[1;34m[DEBUG3]  : \033[0m", "\033[1;34m[DEBUG4]  : \033[0m"};
 
-logIt::logIt(loglevel_e _loglevel)
-{
-  _buffer << logString[_loglevel];
-}
+logIt::logIt(loglevel_e _loglevel) { _buffer << logString[_loglevel]; }
 
-logIt::~logIt()
-{
-  _buffer << std::endl;
-  // This is atomic according to the POSIX standard
-  // http://www.gnu.org/s/libc/manual/html_node/Streams-and-Threads.html
-  std::cerr << _buffer.str();
+logIt::~logIt() {
+    _buffer << std::endl;
+    // This is atomic according to the POSIX standard
+    // http://www.gnu.org/s/libc/manual/html_node/Streams-and-Threads.html
+    std::cerr << _buffer.str();
 }
 
-void logIt::incrDebug()
-{
-  switch(loglevel)
-    {
-    case logDEBUG:
-      loglevel= logDEBUG1;
-      break;
-    case logDEBUG1:
-      loglevel= logDEBUG2;
-      break;
-    case logDEBUG2:
-      loglevel= logDEBUG3;
-      break;
-    case logDEBUG3:
-      loglevel= logDEBUG4;
-      break;
-    case logDEBUG4:
-      loglevel= loglevel;
-      break;
-    default:
-      loglevel= logDEBUG;
-      break;
+void logIt::incrDebug() {
+    switch (loglevel) {
+        case logDEBUG:
+            loglevel = logDEBUG1;
+            break;
+        case logDEBUG1:
+            loglevel = logDEBUG2;
+            break;
+        case logDEBUG2:
+            loglevel = logDEBUG3;
+            break;
+        case logDEBUG3:
+            loglevel = logDEBUG4;
+            break;
+        case logDEBUG4:
+            loglevel = loglevel;
+            break;
+        default:
+            loglevel = logDEBUG;
+            break;
     }
 }
diff --git a/src/libUtils/Logger.h b/src/libUtils/Logger.h
index 31260783..e1d1c8cc 100644
--- a/src/libUtils/Logger.h
+++ b/src/libUtils/Logger.h
@@ -5,7 +5,7 @@
 // Lightweight logger
 // Author: Timon Heim
 // Date: Feb 2017
-// Notes: 
+// Notes:
 // ###################
 
 #include <iostream>
@@ -18,38 +18,46 @@
  * files via the command line
  */
 
-enum loglevel_e
-{logERROR=0, logWARNING=1, logINFO=2, logDEBUG=3, logDEBUG1=4, logDEBUG2=5, logDEBUG3=6, logDEBUG4=7};
+enum loglevel_e {
+    logERROR = 0,
+    logWARNING = 1,
+    logINFO = 2,
+    logDEBUG = 3,
+    logDEBUG1 = 4,
+    logDEBUG2 = 5,
+    logDEBUG3 = 6,
+    logDEBUG4 = 7
+};
 
 /** \brief Pretty formatted line of output
  */
-class logIt
-{
-public:
-  logIt(loglevel_e _loglevel = logERROR);
-  ~logIt();
-
-  template <typename T>
-  logIt & operator<<(T const & value)
-  {
-    _buffer << value;
-    return *this;
-  }
-
-public:
-  static loglevel_e loglevel;
-
-  /** \brief increment debug level of global logging up to maxium allowed
-   */
-  static void incrDebug();
-
-private:
-  std::ostringstream _buffer;
-  static const std::string logString[8];
+class logIt {
+ public:
+    logIt(loglevel_e _loglevel = logERROR);
+    ~logIt();
+
+    template <typename T>
+    logIt& operator<<(T const& value) {
+        _buffer << value;
+        return *this;
+    }
+
+ public:
+    static loglevel_e loglevel;
+
+    /** \brief increment debug level of global logging up to maxium allowed
+     */
+    static void incrDebug();
+
+ private:
+    std::ostringstream _buffer;
+    static const std::string logString[8];
 };
 
-#define logger(level)				\
-  if (level > logIt::loglevel) ;		\
-  else logIt(level)
+#define logger(level)            \
+    if (level > logIt::loglevel) \
+        ;                        \
+    else                         \
+        logIt(level)
 
 #endif
diff --git a/src/libWaferProb/ControllerBase.cpp b/src/libWaferProb/ControllerBase.cpp
index c955d2f4..0fbd2d17 100644
--- a/src/libWaferProb/ControllerBase.cpp
+++ b/src/libWaferProb/ControllerBase.cpp
@@ -1,105 +1,102 @@
 #include "ControllerBase.h"
-#include "Helper.h"
 
 #include <stdio.h>
+
 #include <sstream>
 
-ControllerBase::ControllerBase()
-{
-	status = -1;
-	m_is_connected = false;
-	m_z_calibrated = true;
-}
+#include "Helper.h"
 
-ControllerBase::~ControllerBase(){
+ControllerBase::ControllerBase() {
+    status = -1;
+    m_is_connected = false;
+    m_z_calibrated = true;
 }
 
-void ControllerBase::print_cmd(){
-	printf( "MA X 10  --> move X-axis w.r.t home position 10 millimeter\n"
-			"MR X 10 --> move X-axis w.r.t current position 10 millimeter\n"
-			"SP X 10  --> set speed in x-axis direction by 10 millimeter/s\n"
-			"SH --> move to HOME\n"
-			"SM --> move to center\n"
-			"FZRANGE --> find maximum and minimum of Z-axis\n"
-			"FZMIN --> find minimum of Z-axis\n"
-			"CHECKZMIN --> check the minimum position of Z-axis\n"
-			"XY_PARK --> park the xy controller \n"
-			"XY_UNPARK --> unpark the xy controller \n"
-			"POLL_POS --> poll positions of controllers\n"
-			"----------------------------------------------------------\n"
-	      );
+ControllerBase::~ControllerBase() {}
+
+void ControllerBase::print_cmd() {
+    printf(
+        "MA X 10  --> move X-axis w.r.t home position 10 millimeter\n"
+        "MR X 10 --> move X-axis w.r.t current position 10 millimeter\n"
+        "SP X 10  --> set speed in x-axis direction by 10 millimeter/s\n"
+        "SH --> move to HOME\n"
+        "SM --> move to center\n"
+        "FZRANGE --> find maximum and minimum of Z-axis\n"
+        "FZMIN --> find minimum of Z-axis\n"
+        "CHECKZMIN --> check the minimum position of Z-axis\n"
+        "XY_PARK --> park the xy controller \n"
+        "XY_UNPARK --> unpark the xy controller \n"
+        "POLL_POS --> poll positions of controllers\n"
+        "----------------------------------------------------------\n");
 }
 
 int ControllerBase::run_cmd(const string& cmd) {
-	printf("HELLO??? %s\n", cmd.c_str());
-	int axis = -1;
+    printf("HELLO??? %s\n", cmd.c_str());
+    int axis = -1;
 
-	if(cmd.empty()){
-		return axis;
-	}
-	vector<string> raw_items;
-	WaferProb::tokenizeString(cmd, ' ', raw_items);
+    if (cmd.empty()) {
+        return axis;
+    }
+    vector<string> raw_items;
+    WaferProb::tokenizeString(cmd, ' ', raw_items);
 
-	vector<string> items;
-	// convert commands to upper case.
-	for(auto& item: raw_items){
-		items.push_back(WaferProb::toUpper(item));
-	}
+    vector<string> items;
+    // convert commands to upper case.
+    for (auto& item : raw_items) {
+        items.push_back(WaferProb::toUpper(item));
+    }
 
-	const string& action(items[0]);
+    const string& action(items[0]);
 
-	// Check each case..
-	if (action == "MA")
-	{
-		if(items.size() != 3){
-			printf("argument of MA is wrong\n"
-					"MA X/Y/Z 10\n");
-			return axis;
-		}
-		axis = WaferProb::axis_number(items[1]);
-		this->mv_abs(axis, atof(items[2].c_str()));
-	} else if (action == "MR")
-	{
-		if(items.size() != 3){
-			printf("argument of MR is wrong\n"
-					"MR X/Y/Z 10\n");
-			return axis;
-		}
-		axis = WaferProb::axis_number(items[1]);
-		this->mv_rel(axis, atof(items[2].c_str()));
+    // Check each case..
+    if (action == "MA") {
+        if (items.size() != 3) {
+            printf(
+                "argument of MA is wrong\n"
+                "MA X/Y/Z 10\n");
+            return axis;
+        }
+        axis = WaferProb::axis_number(items[1]);
+        this->mv_abs(axis, atof(items[2].c_str()));
+    } else if (action == "MR") {
+        if (items.size() != 3) {
+            printf(
+                "argument of MR is wrong\n"
+                "MR X/Y/Z 10\n");
+            return axis;
+        }
+        axis = WaferProb::axis_number(items[1]);
+        this->mv_rel(axis, atof(items[2].c_str()));
 
-	} else if (action == "SH")
-	{
-		this->set_home();
-		axis = 3;
-	} else if (action == "SM")
-	{
-		this->set_center();
-		axis = 3;
-	} else if (action == "SP")
-	{
-		if (items.size() != 3){
-			printf("argument of SP is wrong\n"
-					"SP X/Y/Z 10000\n");
-			return axis;
-		}
-		axis = WaferProb::axis_number(items[1]);
-		this->set_speed(axis, atof(items[2].c_str()));
-	} else if (action == "FZRANGE") 
-	{
-		this->find_max_min();
-	} else if (action == "FZMIN"){
-		this->find_z_min();
-	} else if (action == "CHECKZMIN") {
-		this->check_z_min();
-	} else if (action == "XY_PARK"){
-		this->xy_park();
-	} else if (action == "XY_UNPARK") {
-		this->xy_unpark();
-	} else {
-		printf("%s not supported yet!\n", action.c_str());
-		print_cmd();
-	}
-	this->get_position();
-	return axis;
+    } else if (action == "SH") {
+        this->set_home();
+        axis = 3;
+    } else if (action == "SM") {
+        this->set_center();
+        axis = 3;
+    } else if (action == "SP") {
+        if (items.size() != 3) {
+            printf(
+                "argument of SP is wrong\n"
+                "SP X/Y/Z 10000\n");
+            return axis;
+        }
+        axis = WaferProb::axis_number(items[1]);
+        this->set_speed(axis, atof(items[2].c_str()));
+    } else if (action == "FZRANGE") {
+        this->find_max_min();
+    } else if (action == "FZMIN") {
+        this->find_z_min();
+    } else if (action == "CHECKZMIN") {
+        this->check_z_min();
+    } else if (action == "XY_PARK") {
+        this->xy_park();
+    } else if (action == "XY_UNPARK") {
+        this->xy_unpark();
+    } else {
+        printf("%s not supported yet!\n", action.c_str());
+        print_cmd();
+    }
+    this->get_position();
+    return axis;
 }
diff --git a/src/libWaferProb/ControllerBase.h b/src/libWaferProb/ControllerBase.h
index 8e55270f..b246d620 100644
--- a/src/libWaferProb/ControllerBase.h
+++ b/src/libWaferProb/ControllerBase.h
@@ -8,55 +8,52 @@
 #include <string>
 
 using namespace std;
-class ControllerBase{
+class ControllerBase {
+ protected:
+    int status;  // 0 is ok, non-zero indicates problems
+    bool m_is_connected;
 
-	protected:
+    // put it public so it's easy to access...
+ public:
+    float m_position[3];
+    bool m_z_calibrated;
 
-		int status; // 0 is ok, non-zero indicates problems
-		bool m_is_connected;
+ public:
+    ControllerBase();
+    virtual ~ControllerBase();
 
-		// put it public so it's easy to access...
-	public:
-		float m_position[3];
-		bool m_z_calibrated;
+    int get_status() { return status; }
+    bool is_connected() { return m_is_connected; }
 
-	public:
-		ControllerBase();
-		virtual ~ControllerBase();
+    // command lines are interpreted by this function.
+    int run_cmd(const string& cmd);
+    void print_cmd();
 
-		int get_status() { return status; }
-		bool is_connected() { return m_is_connected; }
+    virtual int connect() = 0;
+    virtual int disconnect() = 0;
 
-		// command lines are interpreted by this function.
-		int run_cmd(const string& cmd);
-		void print_cmd();
+    virtual int write(const string& cmd) = 0;  // send command to device
 
-		virtual int connect() = 0;
-		virtual int disconnect() = 0;
+    // unit of length: millimeter
+    virtual int set_speed(int axis, float value) = 0;
 
-		virtual int write(const string& cmd) = 0; // send command to device
+    // move w.r.t home-position
+    virtual int mv_abs(int axis, float value) = 0;
+    // move w.r.t current-position
+    virtual int mv_rel(int axis, float value) = 0;
 
-		// unit of length: millimeter
-		virtual int set_speed(int axis, float value) = 0;
+    virtual int stop() = 0;  // stop motion immediately
 
-		// move w.r.t home-position
-		virtual int mv_abs(int axis, float value) = 0;
-		// move w.r.t current-position
-		virtual int mv_rel(int axis, float value) = 0;
+    virtual int get_position() = 0;
 
-		virtual int stop() = 0; // stop motion immediately
-
-		virtual int get_position() = 0;
-
-		virtual int set_home() = 0;
-		virtual int set_center() = 0;
-
-		virtual void find_max_min() { return; }
-		virtual void find_z_min(){ return; }
-		virtual void check_z_min() { return; }
-		virtual bool is_z_calibrated() {return m_z_calibrated; }
-		virtual int xy_park() {return -1;}
-		virtual int xy_unpark() {return -1;}
+    virtual int set_home() = 0;
+    virtual int set_center() = 0;
 
+    virtual void find_max_min() { return; }
+    virtual void find_z_min() { return; }
+    virtual void check_z_min() { return; }
+    virtual bool is_z_calibrated() { return m_z_calibrated; }
+    virtual int xy_park() { return -1; }
+    virtual int xy_unpark() { return -1; }
 };
 #endif
diff --git a/src/libWaferProb/ControllerGalil.cpp b/src/libWaferProb/ControllerGalil.cpp
index 7856f424..308f5458 100644
--- a/src/libWaferProb/ControllerGalil.cpp
+++ b/src/libWaferProb/ControllerGalil.cpp
@@ -1,241 +1,228 @@
+#include "ControllerGalil.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-#include "ControllerGalil.h"
-
 #include <vector>
-#include "Helper.h"
-
-ControllerGalil::ControllerGalil(const char* device_name){
-	char device[256];
-	sprintf(device, "%s --subscribe ALL", device_name);
-	dn = string(device);
-	port = 0;
-	m_position[0] = m_position[1] = m_position[2] = DEFAULT_GALIL_POS;
-	m_raw_position[0] = m_raw_position[1] = m_raw_position[2] = DEFAULT_GALIL_POS;
-	//TO DO: to read in from the text file "z_range.txt"
-	m_ymax = 600000;//765253;
-	m_ymin = -100000;//-364475;
-}
-
-ControllerGalil::~ControllerGalil(){
-	disconnect();
-}
-
-int ControllerGalil::connect(){
-	if(m_is_connected) return 0;
-
-	printf("%s: connecting to device %s\n", __FUNCTION__, dn.c_str());
-	if( check(GOpen(dn.c_str(), &port)) ){
-		printf("%s connected\n", dn.c_str());
-		get_position();
-		status = 0;
-		m_is_connected = true;
-	} else {
-		printf("%s not connected\n", dn.c_str());
-		status = 1;
-	}
-	return status;
-}
-
-int ControllerGalil::disconnect(){
-	if(port != 0){
-		GClose(port);
-		port = 0;
-	}
-	return 0;
-}
-
-int ControllerGalil::write(const string& cmd){
-	if (port == 0){
-		printf("%s is not open\n", dn.c_str());
-		return -1;
-	}
-	char* trimmed;
-	if( ! check(GCmdT(port, cmd.c_str(), buf, sizeof(buf), &trimmed)) )
-	{
-		printf("%s is not recognized\n", cmd.c_str());
-		return -2;
-	}
-	printf("Galil: %s --> %s\n", cmd.c_str(), buf);
-
-	poll_position();
-	return 0;
-}
-
-string* ControllerGalil::write_with_reply(const string& cmd){
-	if (port == 0){
-		printf("%s is not open\n", dn.c_str());
-		return NULL;
-	}
-	char* trimmed;
-	if( ! check(GCmdT(port, cmd.c_str(), buf, sizeof(buf), &trimmed)) )
-	{
-		printf("%s is not recognized\n", cmd.c_str());
-		return NULL;
-	}
-	printf("Galil: %s --> %s\n", cmd.c_str(), buf);
-	string* result = new string(buf);	
-
-	poll_position();	
-	return result;
-}
-
-int ControllerGalil::stop(){
-	int status = write("AB");
-	get_position();
-	return status;
-}
-
-int ControllerGalil::set_speed(int axis, float sp)
-{
-	int steps = convert_mm_to_turns(sp);
-
-	string cmd = generate_cmd("SP", axis, steps);
-	return write(cmd);
-}
 
-int ControllerGalil::mv_abs(int axis, float value){
-	int steps = convert_mm_to_turns(value - m_position[axis]);
-	string cmd = generate_cmd("PR", axis, steps);
-	write(cmd);
-	make_a_move(axis);
-	return 0;
-}
+#include "Helper.h"
 
-int ControllerGalil::mv_rel(int axis, float value){
-	int steps = convert_mm_to_turns(value);
-	string cmd = generate_cmd("PR", axis, steps);
-	printf("%s\n", cmd.c_str());
-	write(cmd);
-	make_a_move(axis);
-	return 0;
+ControllerGalil::ControllerGalil(const char* device_name) {
+    char device[256];
+    sprintf(device, "%s --subscribe ALL", device_name);
+    dn = string(device);
+    port = 0;
+    m_position[0] = m_position[1] = m_position[2] = DEFAULT_GALIL_POS;
+    m_raw_position[0] = m_raw_position[1] = m_raw_position[2] =
+        DEFAULT_GALIL_POS;
+    // TO DO: to read in from the text file "z_range.txt"
+    m_ymax = 600000;   // 765253;
+    m_ymin = -100000;  //-364475;
+}
+
+ControllerGalil::~ControllerGalil() { disconnect(); }
+
+int ControllerGalil::connect() {
+    if (m_is_connected) return 0;
+
+    printf("%s: connecting to device %s\n", __FUNCTION__, dn.c_str());
+    if (check(GOpen(dn.c_str(), &port))) {
+        printf("%s connected\n", dn.c_str());
+        get_position();
+        status = 0;
+        m_is_connected = true;
+    } else {
+        printf("%s not connected\n", dn.c_str());
+        status = 1;
+    }
+    return status;
+}
+
+int ControllerGalil::disconnect() {
+    if (port != 0) {
+        GClose(port);
+        port = 0;
+    }
+    return 0;
+}
+
+int ControllerGalil::write(const string& cmd) {
+    if (port == 0) {
+        printf("%s is not open\n", dn.c_str());
+        return -1;
+    }
+    char* trimmed;
+    if (!check(GCmdT(port, cmd.c_str(), buf, sizeof(buf), &trimmed))) {
+        printf("%s is not recognized\n", cmd.c_str());
+        return -2;
+    }
+    printf("Galil: %s --> %s\n", cmd.c_str(), buf);
+
+    poll_position();
+    return 0;
 }
 
-int ControllerGalil::get_position(){
-	if(port == 0) return -1;
+string* ControllerGalil::write_with_reply(const string& cmd) {
+    if (port == 0) {
+        printf("%s is not open\n", dn.c_str());
+        return NULL;
+    }
+    char* trimmed;
+    if (!check(GCmdT(port, cmd.c_str(), buf, sizeof(buf), &trimmed))) {
+        printf("%s is not recognized\n", cmd.c_str());
+        return NULL;
+    }
+    printf("Galil: %s --> %s\n", cmd.c_str(), buf);
+    string* result = new string(buf);
+
+    poll_position();
+    return result;
+}
+
+int ControllerGalil::stop() {
+    int status = write("AB");
+    get_position();
+    return status;
+}
+
+int ControllerGalil::set_speed(int axis, float sp) {
+    int steps = convert_mm_to_turns(sp);
+
+    string cmd = generate_cmd("SP", axis, steps);
+    return write(cmd);
+}
+
+int ControllerGalil::mv_abs(int axis, float value) {
+    int steps = convert_mm_to_turns(value - m_position[axis]);
+    string cmd = generate_cmd("PR", axis, steps);
+    write(cmd);
+    make_a_move(axis);
+    return 0;
+}
+
+int ControllerGalil::mv_rel(int axis, float value) {
+    int steps = convert_mm_to_turns(value);
+    string cmd = generate_cmd("PR", axis, steps);
+    printf("%s\n", cmd.c_str());
+    write(cmd);
+    make_a_move(axis);
+    return 0;
+}
+
+int ControllerGalil::get_position() {
+    if (port == 0) return -1;
+
+    char* trimmed;
+    GCmdT(port, "RP", buf, sizeof(buf), &trimmed);
+    string data(trimmed);
+    printf("Galic: RP --> %s\n", trimmed);
 
-	char* trimmed;
-	GCmdT(port, "RP", buf, sizeof(buf), &trimmed);
-	string data(trimmed);
-	printf("Galic: RP --> %s\n", trimmed);
-
-	vector<string> raw_items;
-	WaferProb::tokenizeString(data, ',', raw_items);
-	for(int i = 0; i < 3; i++)
-	{
-		float raw_pos = atof(raw_items.at(i).c_str());
-		m_raw_position[i] = raw_pos;
-		m_position[i] = convert_turns_to_mm(raw_pos);
-	}
-	return 0;
+    vector<string> raw_items;
+    WaferProb::tokenizeString(data, ',', raw_items);
+    for (int i = 0; i < 3; i++) {
+        float raw_pos = atof(raw_items.at(i).c_str());
+        m_raw_position[i] = raw_pos;
+        m_position[i] = convert_turns_to_mm(raw_pos);
+    }
+    return 0;
 }
 
+int ControllerGalil::set_home() { return 0; }
 
-int ControllerGalil::set_home(){
-	return 0;
-}
-
-int ControllerGalil::set_center(){
-	return 0;
-}
+int ControllerGalil::set_center() { return 0; }
 
-string ControllerGalil::generate_cmd(const char* cmd, int axis, int steps)
-{
-	char val_str[256];
-	sprintf(val_str, "%d", steps);
-	string cmd_val(",,");
-	cmd_val.insert(axis, val_str);
+string ControllerGalil::generate_cmd(const char* cmd, int axis, int steps) {
+    char val_str[256];
+    sprintf(val_str, "%d", steps);
+    string cmd_val(",,");
+    cmd_val.insert(axis, val_str);
 
-	char res_str[256];
-	sprintf(res_str, "%s %s", cmd, cmd_val.c_str());
-	return string(res_str);
+    char res_str[256];
+    sprintf(res_str, "%s %s", cmd, cmd_val.c_str());
+    return string(res_str);
 }
 
-void ControllerGalil::make_a_move(int axis){
-	if(axis == 2 && !m_z_calibrated) {
-		printf("ERROR, Z-axis is not calibrated!");
-		return;
-	}
-	char mv[256];
-	char axis_name = axis_index_to_name(axis);
-	sprintf(mv, "BG %c", axis_name);
+void ControllerGalil::make_a_move(int axis) {
+    if (axis == 2 && !m_z_calibrated) {
+        printf("ERROR, Z-axis is not calibrated!");
+        return;
+    }
+    char mv[256];
+    char axis_name = axis_index_to_name(axis);
+    sprintf(mv, "BG %c", axis_name);
 
-	write(mv);
-	// block until motion is complete.
-	GMotionComplete(port, string(1, axis_name).c_str());
+    write(mv);
+    // block until motion is complete.
+    GMotionComplete(port, string(1, axis_name).c_str());
 
-	get_position();
+    get_position();
 }
 
-void ControllerGalil::find_max_min()
-{
-	m_z_calibrated = true;
+void ControllerGalil::find_max_min() {
+    m_z_calibrated = true;
 
-	int axis = 2;
-	set_speed(axis, 1); //second argument: mm per s 
-	string cmd = generate_cmd("PA", axis, 1000000);
-	write(cmd);
-	make_a_move(axis);
+    int axis = 2;
+    set_speed(axis, 1);  // second argument: mm per s
+    string cmd = generate_cmd("PA", axis, 1000000);
+    write(cmd);
+    make_a_move(axis);
 
-	get_position();
-	m_ymax = m_raw_position[2];
-	printf("HELLO: %.2f\n", m_ymax);
+    get_position();
+    m_ymax = m_raw_position[2];
+    printf("HELLO: %.2f\n", m_ymax);
 
-	string cmd2 = generate_cmd("PA", axis, -1000000);
-	write(cmd2);
-	make_a_move(axis);
-	get_position();
-	m_ymin = m_raw_position[2];
+    string cmd2 = generate_cmd("PA", axis, -1000000);
+    write(cmd2);
+    make_a_move(axis);
+    get_position();
+    m_ymin = m_raw_position[2];
 
-	printf("range of z-axis in turns: [%.2f, %.2f]\n", m_ymin, m_ymax);
+    printf("range of z-axis in turns: [%.2f, %.2f]\n", m_ymin, m_ymax);
 
-	//float quarter =  (m_ymax - m_ymin)/4;
-	//if (quarter<0) quarter = -quarter;
-	//float quarter_up = m_ymin +  quarter;
-
-	//Move quarter of the range up from the minimum
-	//string cmd3 = generate_cmd("PA", axis, quarter_up);
-	//write(cmd3);
-	//make_a_move(axis);
-	//get_position();
+    // float quarter =  (m_ymax - m_ymin)/4;
+    // if (quarter<0) quarter = -quarter;
+    // float quarter_up = m_ymin +  quarter;
 
+    // Move quarter of the range up from the minimum
+    // string cmd3 = generate_cmd("PA", axis, quarter_up);
+    // write(cmd3);
+    // make_a_move(axis);
+    // get_position();
 }
 
-void ControllerGalil::find_z_min(){
-	m_z_calibrated = true;
+void ControllerGalil::find_z_min() {
+    m_z_calibrated = true;
 
-	int axis = 2;
-	set_speed(axis, 1);
+    int axis = 2;
+    set_speed(axis, 1);
 
-	string cmd = generate_cmd("PA", axis, -1000000);
-	write(cmd);
-	make_a_move(axis);
-	get_position();
-	m_ymin = m_raw_position[2];
-	printf("HELLO: %.2f\n", m_ymin);
+    string cmd = generate_cmd("PA", axis, -1000000);
+    write(cmd);
+    make_a_move(axis);
+    get_position();
+    m_ymin = m_raw_position[2];
+    printf("HELLO: %.2f\n", m_ymin);
 }
 
 void ControllerGalil::check_z_min() {
-	int axis = 2;
-	string cmd2 = generate_cmd("PA", axis, -1000000);
-	write(cmd2);
-	make_a_move(axis);
-	get_position();
-	if (m_position[2] != 0) m_z_calibrated = false;
+    int axis = 2;
+    string cmd2 = generate_cmd("PA", axis, -1000000);
+    write(cmd2);
+    make_a_move(axis);
+    get_position();
+    if (m_position[2] != 0) m_z_calibrated = false;
 }
 
 void ControllerGalil::poll_position() {
-	string *reply, *last_reply; 
-	reply = write_with_reply("TP");
-	sleep(1);
-	last_reply = write_with_reply("TP");
-	while (*last_reply != *reply) {
-		reply = write_with_reply("TP");
-		sleep(1);
-		last_reply = write_with_reply("TP");
-	}
+    string *reply, *last_reply;
+    reply = write_with_reply("TP");
+    sleep(1);
+    last_reply = write_with_reply("TP");
+    while (*last_reply != *reply) {
+        reply = write_with_reply("TP");
+        sleep(1);
+        last_reply = write_with_reply("TP");
+    }
 }
-
diff --git a/src/libWaferProb/ControllerGalil.h b/src/libWaferProb/ControllerGalil.h
index 3eaca738..8a1ea647 100644
--- a/src/libWaferProb/ControllerGalil.h
+++ b/src/libWaferProb/ControllerGalil.h
@@ -1,7 +1,6 @@
 #ifndef __WaferProb_ControllerGalil_H__
 #define __WaferProb_ControllerGalil_H__
 
-
 #ifndef I_7B02A40E_869B_4650_A5A8_859F0A6E3325
 #define I_7B02A40E_869B_4650_A5A8_859F0A6E3325
 #endif
@@ -9,78 +8,75 @@
 #include "gclib.h"
 #include "gclibo.h"
 
-#define GALIL_EXAMPLE_OK G_NO_ERROR //return code for correct code execution
-#define GALIL_EXAMPLE_ERROR -100 //return code for error in example code
+#define GALIL_EXAMPLE_OK G_NO_ERROR  // return code for correct code execution
+#define GALIL_EXAMPLE_ERROR -100     // return code for error in example code
 
 #define DEFAULT_GALIL_POS -2
 
-#include "ControllerBase.h"
-
 #include <string>
 
-using namespace std;
-class ControllerGalil : public ControllerBase
-{
-	private:
-		GCon port; // port connected to Galil
-		string dn; // device name
-
-	public:
-		ControllerGalil(const char* device_name);
-		~ControllerGalil();
-
-		int connect();
-		int disconnect();
-
-		int write(const string& cmd);
-		string* write_with_reply(const string& cmd);
-
-		int set_speed(int axis, float sp);
-
-		int mv_abs(int axis, float value);
-		int mv_rel(int axis, float value);
-		int stop();
-
-		int get_position();
-		int get_speed();
-
-		int set_home();
-		int set_center();
-
-		void find_max_min();
-		void find_z_min();
-		void check_z_min();
-		void poll_position();
-	public:
-		// 14.2 mili-meter is the total distance the Z-axis can travel.
-		// project the absolute turns (or position) to the 14.2 mm length
-		// lowest position would be zero, while highest position is 14.2 mm.
-		float m_raw_position[3];
-		float m_ymax; // turns at the top, --> 14.2mm
-		float m_ymin; // turns at the bottom, --> 0
-	private:
-		inline bool check(GReturn rc){
-			return (rc == G_NO_ERROR);
-		}
-		int convert_mm_to_turns(float value)
-		{
-			// value is the relative distance.
-			return value* (m_ymax - m_ymin)/14.2;
-		}
-		float convert_turns_to_mm(float turns){
-			float res = 14.2*(turns - m_ymin)/(m_ymax - m_ymin);
-			res = (int)(res*1000) / 1000.;
-			return res;
-		}
-		char axis_index_to_name(int axis){
-			// ABC is for XYZ!
-			// axis starts from 0 to 2;
-			return 'A'+axis;
-		}
-		string generate_cmd(const char* cmd, int axis, int steps);
-		void make_a_move(int axis);
-		char buf[1024];
+#include "ControllerBase.h"
 
+using namespace std;
+class ControllerGalil : public ControllerBase {
+ private:
+    GCon port;  // port connected to Galil
+    string dn;  // device name
+
+ public:
+    ControllerGalil(const char* device_name);
+    ~ControllerGalil();
+
+    int connect();
+    int disconnect();
+
+    int write(const string& cmd);
+    string* write_with_reply(const string& cmd);
+
+    int set_speed(int axis, float sp);
+
+    int mv_abs(int axis, float value);
+    int mv_rel(int axis, float value);
+    int stop();
+
+    int get_position();
+    int get_speed();
+
+    int set_home();
+    int set_center();
+
+    void find_max_min();
+    void find_z_min();
+    void check_z_min();
+    void poll_position();
+
+ public:
+    // 14.2 mili-meter is the total distance the Z-axis can travel.
+    // project the absolute turns (or position) to the 14.2 mm length
+    // lowest position would be zero, while highest position is 14.2 mm.
+    float m_raw_position[3];
+    float m_ymax;  // turns at the top, --> 14.2mm
+    float m_ymin;  // turns at the bottom, --> 0
+
+ private:
+    inline bool check(GReturn rc) { return (rc == G_NO_ERROR); }
+    int convert_mm_to_turns(float value) {
+        // value is the relative distance.
+        return value * (m_ymax - m_ymin) / 14.2;
+    }
+    float convert_turns_to_mm(float turns) {
+        float res = 14.2 * (turns - m_ymin) / (m_ymax - m_ymin);
+        res = static_cast<int>(res * 1000) / 1000.;
+        return res;
+    }
+    char axis_index_to_name(int axis) {
+        // ABC is for XYZ!
+        // axis starts from 0 to 2;
+        return 'A' + axis;
+    }
+    string generate_cmd(const char* cmd, int axis, int steps);
+    void make_a_move(int axis);
+    char buf[1024];
 };
 
 #endif
diff --git a/src/libWaferProb/ControllerZaber.cpp b/src/libWaferProb/ControllerZaber.cpp
index a8a6b555..327a7ab9 100644
--- a/src/libWaferProb/ControllerZaber.cpp
+++ b/src/libWaferProb/ControllerZaber.cpp
@@ -1,212 +1,203 @@
-#include <stdio.h>
+#include "ControllerZaber.h"
 
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+
 #include <vector>
-#include <stdlib.h>
 
-#include "ControllerZaber.h"
 #include "Helper.h"
 
-
 using namespace std;
 
-ControllerZaber::ControllerZaber(const char* device_name):
-	ControllerBase(),
-	dn(device_name)
-{
-	port = -1;
-	m_position[0] = m_position[1] = DEFAULT_ZABER_POS;
-}
-
-int ControllerZaber::connect(){
-	if(m_is_connected) return 0;
-
-	printf("%s:connecting to device %s\n", __FUNCTION__, dn.c_str());
-
-	if( check(za_connect(&port, dn.c_str())) ) {
-		printf("%s connected\n", dn.c_str());
-		status = 0;
-		m_is_connected = true;
-		unpark();
-	} else {
-		printf("%s not connected\n", dn.c_str());
-		status = 1;
-	}
-	return status;
-}
-
-ControllerZaber::~ControllerZaber(){
-	disconnect();
-}
-
-int ControllerZaber::disconnect(){
-	if (port > 0){
-		park();
-		za_disconnect(port);
-		port = -1;
-	}
-	return 0;
-}
-
-int ControllerZaber::write(const string& cmd)
-{
-	if (port < 0){
-		printf("%s is not open!\n", dn.c_str());
-		return -1;
-	}
-	za_send(port, cmd.c_str());
-	char reply[256] = {0};
-	za_receive(port, reply, sizeof(reply));
-	printf("%s -> %s\n", cmd.c_str(), reply);
-
-	poll_until_idle();
-	return 0;
-}
-
-string* ControllerZaber::write_with_reply(const string& cmd)
-{
-	if (port < 0){
-		printf("%s is not open!", dn.c_str());
-		return NULL;
-	}
-	char reply[256] = {0};
-	za_send(port, cmd.c_str());
-	za_receive(port, reply, sizeof(reply));
-	printf("%s -> %s\n", cmd.c_str(), reply);
-	string* result = new string(reply);
-
-	poll_until_idle();
-	return result;
-}
-
-int ControllerZaber::set_speed(int axis, float value)
-{
-	int steps = convert_mm_to_turns(value);
-	char cmd[256];
-	sprintf(cmd, "/1 %d set maxspeed %d\n", axis, steps);
-	return write(cmd);
-}
-
-int ControllerZaber::mv_abs(int axis, float value){
-	int steps = convert_mm_to_turns(value);
-	char cmd[256];
-	sprintf(cmd, "/1 %d move abs %d\n", axis, steps);
-	return write(cmd);
-}
-
-int ControllerZaber::mv_rel(int axis, float value){
-	int steps = convert_mm_to_turns(value);
-	char cmd[256];
-	sprintf(cmd, "/1 %d move rel %d\n", axis, steps);
-	return write(cmd);
-}
-
-int ControllerZaber::get_position()
-{
-	if(port < 0){
-		return 1;
-	}
-	char cmd[256];
-	sprintf(cmd, "/1 get pos\n");
-
-	string* rpy = write_with_reply(cmd) ;
-	if(rpy == NULL) return 2;
-
-	// analyze the reply.
-	struct za_reply decoded_reply;
-	za_decode(&decoded_reply, const_cast<char*>(rpy->c_str()));
-	//  analyze response data.
-	string data(decoded_reply.response_data);
-	if(strncmp(decoded_reply.response_data, "BADDATA", 7) == 0){
-		m_position[0] = m_position[1] = DEFAULT_ZABER_POS;
-	} else {
-		vector<string> raw_items;
-		WaferProb::tokenizeString(data, ' ', raw_items);
-		for(int i = 0; i < (int) raw_items.size(); i++){
-			m_position[i] = (int)(convert_turns_to_mm(atof(raw_items.at(i).c_str()))*1000) / 1000.;
-		}
-	}
-	return 0;
-}
-
-int ControllerZaber::set_home(){
-	return write("/home\n");
-}
-
-int ControllerZaber::set_center(){
-	// 1952000/2. = 976000
-	return write("/move abs 976000\n");
-}
-
-int ControllerZaber::park(){
-	int status = write("/tools parking park\n");
-	if(status == 0){
-		printf("%s is parked\n", dn.c_str());
-	}
-	return status; 
-}
-
-int ControllerZaber::unpark()
-{
-	int status = write("/tools parking unpark\n");
-	if(status == 0){
-		printf("%s is unparked\n", dn.c_str());
-	} else {
-		printf("%s cannot unparked\n", dn.c_str());
-	}
-	return status;
-}
-
-int ControllerZaber::stop(){
-	int status = write("/estop\n");
-	get_position();
-	return status;
-}
-
-
-int ControllerZaber::convert_mm_to_turns(float value){
-	// value should be in millimeter.
-	// turns: 1952000 turns
-	// length: 305 millimeter
-	return value * 6400;
-}
-
-float ControllerZaber::convert_turns_to_mm(float turns){
-	return turns * 305. / 1952000.; 
-}
-
-void ControllerZaber::poll_until_idle(){
-	char reply[256] = { 0 };
-	char pos_reply[256] = { 0 };
-	struct za_reply decoded_reply;
-	const struct timespec ts = { 0, 100000000 }; /* 100mil nanosec = 100ms */
-
-	/* We use za_decode() to decode this string into more manageable parts,
-	 * sorting them into the fields of a za_reply struct, then we test
-	 * the device_status field. Possible values for device_status are "IDLE"
-	 * and "BUSY". */
-	int count = 0;
-	for(;;)
-	{
-		za_send(port, "/\n");
-		za_receive(port, reply, sizeof(reply));
-		za_decode(&decoded_reply, reply);
-
-		if(strncmp(decoded_reply.device_status, "BUSY", 4) == 0) {
-			nanosleep(&ts, NULL); /* If we're busy, wait then try again */
-		}
-		else {
-			break;
-		}
-		
-		za_send(port, "/get pos\n");
-		za_receive(port, pos_reply, sizeof(pos_reply));
-		printf(pos_reply); 
-		printf("\n");
-		if (count > 1000){break;} else{count ++;}
-	}
-}
-
-const char* ControllerZaber::device_name(){
-	return dn.c_str();
+ControllerZaber::ControllerZaber(const char* device_name)
+    : ControllerBase(), dn(device_name) {
+    port = -1;
+    m_position[0] = m_position[1] = DEFAULT_ZABER_POS;
+}
+
+int ControllerZaber::connect() {
+    if (m_is_connected) return 0;
+
+    printf("%s:connecting to device %s\n", __FUNCTION__, dn.c_str());
+
+    if (check(za_connect(&port, dn.c_str()))) {
+        printf("%s connected\n", dn.c_str());
+        status = 0;
+        m_is_connected = true;
+        unpark();
+    } else {
+        printf("%s not connected\n", dn.c_str());
+        status = 1;
+    }
+    return status;
+}
+
+ControllerZaber::~ControllerZaber() { disconnect(); }
+
+int ControllerZaber::disconnect() {
+    if (port > 0) {
+        park();
+        za_disconnect(port);
+        port = -1;
+    }
+    return 0;
+}
+
+int ControllerZaber::write(const string& cmd) {
+    if (port < 0) {
+        printf("%s is not open!\n", dn.c_str());
+        return -1;
+    }
+    za_send(port, cmd.c_str());
+    char reply[256] = {0};
+    za_receive(port, reply, sizeof(reply));
+    printf("%s -> %s\n", cmd.c_str(), reply);
+
+    poll_until_idle();
+    return 0;
+}
+
+string* ControllerZaber::write_with_reply(const string& cmd) {
+    if (port < 0) {
+        printf("%s is not open!", dn.c_str());
+        return NULL;
+    }
+    char reply[256] = {0};
+    za_send(port, cmd.c_str());
+    za_receive(port, reply, sizeof(reply));
+    printf("%s -> %s\n", cmd.c_str(), reply);
+    string* result = new string(reply);
+
+    poll_until_idle();
+    return result;
 }
+
+int ControllerZaber::set_speed(int axis, float value) {
+    int steps = convert_mm_to_turns(value);
+    char cmd[256];
+    sprintf(cmd, "/1 %d set maxspeed %d\n", axis, steps);
+    return write(cmd);
+}
+
+int ControllerZaber::mv_abs(int axis, float value) {
+    int steps = convert_mm_to_turns(value);
+    char cmd[256];
+    sprintf(cmd, "/1 %d move abs %d\n", axis, steps);
+    return write(cmd);
+}
+
+int ControllerZaber::mv_rel(int axis, float value) {
+    int steps = convert_mm_to_turns(value);
+    char cmd[256];
+    sprintf(cmd, "/1 %d move rel %d\n", axis, steps);
+    return write(cmd);
+}
+
+int ControllerZaber::get_position() {
+    if (port < 0) {
+        return 1;
+    }
+    char cmd[256];
+    sprintf(cmd, "/1 get pos\n");
+
+    string* rpy = write_with_reply(cmd);
+    if (rpy == NULL) return 2;
+
+    // analyze the reply.
+    struct za_reply decoded_reply;
+    za_decode(&decoded_reply, const_cast<char*>(rpy->c_str()));
+    //  analyze response data.
+    string data(decoded_reply.response_data);
+    if (strncmp(decoded_reply.response_data, "BADDATA", 7) == 0) {
+        m_position[0] = m_position[1] = DEFAULT_ZABER_POS;
+    } else {
+        vector<string> raw_items;
+        WaferProb::tokenizeString(data, ' ', raw_items);
+        for (size_t i = 0; i < raw_items.size(); i++) {
+            m_position[i] =
+                static_cast<int>(
+                    convert_turns_to_mm(atof(raw_items.at(i).c_str())) * 1000) /
+                1000.;
+        }
+    }
+    return 0;
+}
+
+int ControllerZaber::set_home() { return write("/home\n"); }
+
+int ControllerZaber::set_center() {
+    // 1952000/2. = 976000
+    return write("/move abs 976000\n");
+}
+
+int ControllerZaber::park() {
+    int status = write("/tools parking park\n");
+    if (status == 0) {
+        printf("%s is parked\n", dn.c_str());
+    }
+    return status;
+}
+
+int ControllerZaber::unpark() {
+    int status = write("/tools parking unpark\n");
+    if (status == 0) {
+        printf("%s is unparked\n", dn.c_str());
+    } else {
+        printf("%s cannot unparked\n", dn.c_str());
+    }
+    return status;
+}
+
+int ControllerZaber::stop() {
+    int status = write("/estop\n");
+    get_position();
+    return status;
+}
+
+int ControllerZaber::convert_mm_to_turns(float value) {
+    // value should be in millimeter.
+    // turns: 1952000 turns
+    // length: 305 millimeter
+    return value * 6400;
+}
+
+float ControllerZaber::convert_turns_to_mm(float turns) {
+    return turns * 305. / 1952000.;
+}
+
+void ControllerZaber::poll_until_idle() {
+    char reply[256] = {0};
+    char pos_reply[256] = {0};
+    struct za_reply decoded_reply;
+    const struct timespec ts = {0, 100000000}; /* 100mil nanosec = 100ms */
+
+    /* We use za_decode() to decode this string into more manageable parts,
+     * sorting them into the fields of a za_reply struct, then we test
+     * the device_status field. Possible values for device_status are "IDLE"
+     * and "BUSY". */
+    int count = 0;
+    for (;;) {
+        za_send(port, "/\n");
+        za_receive(port, reply, sizeof(reply));
+        za_decode(&decoded_reply, reply);
+
+        if (strncmp(decoded_reply.device_status, "BUSY", 4) == 0) {
+            nanosleep(&ts, NULL); /* If we're busy, wait then try again */
+        } else {
+            break;
+        }
+
+        za_send(port, "/get pos\n");
+        za_receive(port, pos_reply, sizeof(pos_reply));
+        printf(pos_reply);
+        printf("\n");
+        if (count > 1000) {
+            break;
+        } else {
+            count++;
+        }
+    }
+}
+
+const char* ControllerZaber::device_name() { return dn.c_str(); }
diff --git a/src/libWaferProb/ControllerZaber.h b/src/libWaferProb/ControllerZaber.h
index 1bb11cfc..bbb342ca 100644
--- a/src/libWaferProb/ControllerZaber.h
+++ b/src/libWaferProb/ControllerZaber.h
@@ -7,57 +7,56 @@
 
 #include <string>
 
-#include "za_serial.h" // Driver of Zaber
 #include "ControllerBase.h"
+#include "za_serial.h"  // Driver of Zaber
 
 using namespace std;
-class ControllerZaber : public ControllerBase
-{
-	private:
-		z_port port; //port connected to Zaber
-		string dn; // device name
+class ControllerZaber : public ControllerBase {
+ private:
+    z_port port;  // port connected to Zaber
+    string dn;    // device name
 
-	public: // implement controller's interface
-		ControllerZaber(const char* device_name);
-		~ControllerZaber();
+ public:  // implement controller's interface
+    ControllerZaber(const char* device_name);
+    ~ControllerZaber();
 
-		int connect();
-		int disconnect();
+    int connect();
+    int disconnect();
 
-		string* write_with_reply(const string& cmd);
+    string* write_with_reply(const string& cmd);
 
-		int write(const string& cmd);
+    int write(const string& cmd);
 
-		int set_speed(int axis, float sp);
+    int set_speed(int axis, float sp);
 
-		int mv_abs(int axis, float value); // move w.r.t home-position
-		int mv_rel(int axis, float value); // move w.r.t current-position
-		int stop();
+    int mv_abs(int axis, float value);  // move w.r.t home-position
+    int mv_rel(int axis, float value);  // move w.r.t current-position
+    int stop();
 
-		// get current position
-		int get_position();
-		int get_speed();
+    // get current position
+    int get_position();
+    int get_speed();
 
-		int set_home();
-		int set_center();
+    int set_home();
+    int set_center();
 
-		const char* device_name();
+    const char* device_name();
 
-	public:
-		// park the device: lock it so that when powered up, 
-		// don't need to homed.
-		int park();
-		int unpark();
+ public:
+    // park the device: lock it so that when powered up,
+    // don't need to homed.
+    int park();
+    int unpark();
 
-	private:
-		// convert mili-meter to number of turns/steps
-		int convert_mm_to_turns(float value);
-		float convert_turns_to_mm(float turns);
+ private:
+    // convert mili-meter to number of turns/steps
+    int convert_mm_to_turns(float value);
+    float convert_turns_to_mm(float turns);
 
-		inline bool check(int rc){
-			// if(rc != Z_SUCCESS) throw rc;
-			return (rc == Z_SUCCESS);
-		}
-		void poll_until_idle();
+    inline bool check(int rc) {
+        // if(rc != Z_SUCCESS) throw rc;
+        return (rc == Z_SUCCESS);
+    }
+    void poll_until_idle();
 };
 #endif
diff --git a/src/libWaferProb/Handler.cpp b/src/libWaferProb/Handler.cpp
index b37d7919..cc59a72b 100644
--- a/src/libWaferProb/Handler.cpp
+++ b/src/libWaferProb/Handler.cpp
@@ -1,100 +1,103 @@
 #include "Handler.h"
-#include "Helper.h"
 
-#include <vector>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>  // for sleep()
 
-Handler::Handler(){
-	ctrl = new MotionController("/dev/ttyACM0");
-	ctrl->connect();
+#include <vector>
+
+#include "Helper.h"
+
+Handler::Handler() {
+    ctrl = new MotionController("/dev/ttyACM0");
+    ctrl->connect();
 }
 
-Handler::~Handler(){
-	ctrl->disconnect();
-	delete ctrl;
+Handler::~Handler() {
+    ctrl->disconnect();
+    delete ctrl;
 }
 
-void Handler::print_cmd(){
-	printf("MA X 10  --> move X-axis w.r.t home position 10 millimeter\n"
-			"MR X 10 --> move X-axis w.r.t current position 10 millimeter\n"
-			"SP X 10  --> set speed in x-axis direction by 10 millimeter/s\n"
-			"SH --> move to HOME\n"
-			"SM --> move to center\n"
-			"SZC --> set needles contact with chip\n"
-			"SZS --> set needles separate from chip\n"
-			"SZD 10 --> set distance in z-axis in order to separate needle and chip.\n"
-			"TESTX --> move x from 0 to 305 with pre-defined steps\n"
-			"----------------------------------------------------------\n"
-			// "MVC X P --> move to positive x-axis direction, continuously\n" 
-			// "MVC X N --> move to negative x-axis direction, continuously\n"  
-	      );
+void Handler::print_cmd() {
+    printf(
+        "MA X 10  --> move X-axis w.r.t home position 10 millimeter\n"
+        "MR X 10 --> move X-axis w.r.t current position 10 millimeter\n"
+        "SP X 10  --> set speed in x-axis direction by 10 millimeter/s\n"
+        "SH --> move to HOME\n"
+        "SM --> move to center\n"
+        "SZC --> set needles contact with chip\n"
+        "SZS --> set needles separate from chip\n"
+        "SZD 10 --> set distance in z-axis in order to separate needle and "
+        "chip.\n"
+        "TESTX --> move x from 0 to 305 with pre-defined steps\n"
+        "----------------------------------------------------------\n"
+        // "MVC X P --> move to positive x-axis direction, continuously\n"
+        // "MVC X N --> move to negative x-axis direction, continuously\n"
+    );
 }
 
 void Handler::write(const string& cmd) {
-	float unit_scale = 1000.;
-	if(cmd.empty()){
-		return;
-	}
-	vector<string> raw_items;
-	WaferProb::tokenizeString(cmd, ' ', raw_items);
+    float unit_scale = 1000.;
+    if (cmd.empty()) {
+        return;
+    }
+    vector<string> raw_items;
+    WaferProb::tokenizeString(cmd, ' ', raw_items);
 
-	vector<string> items;
-	// convert commands to uppercase
-	for(auto& item: raw_items){
-		items.push_back(WaferProb::toUpper(item)); 
-	}
+    vector<string> items;
+    // convert commands to uppercase
+    for (auto& item : raw_items) {
+        items.push_back(WaferProb::toUpper(item));
+    }
 
-	const string& action(items[0]);
-	// Check each case..
-	if (action == "MA")
-	{
-		if(items.size() != 3){
-			printf("argument of MA is wrong\n"
-					"MA X/Y/Z 10\n");
-			return;
-		}
-		int axis = WaferProb::axis_number(items[1]);
-		ctrl->mv_abs(axis, unit_scale * atof(items[2].c_str()));
-	} else if (action == "MR")
-	{
-		if(items.size() != 3){
-			printf("argument of MR is wrong\n"
-					"MR X/Y/Z 10\n");
-			return;
-		}
-		int axis = WaferProb::axis_number(items[1]);
-		ctrl->mv_rel(axis, unit_scale * atof(items[2].c_str()));
-	} else if (action == "SH")
-	{
-		ctrl->set_home();
-	} else if (action == "SM")
-	{
-		ctrl->set_center();
-	} else if (action == "SP")
-	{
-		if (items.size() != 3){
-			printf("argument of SP is wrong\n"
-					"SP X/Y/Z 10000\n");
-			return;
-		}
-		int axis = WaferProb::axis_number(items[1]);
-		ctrl->set_speed(axis, unit_scale * atof(items[2].c_str()));
-	}else if (action == "TEST"){
-		vector<int> steps{20, 46, 73, 100, 126, 152, 179, 206, 226};
-		if (items.size() != 2){
-			printf("argument of TEST is wrong\n"
-					"TEST X/Y \n");
-			return;
-		}
-		int axis = WaferProb::axis_number(items[1]);
-		for(int step : steps){
-			ctrl->mv_abs(axis, unit_scale * step);
-			sleep(10);
-		}
-	} else {
-		printf("%s not supported yet!\n", action.c_str());
-		// print_cmd();
-	}
+    const string& action(items[0]);
+    // Check each case..
+    if (action == "MA") {
+        if (items.size() != 3) {
+            printf(
+                "argument of MA is wrong\n"
+                "MA X/Y/Z 10\n");
+            return;
+        }
+        int axis = WaferProb::axis_number(items[1]);
+        ctrl->mv_abs(axis, unit_scale * atof(items[2].c_str()));
+    } else if (action == "MR") {
+        if (items.size() != 3) {
+            printf(
+                "argument of MR is wrong\n"
+                "MR X/Y/Z 10\n");
+            return;
+        }
+        int axis = WaferProb::axis_number(items[1]);
+        ctrl->mv_rel(axis, unit_scale * atof(items[2].c_str()));
+    } else if (action == "SH") {
+        ctrl->set_home();
+    } else if (action == "SM") {
+        ctrl->set_center();
+    } else if (action == "SP") {
+        if (items.size() != 3) {
+            printf(
+                "argument of SP is wrong\n"
+                "SP X/Y/Z 10000\n");
+            return;
+        }
+        int axis = WaferProb::axis_number(items[1]);
+        ctrl->set_speed(axis, unit_scale * atof(items[2].c_str()));
+    } else if (action == "TEST") {
+        vector<int> steps{20, 46, 73, 100, 126, 152, 179, 206, 226};
+        if (items.size() != 2) {
+            printf(
+                "argument of TEST is wrong\n"
+                "TEST X/Y \n");
+            return;
+        }
+        int axis = WaferProb::axis_number(items[1]);
+        for (int step : steps) {
+            ctrl->mv_abs(axis, unit_scale * step);
+            sleep(10);
+        }
+    } else {
+        printf("%s not supported yet!\n", action.c_str());
+        // print_cmd();
+    }
 }
diff --git a/src/libWaferProb/Handler.h b/src/libWaferProb/Handler.h
index 1639c31b..7994e708 100644
--- a/src/libWaferProb/Handler.h
+++ b/src/libWaferProb/Handler.h
@@ -14,18 +14,19 @@
  * SS // set needles separate from chip
  * SDZ 10 // set distance in z-axis in order to separate needle and chip.
  */
-#include "MotionController.h"
 #include <string>
 #include <vector>
 
+#include "MotionController.h"
+
 using namespace std;
 
 class Handler {
-private:
+ private:
     MotionController* ctrl;
     // vector<string>* supported_actions;
 
-public:
+ public:
     Handler();
     ~Handler();
     void write(const string& cmd);
diff --git a/src/libWaferProb/Helper.cpp b/src/libWaferProb/Helper.cpp
index da78edf1..9b2ba6ed 100644
--- a/src/libWaferProb/Helper.cpp
+++ b/src/libWaferProb/Helper.cpp
@@ -1,41 +1,39 @@
 #include "Helper.h"
-#include <sstream>
+
 #include <locale>
+#include <sstream>
 
-namespace WaferProb{
+namespace WaferProb {
 
-void tokenizeString(const string& str, char delim, vector<string>& tokens)
-{
+void tokenizeString(const string& str, char delim, vector<string>& tokens) {
     tokens.clear();
     istringstream iss(str);
     string token;
-    while ( getline(iss, token, delim) ){
+    while (getline(iss, token, delim)) {
         // boost::algorithm::trim(token);
         tokens.push_back(token);
     }
 }
 
-string toUpper(const string& str)
-{
+string toUpper(const string& str) {
     std::locale loc;
     string new_str(str);
-    for(string::size_type i = 0; i < str.length(); ++i){
-        new_str[i] = std::toupper(str[i], loc); 
+    for (string::size_type i = 0; i < str.length(); ++i) {
+        new_str[i] = std::toupper(str[i], loc);
     }
     return new_str;
 }
 
-int axis_number(const string& axis_str)
-{
+int axis_number(const string& axis_str) {
     // need to do better than this!
     int axis = -1;
-    if(axis_str == "X" or axis_str == "x") {
+    if (axis_str == "X" || axis_str == "x") {
         axis = 0;
     }
-    if(axis_str == "Y" or axis_str == "y") {
+    if (axis_str == "Y" || axis_str == "y") {
         axis = 1;
     }
-    if(axis_str == "Z" or axis_str == "z") {
+    if (axis_str == "Z" || axis_str == "z") {
         axis = 2;
     }
     if (axis < 0) {
@@ -45,4 +43,4 @@ int axis_number(const string& axis_str)
     return axis;
 }
 
-}
+}  // namespace WaferProb
diff --git a/src/libWaferProb/Helper.h b/src/libWaferProb/Helper.h
index e0375e99..76f280e6 100644
--- a/src/libWaferProb/Helper.h
+++ b/src/libWaferProb/Helper.h
@@ -9,10 +9,10 @@ using namespace std;
 // define some global code.
 #define DEFAULT_ZABER_POS -3
 
-namespace WaferProb{
-    void tokenizeString(const string& str, char delim, vector<string>& tokens);
-    string toUpper(const string& str);
-    int axis_number(const string& axis_str);
-}
+namespace WaferProb {
+void tokenizeString(const string& str, char delim, vector<string>& tokens);
+string toUpper(const string& str);
+int axis_number(const string& axis_str);
+}  // namespace WaferProb
 
 #endif
diff --git a/src/libWaferProb/MotionController.cpp b/src/libWaferProb/MotionController.cpp
index 9f946314..abec49cd 100644
--- a/src/libWaferProb/MotionController.cpp
+++ b/src/libWaferProb/MotionController.cpp
@@ -1,147 +1,124 @@
 #include "MotionController.h"
-#include "Helper.h"
 
 #include <stdio.h>
+#include <unistd.h>  // for sleep()
 
-#include <string>
 #include <sstream>
+#include <string>
 #include <vector>
 
-#include <unistd.h>  // for sleep()
+#include "Helper.h"
 
 using namespace std;
-MotionController::MotionController(const char* dn_1):
-	ControllerBase()
-{
+MotionController::MotionController(const char* dn_1) : ControllerBase() {
     xy_ctrl = new ControllerZaber(dn_1);
     z_ctrl = new ControllerGalil("192.168.1.30");
     m_position[0] = m_position[1] = m_position[2] = -1;
 }
 
-MotionController::~MotionController(){
-	disconnect();
-}
+MotionController::~MotionController() { disconnect(); }
 
 int MotionController::connect() {
-	if(xy_ctrl->connect() != 0){ 
-		return 1;
-	}
+    if (xy_ctrl->connect() != 0) {
+        return 1;
+    }
 
-	// connect z station
-	if(z_ctrl->connect() != 0){
-		return 2;
-	}
-	this->get_position();
+    // connect z station
+    if (z_ctrl->connect() != 0) {
+        return 2;
+    }
+    this->get_position();
 
-	return 0;
+    return 0;
 }
 
-int MotionController::disconnect(){
-	xy_ctrl->disconnect();
-	z_ctrl->disconnect();
-	return 0;
+int MotionController::disconnect() {
+    xy_ctrl->disconnect();
+    z_ctrl->disconnect();
+    return 0;
 }
 
-int MotionController::set_speed(int axis, float sp){
-	if (axis == 0 || axis == 1) { // x-y-axis
-		xy_ctrl->set_speed(axis+1, sp);
-	} else if (axis == 2) {
-		z_ctrl->set_speed(axis, sp);
-	} else {
-		;
-	}
-	return 0;
+int MotionController::set_speed(int axis, float sp) {
+    if (axis == 0 || axis == 1) {  // x-y-axis
+        xy_ctrl->set_speed(axis + 1, sp);
+    } else if (axis == 2) {
+        z_ctrl->set_speed(axis, sp);
+    } else {
+    }
+    return 0;
 }
 
-int MotionController::mv_abs(int axis, float value){
-	if(axis == 0 || axis == 1){
-		xy_ctrl->mv_abs(axis+1, value);
-	} else if (axis == 2){
-		z_ctrl->mv_abs(axis, value);
-	} else {
-		;
-	}
-	return 0;
+int MotionController::mv_abs(int axis, float value) {
+    if (axis == 0 || axis == 1) {
+        xy_ctrl->mv_abs(axis + 1, value);
+    } else if (axis == 2) {
+        z_ctrl->mv_abs(axis, value);
+    } else {
+    }
+    return 0;
 }
 
 int MotionController::mv_rel(int axis, float value) {
-	if(axis == 0 || axis == 1){
-		xy_ctrl->mv_rel(axis+1, value);
-	} else if (axis == 2) {
-		z_ctrl->mv_rel(axis, value);
-	} else {}
-	return 0;
-}
-
-int MotionController::stop(){
-	xy_ctrl->stop();
-	z_ctrl->stop();
-	return 0;
+    if (axis == 0 || axis == 1) {
+        xy_ctrl->mv_rel(axis + 1, value);
+    } else if (axis == 2) {
+        z_ctrl->mv_rel(axis, value);
+    } else {
+    }
+    return 0;
 }
 
-int MotionController::get_position(){
-	get_pos_xy();
-	get_pos_z();
-	return 0;
+int MotionController::stop() {
+    xy_ctrl->stop();
+    z_ctrl->stop();
+    return 0;
 }
 
-int MotionController::get_pos_xy(){
-	xy_ctrl->get_position();
-	m_position[0] = xy_ctrl->m_position[0];
-	m_position[1] = xy_ctrl->m_position[1];
-	printf("xy position: %.2f, %.2f\n", m_position[0], m_position[1]);
-	return 0;
+int MotionController::get_position() {
+    get_pos_xy();
+    get_pos_z();
+    return 0;
 }
 
-int MotionController::get_pos_z(){
-	z_ctrl->get_position();
-	m_position[2] = z_ctrl->m_position[2];
-	return 0;
+int MotionController::get_pos_xy() {
+    xy_ctrl->get_position();
+    m_position[0] = xy_ctrl->m_position[0];
+    m_position[1] = xy_ctrl->m_position[1];
+    printf("xy position: %.2f, %.2f\n", m_position[0], m_position[1]);
+    return 0;
 }
 
-
-int MotionController::get_position(int axis){
-	get_position();
-	return m_position[axis];
+int MotionController::get_pos_z() {
+    z_ctrl->get_position();
+    m_position[2] = z_ctrl->m_position[2];
+    return 0;
 }
 
-int MotionController::write(int axis, const string& cmd) 
-{
-	if(axis == 0 || axis == 1){
-		xy_ctrl->write(cmd);
-	} else if(axis == 2){
-		z_ctrl->write(cmd);
-	} else {}
-	return 0;
+int MotionController::get_position(int axis) {
+    get_position();
+    return m_position[axis];
 }
 
-int MotionController::set_home(){
-	return xy_ctrl->set_home();
+int MotionController::write(int axis, const string& cmd) {
+    if (axis == 0 || axis == 1) {
+        xy_ctrl->write(cmd);
+    } else if (axis == 2) {
+        z_ctrl->write(cmd);
+    } else {
+    }
+    return 0;
 }
 
-int MotionController::set_center(){
-	return xy_ctrl->set_center();
-}
+int MotionController::set_home() { return xy_ctrl->set_home(); }
 
-void MotionController::find_max_min() {
-	z_ctrl->find_max_min();
-}
+int MotionController::set_center() { return xy_ctrl->set_center(); }
 
-void MotionController::find_z_min() {
-	z_ctrl->find_z_min();
-}
+void MotionController::find_max_min() { z_ctrl->find_max_min(); }
 
-void MotionController::check_z_min() {
-	z_ctrl->check_z_min();
-}
+void MotionController::find_z_min() { z_ctrl->find_z_min(); }
 
-int MotionController::xy_park(){
-	return xy_ctrl->park();
-}
-
-
-int MotionController::xy_unpark(){
-	return xy_ctrl->unpark();
-}
+void MotionController::check_z_min() { z_ctrl->check_z_min(); }
 
+int MotionController::xy_park() { return xy_ctrl->park(); }
 
+int MotionController::xy_unpark() { return xy_ctrl->unpark(); }
diff --git a/src/libWaferProb/MotionController.h b/src/libWaferProb/MotionController.h
index a8fc9d2d..715948a6 100644
--- a/src/libWaferProb/MotionController.h
+++ b/src/libWaferProb/MotionController.h
@@ -4,64 +4,59 @@
 /*
  * A controller uses different other controllers.
  */
-#include "gclib.h"
-
 #include "ControllerBase.h"
-#include "ControllerZaber.h"
 #include "ControllerGalil.h"
+#include "ControllerZaber.h"
+#include "gclib.h"
 
-class MotionController : public ControllerBase{
-
-	private:
-
-		ControllerZaber* xy_ctrl; // xy-axis station is controlled by a machine from Zaber
-		ControllerGalil* z_ctrl;    // z-axis controled by a machine from Galil
-
-	public:
-		MotionController(const char* dn_1);
-		~MotionController();
+class MotionController : public ControllerBase {
+ private:
+    ControllerZaber*
+        xy_ctrl;  // xy-axis station is controlled by a machine from Zaber
+    ControllerGalil* z_ctrl;  // z-axis controled by a machine from Galil
 
-		int connect();
-		int disconnect();
+ public:
+    MotionController(const char* dn_1);
+    ~MotionController();
 
-		int set_speed(int axis, float sp);
+    int connect();
+    int disconnect();
 
-		int mv_abs(int axis, float value); // move w.r.t home-position
-		int mv_rel(int axis, float value); // move w.r.t current-position
-		int stop();
+    int set_speed(int axis, float sp);
 
-		int get_position(int axis);
-		int get_position();
+    int mv_abs(int axis, float value);  // move w.r.t home-position
+    int mv_rel(int axis, float value);  // move w.r.t current-position
+    int stop();
 
-		int get_pos_xy();
-		int get_pos_z();
+    int get_position(int axis);
+    int get_position();
 
-		int set_home();
-		int set_center();
+    int get_pos_xy();
+    int get_pos_z();
 
-		int write(const string&){
-			// sorry I don't know which device cmd writes to...
-			return 0;
-		}
-		int write(int axis, const string& cmd);
+    int set_home();
+    int set_center();
 
-		int run_cmd(const string& cmd);
+    int write(const string&) {
+        // sorry I don't know which device cmd writes to...
+        return 0;
+    }
+    int write(int axis, const string& cmd);
 
-		int xy_park();
-		int xy_unpark();
+    int run_cmd(const string& cmd);
 
-		void calibrate_Z(){
-			z_ctrl->find_z_min();
-			//z_ctrl->find_max_min();
-		}
+    int xy_park();
+    int xy_unpark();
 
-		void find_max_min();
-		void find_z_min();
-		void check_z_min();
+    void calibrate_Z() {
+        z_ctrl->find_z_min();
+        // z_ctrl->find_max_min();
+    }
 
-		bool is_z_calibrated() {
-			return z_ctrl->is_z_calibrated();
-		}
+    void find_max_min();
+    void find_z_min();
+    void check_z_min();
 
+    bool is_z_calibrated() { return z_ctrl->is_z_calibrated(); }
 };
 #endif
diff --git a/src/libWaveFormGen/PG8133A.cpp b/src/libWaveFormGen/PG8133A.cpp
index b1fa4dae..4e858d04 100644
--- a/src/libWaveFormGen/PG8133A.cpp
+++ b/src/libWaveFormGen/PG8133A.cpp
@@ -1,6 +1,6 @@
 #include "PG8133A.h"
-#include "Logger.h"
 
+#include "Logger.h"
 
 PG8133A::PG8133A(std::string dev, unsigned addr) {
     m_com = new SerialCom(dev);
@@ -8,9 +8,7 @@ PG8133A::PG8133A(std::string dev, unsigned addr) {
     m_com->send("++auto 0\n\r");
 }
 
-PG8133A::~PG8133A() {
-    delete m_com;
-}
+PG8133A::~PG8133A() { delete m_com; }
 
 void PG8133A::send(std::string cmd) {
     m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
@@ -20,25 +18,24 @@ void PG8133A::send(std::string cmd) {
     std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
 }
 
-std::string PG8133A::receive(std::string cmd)
-{
-  m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
-  cmd += "\r\n";
-  m_com->send(cmd);
-  std::this_thread::sleep_for(std::chrono::seconds(1));
-  m_com->send("++read eoi\n\r");
-  std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
-  std::string buf=m_com->receive();
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
-  return buf;
+std::string PG8133A::receive(std::string cmd) {
+    m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
+    cmd += "\r\n";
+    m_com->send(cmd);
+    std::this_thread::sleep_for(std::chrono::seconds(1));
+    m_com->send("++read eoi\n\r");
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
+    std::string buf = m_com->receive();
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
+    return buf;
 }
 
 void PG8133A::init() {
     logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Initialising: ";
     this->send("*RST");
     std::this_thread::sleep_for(std::chrono::seconds(1));
-    this->send("FUNC:SHAP SQU"); 
+    this->send("FUNC:SHAP SQU");
 }
 
 void PG8133A::setFreq(double value) {
@@ -62,31 +59,31 @@ void PG8133A::setOutPut(double value) {
 }
 
 std::string PG8133A::getVoltHigh() {
-     std::string result = this->receive("VOLT1:HIGH?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("VOLT1:HIGH?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
 
 std::string PG8133A::getVoltLow() {
-     std::string result = this->receive("VOLT1:LOW?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("VOLT1:LOW?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
 
 std::string PG8133A::getFreq() {
-     std::string result = this->receive("FREQ?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("FREQ?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
 
 std::string PG8133A::getFunc() {
-     std::string result = this->receive("FUNC?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("FUNC?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
 
 std::string PG8133A::getOutPen() {
-     std::string result = this->receive("OUTP1?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("OUTP1?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
diff --git a/src/libWaveFormGen/PG8133A.h b/src/libWaveFormGen/PG8133A.h
index a0548286..1e0b02b2 100644
--- a/src/libWaveFormGen/PG8133A.h
+++ b/src/libWaveFormGen/PG8133A.h
@@ -2,45 +2,45 @@
 #define PG8133A_H
 
 // ####################
-// Agilent 8133A 3GHz Pulse Generator 
+// Agilent 8133A 3GHz Pulse Generator
 // Author: Peilian Liu
 // Date: May 2019
 // Notes: Assuming Prologix GPIB to USB
 // ###################
 
+#include <chrono>
 #include <iostream>
 #include <string>
 #include <thread>
-#include <chrono>
 
 #include "SerialCom.h"
 
 class PG8133A {
-    public:
-        PG8133A(std::string dev, unsigned addr);
-        ~PG8133A();
-
-        void init();
-        void setFreq(double value);
-        void setVoltHigh(double value);
-        void setVoltLow(double value);
-        void setOutPut(double value);
-        std::string getOutPen(); 
-        std::string getVoltHigh();
-        std::string getVoltLow();
-        std::string getFreq();
-        std::string getFunc();
-        void turnOn();
-        void turnOff();
-
-    private:
-        SerialCom *m_com;
-        unsigned m_addr;
-
-        void send(std::string cmd);
-        std::string receive(std::string cmd);
- 
-        std::chrono::milliseconds m_wait{200};
+ public:
+    PG8133A(std::string dev, unsigned addr);
+    ~PG8133A();
+
+    void init();
+    void setFreq(double value);
+    void setVoltHigh(double value);
+    void setVoltLow(double value);
+    void setOutPut(double value);
+    std::string getOutPen();
+    std::string getVoltHigh();
+    std::string getVoltLow();
+    std::string getFreq();
+    std::string getFunc();
+    void turnOn();
+    void turnOff();
+
+ private:
+    SerialCom *m_com;
+    unsigned m_addr;
+
+    void send(std::string cmd);
+    std::string receive(std::string cmd);
+
+    std::chrono::milliseconds m_wait{200};
 };
 
 #endif
diff --git a/src/libWaveFormGen/WF33120A.cpp b/src/libWaveFormGen/WF33120A.cpp
index 6c7ad5d3..d45cdf95 100644
--- a/src/libWaveFormGen/WF33120A.cpp
+++ b/src/libWaveFormGen/WF33120A.cpp
@@ -1,6 +1,6 @@
 #include "WF33120A.h"
-#include "Logger.h"
 
+#include "Logger.h"
 
 WF33120A::WF33120A(std::string dev, unsigned addr) {
     m_com = new SerialCom(dev);
@@ -8,9 +8,7 @@ WF33120A::WF33120A(std::string dev, unsigned addr) {
     m_com->send("++auto 0\n\r");
 }
 
-WF33120A::~WF33120A() {
-    delete m_com;
-}
+WF33120A::~WF33120A() { delete m_com; }
 
 void WF33120A::send(std::string cmd) {
     m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
@@ -20,79 +18,77 @@ void WF33120A::send(std::string cmd) {
     std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
 }
 
-std::string WF33120A::receive(std::string cmd)
-{
-  m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
-  cmd += "\r\n";
-  m_com->send(cmd);
-  std::this_thread::sleep_for(std::chrono::seconds(1));
-  m_com->send("++read eoi\n\r");
-  std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
-  std::string buf=m_com->receive();
-  logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
-  return buf;
+std::string WF33120A::receive(std::string cmd) {
+    m_com->send("++addr " + std::to_string(m_addr) + "\n\r");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Sending: " << cmd;
+    cmd += "\r\n";
+    m_com->send(cmd);
+    std::this_thread::sleep_for(std::chrono::seconds(1));
+    m_com->send("++read eoi\n\r");
+    std::this_thread::sleep_for(std::chrono::milliseconds(m_wait));
+    std::string buf = m_com->receive();
+    logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Received: " << buf;
+    return buf;
 }
 
 void WF33120A::init() {
     logger(logDEBUG2) << __PRETTY_FUNCTION__ << " -> Initialising: ";
     this->send("*RST");
     std::this_thread::sleep_for(std::chrono::seconds(1));
-    this->send("FUNC:SHAP SQU"); 
+    this->send("FUNC:SHAP SQU");
     std::this_thread::sleep_for(std::chrono::seconds(1));
     this->send("VOLT 1.2");
     std::this_thread::sleep_for(std::chrono::seconds(1));
-    this->send("VOLT:OFFS 0.6"); 
+    this->send("VOLT:OFFS 0.6");
 }
 
-void WF33120A::setFreq(double value) { //Frequency  Hz
+void WF33120A::setFreq(double value) {  // Frequency  Hz
     std::this_thread::sleep_for(std::chrono::seconds(1));
     this->send("FREQ " + std::to_string(value));
 }
 
-void WF33120A::setVolt(double value) { //Amplitude  V
+void WF33120A::setVolt(double value) {  // Amplitude  V
     std::this_thread::sleep_for(std::chrono::seconds(1));
     this->send("VOLT " + std::to_string(value));
 }
 
-void WF33120A::setVoltOffset(double value) { //Offset  V
+void WF33120A::setVoltOffset(double value) {  // Offset  V
     std::this_thread::sleep_for(std::chrono::seconds(1));
     this->send("VOLT:OFFS " + std::to_string(value));
 }
 
 std::string WF33120A::getVolt() {
-     std::string result = this->receive("VOLT?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("VOLT?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
 
 std::string WF33120A::getVoltUnit() {
-     std::string result = this->receive("VOLT:UNIT?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("VOLT:UNIT?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
 
 std::string WF33120A::getVoltOffset() {
-     std::string result = this->receive("VOLT:OFFS?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("VOLT:OFFS?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
 
 std::string WF33120A::getVoltOffsetUnit() {
-     std::string result = this->receive("VOLT:OFFS:UNIT?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("VOLT:OFFS:UNIT?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
 
 std::string WF33120A::getFreq() {
-     std::string result = this->receive("FREQ?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("FREQ?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
 
 std::string WF33120A::getFunc() {
-     std::string result = this->receive("FUNC?");
-     logger(logDEBUG2) << __PRETTY_FUNCTION__ ;
-     return result;
+    std::string result = this->receive("FUNC?");
+    logger(logDEBUG2) << __PRETTY_FUNCTION__;
+    return result;
 }
-
diff --git a/src/libWaveFormGen/WF33120A.h b/src/libWaveFormGen/WF33120A.h
index e2353ac3..398f7a43 100644
--- a/src/libWaveFormGen/WF33120A.h
+++ b/src/libWaveFormGen/WF33120A.h
@@ -2,45 +2,45 @@
 #define WF33120A_H
 
 // ####################
-// hp 15MHz function / arbitrary waveform generator 
+// hp 15MHz function / arbitrary waveform generator
 // Author: Peilian Liu
 // Date: May 2019
 // Notes: Assuming Prologix GPIB to USB
 // ###################
 
+#include <chrono>
 #include <iostream>
 #include <string>
 #include <thread>
-#include <chrono>
 
 #include "SerialCom.h"
 
 class WF33120A {
-    public:
-        WF33120A(std::string dev, unsigned addr);
-        ~WF33120A();
-
-        void init();
-        void setFreq(double value);
-        void setVolt(double value);
-        void setVoltOffset(double value);
-        std::string getVolt();
-        std::string getVoltUnit();
-        std::string getVoltOffset();
-        std::string getVoltOffsetUnit();
-        std::string getFreq();
-        std::string getFunc();
-        void turnOn();
-        void turnOff();
-
-    private:
-        SerialCom *m_com;
-        unsigned m_addr;
-
-        void send(std::string cmd);
-        std::string receive(std::string cmd);
- 
-        std::chrono::milliseconds m_wait{200};
+ public:
+    WF33120A(std::string dev, unsigned addr);
+    ~WF33120A();
+
+    void init();
+    void setFreq(double value);
+    void setVolt(double value);
+    void setVoltOffset(double value);
+    std::string getVolt();
+    std::string getVoltUnit();
+    std::string getVoltOffset();
+    std::string getVoltOffsetUnit();
+    std::string getFreq();
+    std::string getFunc();
+    void turnOn();
+    void turnOff();
+
+ private:
+    SerialCom *m_com;
+    unsigned m_addr;
+
+    void send(std::string cmd);
+    std::string receive(std::string cmd);
+
+    std::chrono::milliseconds m_wait{200};
 };
 
 #endif
diff --git a/src/libZaber/z_common.h b/src/libZaber/z_common.h
index 41872e65..287caa65 100644
--- a/src/libZaber/z_common.h
+++ b/src/libZaber/z_common.h
@@ -1,16 +1,16 @@
 /**
  * \file z_common.h
  * \author Eric Dand
- * \version 1.0 
+ * \version 1.0
  * \date 28 November 2014
  * \copyright Apache Software License Version 2.0
  *
  * \brief Defines a few things that all of the serial API has in common.
- * 
+ *
  * This file should not be included directly: only include either za_serial.h
  * or zb_serial.h, which will in turn include this file. The purpose of this
  * file is to avoid code duplication and to enable a user to include both
- * halves of the API in one source file without too many include guards and 
+ * halves of the API in one source file without too many include guards and
  * other preprocessor mess.
  */
 #if !defined(Z_COMMON_H)
@@ -33,48 +33,47 @@ typedef HANDLE z_port;
 typedef int z_port;
 #endif /* if defined(_WIN32) and other OS checks */
 
-/** Defines how long, in milliseconds, za_receive() and zb_receive() should 
- * wait for input before returning without a full message. 
+/** Defines how long, in milliseconds, za_receive() and zb_receive() should
+ * wait for input before returning without a full message.
  *
  * This number acts as an upper bound on how long the receive functions will
  * take: they will return immediately once a full message is received.
  *
  * A note about the read timeout on *NIX operating systems: because of the way
- * the POSIX "termios" functions work, this value will be rounded down to the 
+ * the POSIX "termios" functions work, this value will be rounded down to the
  * nearest tenth of a second (eg. 200ms = 246ms = 0.2s). A value between 0 and
- * 100 will be rounded up to 100 instead of down to 0 to give slightly more 
+ * 100 will be rounded up to 100 instead of down to 0 to give slightly more
  * consistent behaviour between Windows and *NIX systems.
  *
- * Change this value with caution. It is set to two seconds by default, 
- * but a shorter time may be desired if many operations in your program 
- * depend on reading until a timeout. See zb_set_timeout() for more 
+ * Change this value with caution. It is set to two seconds by default,
+ * but a shorter time may be desired if many operations in your program
+ * depend on reading until a timeout. See zb_set_timeout() for more
  * info on how this value affects the behaviour of zb_serial.h.
  */
 #define READ_TIMEOUT 2000
 
 /** \enum z_returns Defines a set of return values in case things go wrong.
  *
- * All errors are negative values in order to not be confused with the 
+ * All errors are negative values in order to not be confused with the
  * 0-or-greater regular return values. This was done so that a user can check
  * whether a return value is < 0 to check for all error codes simultaneously.
  *
  * Remember to check your return values! It's good for you.
  */
-enum z_returns { 
-	/** Everything is OK! */
-	Z_SUCCESS = 0,
-	/** Something went wrong in system code */
-	Z_ERROR_SYSTEM_ERROR = -1,
-	/** Tried to write to a buffer that wasn't long enough */
-	Z_ERROR_BUFFER_TOO_SMALL = -2,
-	/** Was passed NULL when not expecting it */
-	Z_ERROR_NULL_PARAMETER = -3,
-	/** Tried to set an unsupported baudrate */
-	Z_ERROR_INVALID_BAUDRATE = -4,
-	/** Tried to decode a partial reply, 
-	 * or a string that wasn't a reply at all */
-	Z_ERROR_COULD_NOT_DECODE = -5
+enum z_returns {
+    /** Everything is OK! */
+    Z_SUCCESS = 0,
+    /** Something went wrong in system code */
+    Z_ERROR_SYSTEM_ERROR = -1,
+    /** Tried to write to a buffer that wasn't long enough */
+    Z_ERROR_BUFFER_TOO_SMALL = -2,
+    /** Was passed NULL when not expecting it */
+    Z_ERROR_NULL_PARAMETER = -3,
+    /** Tried to set an unsupported baudrate */
+    Z_ERROR_INVALID_BAUDRATE = -4,
+    /** Tried to decode a partial reply,
+     * or a string that wasn't a reply at all */
+    Z_ERROR_COULD_NOT_DECODE = -5
 };
 
 #endif /* if !defined(Z_COMMON_H) */
-
diff --git a/src/libZaber/za_serial.cpp b/src/libZaber/za_serial.cpp
index 8b1fce21..6a3dd9eb 100644
--- a/src/libZaber/za_serial.cpp
+++ b/src/libZaber/za_serial.cpp
@@ -8,20 +8,18 @@
  * Implementation file for ASCII portion of the Zaber Serial API in C.
  * See za_serial.h for documentation.
  */
-#include <string.h>
+#include "za_serial.h"
+
 #include <stdio.h>
 #include <stdlib.h>
-#include "za_serial.h"
+#include <string.h>
 
 static int za_verbose = 1;
 
-void za_set_verbose(int value)
-{
-	za_verbose = value;
-}
+void za_set_verbose(int value) { za_verbose = value; }
 
 #if defined(_WIN32)
-#pragma warning( disable : 4996 ) /* don't warn that strncpy is deprecated */
+#pragma warning(disable : 4996) /* don't warn that strncpy is deprecated */
 /* These macros save us a lot of repetition. Call the specified function,
  * and complain and return early if things go badly. */
 #if defined(NDEBUG)
@@ -29,114 +27,119 @@ void za_set_verbose(int value)
 #define PRINTF_ERROR(M, ...)
 #define PRINT_SYSCALL_ERROR(M)
 #else
-#define PRINT_ERROR(M) do { if (za_verbose) { fprintf(stderr, "(%s: %d) " M\
-		"\n", __FILE__, __LINE__); } } while(0)
-#define PRINTF_ERROR(M, ...) do { if (za_verbose) { fprintf(stderr,\
-		"(%s: %d) " M "\n", __FILE__, __LINE__,  __VA_ARGS__); } } while(0)
-#define PRINT_SYSCALL_ERROR(M) do { if (za_verbose) { fprintf(stderr,\
-		"(%s: %d) [ERROR] " M " failed with error code %d.\n",\
-		__FILE__, __LINE__, GetLastError()); } } while(0)
+#define PRINT_ERROR(M)                                               \
+    do {                                                             \
+        if (za_verbose) {                                            \
+            fprintf(stderr, "(%s: %d) " M "\n", __FILE__, __LINE__); \
+        }                                                            \
+    } while (0)
+#define PRINTF_ERROR(M, ...)                                        \
+    do {                                                            \
+        if (za_verbose) {                                           \
+            fprintf(stderr, "(%s: %d) " M "\n", __FILE__, __LINE__, \
+                    __VA_ARGS__);                                   \
+        }                                                           \
+    } while (0)
+#define PRINT_SYSCALL_ERROR(M)                                             \
+    do {                                                                   \
+        if (za_verbose) {                                                  \
+            fprintf(stderr,                                                \
+                    "(%s: %d) [ERROR] " M " failed with error code %d.\n", \
+                    __FILE__, __LINE__, GetLastError());                   \
+        }                                                                  \
+    } while (0)
 #endif
-#define SYSCALL(F) do { if ((F) == 0) {\
-		PRINT_SYSCALL_ERROR(#F); return Z_ERROR_SYSTEM_ERROR; } } while(0)
+#define SYSCALL(F)                       \
+    do {                                 \
+        if ((F) == 0) {                  \
+            PRINT_SYSCALL_ERROR(#F);     \
+            return Z_ERROR_SYSTEM_ERROR; \
+        }                                \
+    } while (0)
 #define MIN(A, B) (((A) < (B)) ? (A) : (B))
 
-int za_connect(z_port *port, const char *port_name)
-{
-	DCB dcb = { 0 };
-	COMMTIMEOUTS timeouts;
-	
-	if (port_name == NULL)
-	{
-		PRINT_ERROR("[ERROR] port name cannot be NULL.");
-		return Z_ERROR_NULL_PARAMETER;
-	}
-	*port = CreateFileA(port_name,
-			GENERIC_READ | GENERIC_WRITE,
-			0,
-			NULL,
-			OPEN_EXISTING,
-			FILE_ATTRIBUTE_NORMAL,
-			0);
-	if (*port == INVALID_HANDLE_VALUE)
-	{
-		PRINT_SYSCALL_ERROR("CreateFileA");
-		return Z_ERROR_SYSTEM_ERROR;
-	}
-
-	SYSCALL(GetCommState(*port, &dcb));
-	dcb.DCBlength = sizeof(DCB);
-	dcb.BaudRate = 115200;
-	dcb.fBinary = TRUE;  /* Binary Mode (skip EOF check) */
-	dcb.fParity = FALSE;  /* Disable parity checking */
-	dcb.fOutxCtsFlow = FALSE; /* No CTS handshaking on output */
-	dcb.fOutxDsrFlow = FALSE; /* No DSR handshaking on output */
-	dcb.fDtrControl = DTR_CONTROL_DISABLE;  /* Disable DTR Flow control */
-	dcb.fDsrSensitivity = FALSE; /* No DSR Sensitivity */
-	dcb.fTXContinueOnXoff = TRUE; /* Continue TX when Xoff sent */
-	dcb.fOutX = FALSE; /* Disable output X-ON/X-OFF */
-	dcb.fInX = FALSE;  /* Disable input X-ON/X-OFF */
-	dcb.fErrorChar = FALSE;  /* Disable Err Replacement */
-	dcb.fNull = FALSE; /* Disable Null stripping */
-	dcb.fRtsControl = RTS_CONTROL_DISABLE;  /* Disable Rts Flow control */
-	dcb.fAbortOnError = FALSE; /* Do not abort all reads and writes on Error */
-	dcb.wReserved = 0; /* Not currently used, but must be set to 0 */
-	dcb.XonLim = 0; /* Transmit X-ON threshold */
-	dcb.XoffLim = 0;   /* Transmit X-OFF threshold */
-	dcb.ByteSize = 8;  /* Number of bits/byte, 4-8 */
-	dcb.Parity = NOPARITY; /* 0-4=None,Odd,Even,Mark,Space */
-	dcb.StopBits = ONESTOPBIT;  /* 0,1,2 = 1, 1.5, 2 */
-	SYSCALL(SetCommState(*port, &dcb));
-
-	timeouts.ReadIntervalTimeout = MAXDWORD;
-	timeouts.ReadTotalTimeoutMultiplier = MAXDWORD;
-	timeouts.ReadTotalTimeoutConstant = READ_TIMEOUT; /* #defined in header */
-	timeouts.WriteTotalTimeoutMultiplier = 0;
-	timeouts.WriteTotalTimeoutConstant = 100;
-	SYSCALL(SetCommTimeouts(*port, &timeouts));
-
-	return Z_SUCCESS;
+int za_connect(z_port *port, const char *port_name) {
+    DCB dcb = {0};
+    COMMTIMEOUTS timeouts;
+
+    if (port_name == NULL) {
+        PRINT_ERROR("[ERROR] port name cannot be NULL.");
+        return Z_ERROR_NULL_PARAMETER;
+    }
+    *port = CreateFileA(port_name, GENERIC_READ | GENERIC_WRITE, 0, NULL,
+                        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+    if (*port == INVALID_HANDLE_VALUE) {
+        PRINT_SYSCALL_ERROR("CreateFileA");
+        return Z_ERROR_SYSTEM_ERROR;
+    }
+
+    SYSCALL(GetCommState(*port, &dcb));
+    dcb.DCBlength = sizeof(DCB);
+    dcb.BaudRate = 115200;
+    dcb.fBinary = TRUE;                    /* Binary Mode (skip EOF check) */
+    dcb.fParity = FALSE;                   /* Disable parity checking */
+    dcb.fOutxCtsFlow = FALSE;              /* No CTS handshaking on output */
+    dcb.fOutxDsrFlow = FALSE;              /* No DSR handshaking on output */
+    dcb.fDtrControl = DTR_CONTROL_DISABLE; /* Disable DTR Flow control */
+    dcb.fDsrSensitivity = FALSE;           /* No DSR Sensitivity */
+    dcb.fTXContinueOnXoff = TRUE;          /* Continue TX when Xoff sent */
+    dcb.fOutX = FALSE;                     /* Disable output X-ON/X-OFF */
+    dcb.fInX = FALSE;                      /* Disable input X-ON/X-OFF */
+    dcb.fErrorChar = FALSE;                /* Disable Err Replacement */
+    dcb.fNull = FALSE;                     /* Disable Null stripping */
+    dcb.fRtsControl = RTS_CONTROL_DISABLE; /* Disable Rts Flow control */
+    dcb.fAbortOnError = FALSE; /* Do not abort all reads and writes on Error */
+    dcb.wReserved = 0;         /* Not currently used, but must be set to 0 */
+    dcb.XonLim = 0;            /* Transmit X-ON threshold */
+    dcb.XoffLim = 0;           /* Transmit X-OFF threshold */
+    dcb.ByteSize = 8;          /* Number of bits/byte, 4-8 */
+    dcb.Parity = NOPARITY;     /* 0-4=None,Odd,Even,Mark,Space */
+    dcb.StopBits = ONESTOPBIT; /* 0,1,2 = 1, 1.5, 2 */
+    SYSCALL(SetCommState(*port, &dcb));
+
+    timeouts.ReadIntervalTimeout = MAXDWORD;
+    timeouts.ReadTotalTimeoutMultiplier = MAXDWORD;
+    timeouts.ReadTotalTimeoutConstant = READ_TIMEOUT; /* #defined in header */
+    timeouts.WriteTotalTimeoutMultiplier = 0;
+    timeouts.WriteTotalTimeoutConstant = 100;
+    SYSCALL(SetCommTimeouts(*port, &timeouts));
+
+    return Z_SUCCESS;
 }
 
-int za_disconnect(z_port port)
-{
-	SYSCALL(CloseHandle(port));
-	return Z_SUCCESS;
+int za_disconnect(z_port port) {
+    SYSCALL(CloseHandle(port));
+    return Z_SUCCESS;
 }
 
-int za_send(z_port port, const char *command)
-{
-	DWORD nlast,
-		  length;
-	int written = 0;
-
-	if (command == NULL)
-	{
-		PRINT_ERROR("[ERROR] command cannot be NULL.");
-		return Z_ERROR_NULL_PARAMETER;
-	}
-
-	if (command[0] != '/')
-	{ /* send a '/' if they forgot it */
-		SYSCALL(WriteFile(port, "/", 1, &nlast, NULL));
-		written += nlast;
-	}
-
- 	length = (DWORD) strlen(command);
-	SYSCALL(WriteFile(port, command, length, &nlast, NULL));
-	written += nlast;
-	if (nlast != length)
-	{ /* WriteFile can return a short write: test for it */
-		return Z_ERROR_SYSTEM_ERROR;
-	}
-
-	if (length == 0 || command[length-1] != '\n')
-	{ /* send a newline if they forgot it */
-		SYSCALL(WriteFile(port, "\n", 1, &nlast, NULL));
-		written += nlast;
-	}
-
-	return written;
+int za_send(z_port port, const char *command) {
+    DWORD nlast, length;
+    int written = 0;
+
+    if (command == NULL) {
+        PRINT_ERROR("[ERROR] command cannot be NULL.");
+        return Z_ERROR_NULL_PARAMETER;
+    }
+
+    if (command[0] != '/') { /* send a '/' if they forgot it */
+        SYSCALL(WriteFile(port, "/", 1, &nlast, NULL));
+        written += nlast;
+    }
+
+    length = (DWORD)strlen(command);
+    SYSCALL(WriteFile(port, command, length, &nlast, NULL));
+    written += nlast;
+    if (nlast != length) { /* WriteFile can return a short write: test for it */
+        return Z_ERROR_SYSTEM_ERROR;
+    }
+
+    if (length == 0 ||
+        command[length - 1] != '\n') { /* send a newline if they forgot it */
+        SYSCALL(WriteFile(port, "\n", 1, &nlast, NULL));
+        written += nlast;
+    }
+
+    return written;
 }
 
 /* Reads 1 byte at a time so that we can stop after reading '\n'.
@@ -147,105 +150,98 @@ int za_send(z_port port, const char *command)
  *
  * Premature optimization opportunity: read the smallest number of bytes in a
  * typical message, then read 1-at-a-time after that. Only a little silly. */
-int za_receive(z_port port, char *destination, int length)
-{
-	DWORD nlast;
-	char c;
-	int nread = 0; /* total bytes read */
-
-	for (;;)
-	{
-		SYSCALL(ReadFile(port, &c, 1, &nlast, NULL));
-		
-		if (nlast == 0) /* timed out */
-		{
-			PRINTF_ERROR("[INFO] Read timed out after reading %d "
-					"bytes.", nread);
-			return Z_ERROR_SYSTEM_ERROR;
-		}
-
-		if (destination != NULL) 
-		{
-			destination[nread] = c;
-		}
-		nread += nlast;
-		
-		if (nread == length)
-		{
-			PRINTF_ERROR("[ERROR] Read destination buffer not large "
-					"enough. Recommended size: 256B. Your size: %dB.", 
-					length);
-			return Z_ERROR_BUFFER_TOO_SMALL;
-		}
-
-		if (c == '\n') 
-		{
-			nread -= 2; /* prepare to cut off the "\r\n" */
-			if (nread < 0)
-			{
-				PRINT_ERROR("[ERROR] Reply too short. It is likely that "
-						"only a partial reply was read.");
-				return Z_ERROR_SYSTEM_ERROR;
-			}
-			if (destination != NULL)
-			{
-				destination[nread] = '\0'; /* chomp the "\r\n" */
-			}
-			return nread;
-		}
-	}
+int za_receive(z_port port, char *destination, int length) {
+    DWORD nlast;
+    char c;
+    int nread = 0; /* total bytes read */
+
+    for (;;) {
+        SYSCALL(ReadFile(port, &c, 1, &nlast, NULL));
+
+        if (nlast == 0) /* timed out */
+        {
+            PRINTF_ERROR(
+                "[INFO] Read timed out after reading %d "
+                "bytes.",
+                nread);
+            return Z_ERROR_SYSTEM_ERROR;
+        }
+
+        if (destination != NULL) {
+            destination[nread] = c;
+        }
+        nread += nlast;
+
+        if (nread == length) {
+            PRINTF_ERROR(
+                "[ERROR] Read destination buffer not large "
+                "enough. Recommended size: 256B. Your size: %dB.",
+                length);
+            return Z_ERROR_BUFFER_TOO_SMALL;
+        }
+
+        if (c == '\n') {
+            nread -= 2; /* prepare to cut off the "\r\n" */
+            if (nread < 0) {
+                PRINT_ERROR(
+                    "[ERROR] Reply too short. It is likely that "
+                    "only a partial reply was read.");
+                return Z_ERROR_SYSTEM_ERROR;
+            }
+            if (destination != NULL) {
+                destination[nread] = '\0'; /* chomp the "\r\n" */
+            }
+            return nread;
+        }
+    }
 }
 
-int za_setbaud(z_port port, int baud)
-{
-	DCB dcb;
-
-	if (baud != 9600 && baud != 19200 && baud != 38400 && baud != 57600
-			&& baud != 115200)
-	{
-		PRINTF_ERROR("[ERROR] Invalid baud rate. Valid rates are "
-				"9600, 19200, 38400, 57600, and 115200 (default).\n"
-				"Your rate: %d.", baud);
-		return Z_ERROR_INVALID_BAUDRATE;
-	}
-
-	SYSCALL(GetCommState(port, &dcb));
-	dcb.BaudRate = baud;
-	SYSCALL(SetCommState(port, &dcb));
-	
-	return Z_SUCCESS;
+int za_setbaud(z_port port, int baud) {
+    DCB dcb;
+
+    if (baud != 9600 && baud != 19200 && baud != 38400 && baud != 57600 &&
+        baud != 115200) {
+        PRINTF_ERROR(
+            "[ERROR] Invalid baud rate. Valid rates are "
+            "9600, 19200, 38400, 57600, and 115200 (default).\n"
+            "Your rate: %d.",
+            baud);
+        return Z_ERROR_INVALID_BAUDRATE;
+    }
+
+    SYSCALL(GetCommState(port, &dcb));
+    dcb.BaudRate = baud;
+    SYSCALL(SetCommState(port, &dcb));
+
+    return Z_SUCCESS;
 }
 
 /* First flushes the input buffer, then tries to read until nothing comes in.
  * This unfortunately guarantees that this function will take at least 100ms
- * to complete, as this function waits 100ms for additional input to be 
- * available before returning. This is necessary, as without it, this function 
+ * to complete, as this function waits 100ms for additional input to be
+ * available before returning. This is necessary, as without it, this function
  * would be essentially useless: it would frequently chop any incoming message
  * in half, leaving the second half to be read later.
  */
-int za_drain(z_port port)
-{
-	char c;
-	DWORD nread,
-		  old_timeout;
-	COMMTIMEOUTS timeouts;
-
-	SYSCALL(PurgeComm(port, PURGE_RXCLEAR));
-	SYSCALL(GetCommTimeouts(port, &timeouts));
-	old_timeout = timeouts.ReadTotalTimeoutConstant;
-	timeouts.ReadTotalTimeoutConstant = 100;
-	SYSCALL(SetCommTimeouts(port, &timeouts));
-
-	do
-	{
-		SYSCALL(ReadFile(port, &c, 1, &nread, NULL));
-	}
-	while (nread == 1);
-
-	timeouts.ReadTotalTimeoutConstant = old_timeout;
-	SYSCALL(SetCommTimeouts(port, &timeouts));
-	
-	return Z_SUCCESS;
+int za_drain(z_port port) {
+    char c;
+    DWORD nread, old_timeout;
+    COMMTIMEOUTS timeouts;
+
+    SYSCALL(PurgeComm(port, PURGE_RXCLEAR));
+    SYSCALL(GetCommTimeouts(port, &timeouts));
+    old_timeout = timeouts.ReadTotalTimeoutConstant;
+    timeouts.ReadTotalTimeoutConstant = 100;
+    SYSCALL(SetCommTimeouts(port, &timeouts));
+
+    do {
+        SYSCALL(ReadFile(port, &c, 1, &nread, NULL));
+    } while (nread == 1);
+
+    timeouts.ReadTotalTimeoutConstant = old_timeout;
+    SYSCALL(SetCommTimeouts(port, &timeouts));
+
+    return Z_SUCCESS;
 }
 
 #elif defined(__unix__) || defined(__APPLE__) /* end of if defined(_WIN32) */
@@ -260,532 +256,536 @@ int za_drain(z_port port)
 #define PRINTF_ERROR(M, ...)
 #define PRINT_SYSCALL_ERROR(M)
 #else
-#define PRINT_ERROR(M) do { if (za_verbose) { fprintf(stderr, "(%s: %d) " M\
-		"\n", __FILE__, __LINE__); } } while(0)
-#define PRINTF_ERROR(M, ...) do { if (za_verbose) { fprintf(stderr,\
-		"(%s: %d) " M "\n", __FILE__, __LINE__,  __VA_ARGS__); } } while(0)
+#define PRINT_ERROR(M)                                               \
+    do {                                                             \
+        if (za_verbose) {                                            \
+            fprintf(stderr, "(%s: %d) " M "\n", __FILE__, __LINE__); \
+        }                                                            \
+    } while (0)
+#define PRINTF_ERROR(M, ...)                                        \
+    do {                                                            \
+        if (za_verbose) {                                           \
+            fprintf(stderr, "(%s: %d) " M "\n", __FILE__, __LINE__, \
+                    __VA_ARGS__);                                   \
+        }                                                           \
+    } while (0)
 #include <errno.h>
-#define PRINT_SYSCALL_ERROR(M) do { if (za_verbose) {\
-		fprintf(stderr, "(%s: %d) [ERROR] " M " failed: %s.\n",\
-		__FILE__, __LINE__, strerror(errno)); } } while(0)
+#define PRINT_SYSCALL_ERROR(M)                                                \
+    do {                                                                      \
+        if (za_verbose) {                                                     \
+            fprintf(stderr, "(%s: %d) [ERROR] " M " failed: %s.\n", __FILE__, \
+                    __LINE__, strerror(errno));                               \
+        }                                                                     \
+    } while (0)
 #endif
 /* A little sugar for checking return values from system calls.
- * I would have liked to use GNU/GCC's "statement expressions" so that one 
+ * I would have liked to use GNU/GCC's "statement expressions" so that one
  * do something like "z_port port = SYSCALL(open([parameters]))", but they're
  * a GNU extension, and therefore unfriendly to non-GCC compilers.
  * Workaround to avoid dependence on statement expressions for SYSCALL macro:
  * use SYSCALL on result of assignment instead. */
-#define SYSCALL(F) do { if ((F) < 0) { PRINT_SYSCALL_ERROR(#F);\
-		return Z_ERROR_SYSTEM_ERROR; } } while(0)
-
-int za_connect(z_port *port, const char *port_name)
-{
-	struct termios tio, orig_tio;
-
-	if (port == NULL || port_name == NULL)
-	{
-		PRINT_ERROR("[ERROR] port and port_name cannot be NULL.");
-		return Z_ERROR_NULL_PARAMETER;
-	}
-
-	/* blocking read/write */
-	SYSCALL(*port = open(port_name, O_RDWR | O_NOCTTY));
-	SYSCALL(tcgetattr(*port, &orig_tio));
-	memcpy(&tio, &orig_tio, sizeof(struct termios)); /* copy padding too */
-
-	/* cfmakeraw() without cfmakeraw() for cygwin compatibility */
-	tio.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR
-			| IGNCR | ICRNL | IXON);
-	tio.c_oflag &= ~OPOST;
-	tio.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
-	tio.c_cflag &= ~(CSIZE | PARENB);
-	/* end cfmakeraw() */
-	tio.c_cflag = CS8|CREAD|CLOCAL;
-
-	/* READ_TIMEOUT is defined in za_serial.h */
-	if (READ_TIMEOUT % 100 != 0)
-	{
-		tio.c_cc[VTIME] = READ_TIMEOUT / 100 + 1; /* Round up */
-	}
-	else
-	{
-		tio.c_cc[VTIME] = READ_TIMEOUT / 100;
-	}
-	tio.c_cc[VMIN] = 0;
-
-	SYSCALL(cfsetospeed(&tio, B115200) & cfsetispeed(&tio, B115200));
-
-	while(memcmp(&orig_tio, &tio, sizeof(struct termios)) != 0)
-	{ /* memcmp is only OK here because we used memcpy above */
-		SYSCALL(tcsetattr(*port, TCSAFLUSH, &tio));
-		SYSCALL(tcgetattr(*port, &orig_tio));
-	}
-
-	return Z_SUCCESS;
+#define SYSCALL(F)                       \
+    do {                                 \
+        if ((F) < 0) {                   \
+            PRINT_SYSCALL_ERROR(#F);     \
+            return Z_ERROR_SYSTEM_ERROR; \
+        }                                \
+    } while (0)
+
+int za_connect(z_port *port, const char *port_name) {
+    struct termios tio, orig_tio;
+
+    if (port == NULL || port_name == NULL) {
+        PRINT_ERROR("[ERROR] port and port_name cannot be NULL.");
+        return Z_ERROR_NULL_PARAMETER;
+    }
+
+    /* blocking read/write */
+    SYSCALL(*port = open(port_name, O_RDWR | O_NOCTTY));
+    SYSCALL(tcgetattr(*port, &orig_tio));
+    memcpy(&tio, &orig_tio, sizeof(struct termios)); /* copy padding too */
+
+    /* cfmakeraw() without cfmakeraw() for cygwin compatibility */
+    tio.c_iflag &=
+        ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
+    tio.c_oflag &= ~OPOST;
+    tio.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
+    tio.c_cflag &= ~(CSIZE | PARENB);
+    /* end cfmakeraw() */
+    tio.c_cflag = CS8 | CREAD | CLOCAL;
+
+    /* READ_TIMEOUT is defined in za_serial.h */
+    if (READ_TIMEOUT % 100 != 0) {
+        tio.c_cc[VTIME] = READ_TIMEOUT / 100 + 1; /* Round up */
+    } else {
+        tio.c_cc[VTIME] = READ_TIMEOUT / 100;
+    }
+    tio.c_cc[VMIN] = 0;
+
+    SYSCALL(cfsetospeed(&tio, B115200) & cfsetispeed(&tio, B115200));
+
+    while (memcmp(&orig_tio, &tio, sizeof(struct termios)) !=
+           0) { /* memcmp is only OK here because we used memcpy above */
+        SYSCALL(tcsetattr(*port, TCSAFLUSH, &tio));
+        SYSCALL(tcgetattr(*port, &orig_tio));
+    }
+
+    return Z_SUCCESS;
 }
 
-int za_disconnect(z_port port)
-{
-	SYSCALL(close(port));
-	return Z_SUCCESS;
+int za_disconnect(z_port port) {
+    SYSCALL(close(port));
+    return Z_SUCCESS;
 }
 
 /* a subtle feature of za_send() that is implied but not explicitly documented:
  * if you pass a pointer to a 0-length string (ie. just a \0) for command,
  * za_send() will send the minimal command of "/\n" automagically, as it will
  * assume you are sending a command without content, and that you have
- * forgotten the leading '/' and trailing '\n'. Mention of this is probably 
+ * forgotten the leading '/' and trailing '\n'. Mention of this is probably
  * best left out of the official docs since it's a hacky way to use za_send().
  */
-int za_send(z_port port, const char *command)
-{
-	int nlast,
-		length,
-		written = 0;
-
-	if (command == NULL)
-	{
-		PRINT_ERROR("[ERROR] command cannot be NULL.");
-		return Z_ERROR_NULL_PARAMETER;
-	}
-
-	if (command[0] != '/')
-	{ /* send a '/' if they forgot it */
-		SYSCALL(nlast = write(port, "/", 1));
-		written += nlast;
-	}
-	length = strlen(command);
-	SYSCALL(nlast = write(port, command, length));
-	written += nlast;
-	if (nlast != length)
-	{ /* write can return a short write: test for it */
-		PRINTF_ERROR("[ERROR] write did not write entire message: "
-				"could only write %d bytes of %d.", nlast, length);
-		return Z_ERROR_SYSTEM_ERROR;
-	}
-
-	if (length == 0 || command[length-1] != '\n')
-	{ /* send a newline if they forgot it */
-		SYSCALL(nlast = write(port, "\n", 1));
-		written += nlast;
-	}
-
-	return written;
+int za_send(z_port port, const char *command) {
+    int nlast, length, written = 0;
+
+    if (command == NULL) {
+        PRINT_ERROR("[ERROR] command cannot be NULL.");
+        return Z_ERROR_NULL_PARAMETER;
+    }
+
+    if (command[0] != '/') { /* send a '/' if they forgot it */
+        SYSCALL(nlast = write(port, "/", 1));
+        written += nlast;
+    }
+    length = strlen(command);
+    SYSCALL(nlast = write(port, command, length));
+    written += nlast;
+    if (nlast != length) { /* write can return a short write: test for it */
+        PRINTF_ERROR(
+            "[ERROR] write did not write entire message: "
+            "could only write %d bytes of %d.",
+            nlast, length);
+        return Z_ERROR_SYSTEM_ERROR;
+    }
+
+    if (length == 0 ||
+        command[length - 1] != '\n') { /* send a newline if they forgot it */
+        SYSCALL(nlast = write(port, "\n", 1));
+        written += nlast;
+    }
+
+    return written;
 }
 
-int za_receive(z_port port, char *destination, int length)
-{
-	int nread = 0, 
-		nlast;
-	char c;
-
-	for (;;)
-	{
-		SYSCALL(nlast = (int) read(port, &c, 1));
-
-		if (nlast == 0) /* timed out */
-		{
-			PRINTF_ERROR("[INFO] Read timed out after reading %d "
-					"bytes.", nread);
-			return Z_ERROR_SYSTEM_ERROR;
-		}
-
-		if (destination != NULL)
-		{
-			destination[nread] = c;
-		}
-		nread += nlast;
-		
-		if (nread == length)
-		{
-			PRINTF_ERROR("[ERROR] Read destination buffer not large "
-					"enough. Recommended size: 256B. Your size: %dB.", 
-					length);
-			return Z_ERROR_BUFFER_TOO_SMALL;
-		}
-
-		if (c == '\n') 
-		{
-			nread -= 2; /* prepare to cut off the "\r\n" */
-			if (nread < 0)
-			{
-				PRINT_ERROR("[ERROR] Reply too short. It is likely that "
-						"only a partial reply was read.");
-				return Z_ERROR_SYSTEM_ERROR;
-			}
-			if (destination != NULL)
-			{
-				destination[nread] = '\0'; /* chomp the "\r\n" */
-			}
-			return nread;
-		}
-	}
+int za_receive(z_port port, char *destination, int length) {
+    int nread = 0, nlast;
+    char c;
+
+    for (;;) {
+        SYSCALL(nlast = (int)read(port, &c, 1));
+
+        if (nlast == 0) /* timed out */
+        {
+            PRINTF_ERROR(
+                "[INFO] Read timed out after reading %d "
+                "bytes.",
+                nread);
+            return Z_ERROR_SYSTEM_ERROR;
+        }
+
+        if (destination != NULL) {
+            destination[nread] = c;
+        }
+        nread += nlast;
+
+        if (nread == length) {
+            PRINTF_ERROR(
+                "[ERROR] Read destination buffer not large "
+                "enough. Recommended size: 256B. Your size: %dB.",
+                length);
+            return Z_ERROR_BUFFER_TOO_SMALL;
+        }
+
+        if (c == '\n') {
+            nread -= 2; /* prepare to cut off the "\r\n" */
+            if (nread < 0) {
+                PRINT_ERROR(
+                    "[ERROR] Reply too short. It is likely that "
+                    "only a partial reply was read.");
+                return Z_ERROR_SYSTEM_ERROR;
+            }
+            if (destination != NULL) {
+                destination[nread] = '\0'; /* chomp the "\r\n" */
+            }
+            return nread;
+        }
+    }
 }
 
-int za_setbaud(z_port port, int baud)
-{
-	struct termios tio;
-	speed_t tbaud;
-	switch (baud)
-	{
-		case 9600:
-			tbaud = B9600;
-			break;
-		case 19200:
-			tbaud = B19200;
-			break;
-		case 38400:
-			tbaud = B38400;
-			break;
-		case 57600:
-			tbaud = B57600;
-			break;
-		case 115200:
-			tbaud = B115200;
-			break;
-		default:
-			PRINTF_ERROR("[ERROR] Invalid baud rate. Valid rates are "
-						"9600, 19200, 38400, 57600, and 115200 (default).\n"
-						"Your rate: %d.", baud);
-			return Z_ERROR_INVALID_BAUDRATE;
-	}
-
-	SYSCALL(tcgetattr(port, &tio));
-	SYSCALL(cfsetospeed(&tio, tbaud) & cfsetispeed(&tio, tbaud));
-	SYSCALL(tcsetattr(port, TCSAFLUSH, &tio));
-
-	return Z_SUCCESS;
+int za_setbaud(z_port port, int baud) {
+    struct termios tio;
+    speed_t tbaud;
+    switch (baud) {
+        case 9600:
+            tbaud = B9600;
+            break;
+        case 19200:
+            tbaud = B19200;
+            break;
+        case 38400:
+            tbaud = B38400;
+            break;
+        case 57600:
+            tbaud = B57600;
+            break;
+        case 115200:
+            tbaud = B115200;
+            break;
+        default:
+            PRINTF_ERROR(
+                "[ERROR] Invalid baud rate. Valid rates are "
+                "9600, 19200, 38400, 57600, and 115200 (default).\n"
+                "Your rate: %d.",
+                baud);
+            return Z_ERROR_INVALID_BAUDRATE;
+    }
+
+    SYSCALL(tcgetattr(port, &tio));
+    SYSCALL(cfsetospeed(&tio, tbaud) & cfsetispeed(&tio, tbaud));
+    SYSCALL(tcsetattr(port, TCSAFLUSH, &tio));
+
+    return Z_SUCCESS;
 }
 
-int za_drain(z_port port)
-{
-	struct termios tio;
-	int old_timeout;
-	char c;
+int za_drain(z_port port) {
+    struct termios tio;
+    int old_timeout;
+    char c;
 
-	/* set timeout to 0.1s */
-	SYSCALL(tcgetattr(port, &tio));
-	old_timeout = tio.c_cc[VTIME];
-	tio.c_cc[VTIME] = 1;
-	SYSCALL(tcsetattr(port, TCSANOW, &tio));
+    /* set timeout to 0.1s */
+    SYSCALL(tcgetattr(port, &tio));
+    old_timeout = tio.c_cc[VTIME];
+    tio.c_cc[VTIME] = 1;
+    SYSCALL(tcsetattr(port, TCSANOW, &tio));
 
-	/* flush and read whatever else comes in */
-	SYSCALL(tcflush(port, TCIFLUSH));
-	while(read(port, &c, 1) > 0);
+    /* flush and read whatever else comes in */
+    SYSCALL(tcflush(port, TCIFLUSH));
+    while (read(port, &c, 1) > 0) {
+    }
 
-	/* set timeout back to what it was */
-	tio.c_cc[VTIME] = old_timeout;
-	SYSCALL(tcsetattr(port, TCSANOW, &tio));
+    /* set timeout back to what it was */
+    tio.c_cc[VTIME] = old_timeout;
+    SYSCALL(tcsetattr(port, TCSANOW, &tio));
 
-	return Z_SUCCESS;
+    return Z_SUCCESS;
 }
 
 #endif /* if defined(__unix__) || defined(__APPLE__) -- OS detection */
 
-/* A helper for za_decode. Copies from source to destination, until delim or 
- * a '\0' is found, then null-terminates destination. 
+/* A helper for za_decode. Copies from source to destination, until delim or
+ * a '\0' is found, then null-terminates destination.
  *
  * Returns the number of bytes copied, including the added null-terminator. */
-static size_t copy_until_delim(char *destination, const char *source, 
-		const char delim, size_t destination_length)
-{
-	size_t i;
+static size_t copy_until_delim(char *destination, const char *source,
+                               const char delim, size_t destination_length) {
+    size_t i;
 
-	for(i = 0; source[i] != delim && source[i] != '\0' 
-			&& i < destination_length - 1; i++)
-	{
-		destination[i] = source[i];
-	}
+    for (i = 0;
+         source[i] != delim && source[i] != '\0' && i < destination_length - 1;
+         i++) {
+        destination[i] = source[i];
+    }
 
-	destination[i] = '\0'; /* null-terminate instead of copying delim */
+    destination[i] = '\0'; /* null-terminate instead of copying delim */
 
-	return i + 1;
+    return i + 1;
 }
 
-static int decode_reply(struct za_reply *destination, char *reply)
-{
-	char buffer[8]; /* needs to be at least 5B: set to 8 because 
-					   it will be padded to 8 from 5 anyway. */
-	size_t offset,
-		   length;
-
-	if (strlen(reply) < 18)
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: shorter than expected. "
-				"It is likely that only a partial reply was read.\n"
-				"Reply value: %s", reply);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-
-	destination->message_type = '@';
-
-	/* device address: 2 digits, 00-99
-	 *
-	 * The device address is part of the same "token" as the message type,
-	 * so we call strtol on the same token, skipping the first char.
-	 *
-	 * We don't check the length here for future-proofing: 
-	 * if we add support for more device addresses (ie. more digits), 
-	 * this should handle it gracefully. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	destination->device_address = (int) strtol(buffer + 1, NULL, 10);
-	reply += offset;
-
-	/* axis number: 1 digit, 0-9 
-	 *
-	 * The axis number may be 2 digits (or more) in the future, but it's
-	 * unlikely to go over 2^31 - 1 any time soon, so we convert to 
-	 * standard int and use that. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	destination->axis_number = (int) strtol(buffer, NULL, 10);
-	reply += offset;
-	
-	/* reply flags: 2 letters 
-	 *
-	 * Only replies have reply flags. Value is either "OK" or "RJ". */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	if (offset > sizeof(destination->reply_flags))
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: reply flags too "
-				"long. Maximum length: %lu. Your length: %lu. Reply flags "
-				"value: %s\n.", sizeof(destination->reply_flags), offset,
-				buffer);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-	strcpy(destination->reply_flags, buffer);
-	reply += offset;
-	
-	/* device status: 4 letters 
-	 *
-	 * Replies and alerts have a "status" field. Value is either "IDLE" or
-	 * "BUSY", depending on what the device is doing at the time. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	if (offset > sizeof(destination->device_status))
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: device status too "
-				"long. Expected length: %lu. Your length: %lu. Device status "
-				"value: %s\n.", sizeof(destination->device_status), offset,
-				buffer);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-	strcpy(destination->device_status, buffer);
-	reply += offset;
-
-	/* warning flags: 2 letters 
-	 *
-	 * Replies and alerts have warning flags. Warning flags are typically
-	 * "--". All other possible warning flag values should be two 
-	 * consecutive capital letters. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	if (offset > sizeof(destination->warning_flags))
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: warning flags too "
-				"long. Expected length: %lu. Your length: %lu. Warning flags "
-				"value: %s\n.", sizeof(destination->warning_flags), offset,
-				buffer);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-	strcpy(destination->warning_flags, buffer);
-	reply += offset;
-
-	/* data: 1+ characters, probably less than 128 characters
-	 *
-	 * Replies and info have data. This can be anything, including spaces,
-	 * numbers, and human-readable text. */
-	length = strlen(reply); /* get length of remaining data */
-	if (length > sizeof(destination->response_data))
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: response data too "
-				"long. Maximum length: %lu. Your length: %lu. Data: %s.\n",
-				sizeof(destination->response_data), length, reply);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-	strcpy(destination->response_data, reply);
-
-	return Z_SUCCESS;
-
+static int decode_reply(struct za_reply *destination, char *reply) {
+    // needs to be at least 5B: set to 8 because it will be padded to 8 from 5
+    // anyway.
+    char buffer[8];
+    size_t offset, length;
+
+    if (strlen(reply) < 18) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: shorter than expected. "
+            "It is likely that only a partial reply was read.\n"
+            "Reply value: %s",
+            reply);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+
+    destination->message_type = '@';
+
+    /* device address: 2 digits, 00-99
+     *
+     * The device address is part of the same "token" as the message type,
+     * so we call strtol on the same token, skipping the first char.
+     *
+     * We don't check the length here for future-proofing:
+     * if we add support for more device addresses (ie. more digits),
+     * this should handle it gracefully. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    destination->device_address =
+        static_cast<int>(strtol(buffer + 1, NULL, 10));
+    reply += offset;
+
+    /* axis number: 1 digit, 0-9
+     *
+     * The axis number may be 2 digits (or more) in the future, but it's
+     * unlikely to go over 2^31 - 1 any time soon, so we convert to
+     * standard int and use that. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    destination->axis_number = static_cast<int>(strtol(buffer, NULL, 10));
+    reply += offset;
+
+    /* reply flags: 2 letters
+     *
+     * Only replies have reply flags. Value is either "OK" or "RJ". */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    if (offset > sizeof(destination->reply_flags)) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: reply flags too "
+            "long. Maximum length: %lu. Your length: %lu. Reply flags "
+            "value: %s\n.",
+            sizeof(destination->reply_flags), offset, buffer);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+    strcpy(destination->reply_flags, buffer);
+    reply += offset;
+
+    /* device status: 4 letters
+     *
+     * Replies and alerts have a "status" field. Value is either "IDLE" or
+     * "BUSY", depending on what the device is doing at the time. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    if (offset > sizeof(destination->device_status)) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: device status too "
+            "long. Expected length: %lu. Your length: %lu. Device status "
+            "value: %s\n.",
+            sizeof(destination->device_status), offset, buffer);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+    strcpy(destination->device_status, buffer);
+    reply += offset;
+
+    /* warning flags: 2 letters
+     *
+     * Replies and alerts have warning flags. Warning flags are typically
+     * "--". All other possible warning flag values should be two
+     * consecutive capital letters. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    if (offset > sizeof(destination->warning_flags)) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: warning flags too "
+            "long. Expected length: %lu. Your length: %lu. Warning flags "
+            "value: %s\n.",
+            sizeof(destination->warning_flags), offset, buffer);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+    strcpy(destination->warning_flags, buffer);
+    reply += offset;
+
+    /* data: 1+ characters, probably less than 128 characters
+     *
+     * Replies and info have data. This can be anything, including spaces,
+     * numbers, and human-readable text. */
+    length = strlen(reply); /* get length of remaining data */
+    if (length > sizeof(destination->response_data)) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: response data too "
+            "long. Maximum length: %lu. Your length: %lu. Data: %s.\n",
+            sizeof(destination->response_data), length, reply);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+    strcpy(destination->response_data, reply);
+
+    return Z_SUCCESS;
 }
 
-static int decode_alert(struct za_reply *destination, char *reply)
-{
-	size_t offset;
-	char buffer[8]; /* needs to be at least 5B: set to 8 because 
-					   it will be padded to 8 from 5 anyway. */
-
-	if (strlen(reply) < 13)
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: shorter than expected. "
-				"It is likely that only a partial reply was read.\n"
-				"Reply value: %s", reply);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-	
-	destination->message_type = '!';
-
-	/* device address: 2 digits, 00-99
-	 *
-	 * The device address is part of the same "token" as the message type,
-	 * so we call strtol on the same token, skipping the first char.
-	 *
-	 * We don't check the length here for future-proofing: 
-	 * if we add support for more device addresses (ie. more digits), 
-	 * this should handle it gracefully. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	destination->device_address = (int) strtol(buffer + 1, NULL, 10);
-	reply += offset;
-
-	/* axis number: 1 digit, 0-9 
-	 *
-	 * The axis number may be 2 digits (or more) in the future, but it's
-	 * unlikely to go over 2^31 - 1 any time soon, so we convert to 
-	 * standard int and use that. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	destination->axis_number = (int) strtol(buffer, NULL, 10);
-	reply += offset;
-
-	destination->reply_flags[0] = '\0';
-	
-	/* device status: 4 letters 
-	 *
-	 * Replies and alerts have a "status" field. Value is either "IDLE" or
-	 * "BUSY", depending on what the device is doing at the time. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	if (offset > sizeof(destination->device_status))
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: device status too "
-				"long. Expected length: %lu. Your length: %lu. Device status "
-				"value: %s\n.", sizeof(destination->device_status), offset,
-				buffer);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-	strcpy(destination->device_status, buffer);
-	reply += offset;
-
-	/* warning flags: 2 letters 
-	 *
-	 * Replies and alerts have warning flags. Warning flags are typically
-	 * "--". All other possible warning flag values should be two 
-	 * consecutive capital letters. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	if (offset > sizeof(destination->warning_flags))
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: warning flags too "
-				"long. Expected length: %lu. Your length: %lu. Warning flags "
-				"value: %s\n.", sizeof(destination->warning_flags), offset,
-				buffer);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-	strcpy(destination->warning_flags, buffer);
-
-	destination->response_data[0] = '\0';
-
-	return Z_SUCCESS;
+static int decode_alert(struct za_reply *destination, char *reply) {
+    size_t offset;
+    // needs to be at least 5B: set to 8 because it will be padded to 8 from 5
+    // anyway.
+    char buffer[8];
+
+    if (strlen(reply) < 13) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: shorter than expected. "
+            "It is likely that only a partial reply was read.\n"
+            "Reply value: %s",
+            reply);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+
+    destination->message_type = '!';
+
+    /* device address: 2 digits, 00-99
+     *
+     * The device address is part of the same "token" as the message type,
+     * so we call strtol on the same token, skipping the first char.
+     *
+     * We don't check the length here for future-proofing:
+     * if we add support for more device addresses (ie. more digits),
+     * this should handle it gracefully. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    destination->device_address =
+        static_cast<int>(strtol(buffer + 1, NULL, 10));
+    reply += offset;
+
+    /* axis number: 1 digit, 0-9
+     *
+     * The axis number may be 2 digits (or more) in the future, but it's
+     * unlikely to go over 2^31 - 1 any time soon, so we convert to
+     * standard int and use that. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    destination->axis_number = static_cast<int>(strtol(buffer, NULL, 10));
+    reply += offset;
+
+    destination->reply_flags[0] = '\0';
+
+    /* device status: 4 letters
+     *
+     * Replies and alerts have a "status" field. Value is either "IDLE" or
+     * "BUSY", depending on what the device is doing at the time. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    if (offset > sizeof(destination->device_status)) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: device status too "
+            "long. Expected length: %lu. Your length: %lu. Device status "
+            "value: %s\n.",
+            sizeof(destination->device_status), offset, buffer);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+    strcpy(destination->device_status, buffer);
+    reply += offset;
+
+    /* warning flags: 2 letters
+     *
+     * Replies and alerts have warning flags. Warning flags are typically
+     * "--". All other possible warning flag values should be two
+     * consecutive capital letters. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    if (offset > sizeof(destination->warning_flags)) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: warning flags too "
+            "long. Expected length: %lu. Your length: %lu. Warning flags "
+            "value: %s\n.",
+            sizeof(destination->warning_flags), offset, buffer);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+    strcpy(destination->warning_flags, buffer);
+
+    destination->response_data[0] = '\0';
+
+    return Z_SUCCESS;
 }
 
-static int decode_info(struct za_reply *destination, char *reply)
-{
-	size_t length,
-		   offset;
-	char buffer[8]; /* needs to be at least 5B: set to 8 because 
-					   it will be padded to 8 from 5 anyway. */
-
-	if (strlen(reply) < 7)
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: shorter than expected. "
-				"It is likely that only a partial reply was read.\n"
-				"Reply value: %s", reply);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-
-	destination->message_type = '#';
-
-	/* device address: 2 digits, 00-99
-	 *
-	 * The device address is part of the same "token" as the message type,
-	 * so we call strtol on the same token, skipping the first char.
-	 *
-	 * We don't check the length here for future-proofing: 
-	 * if we add support for more device addresses (ie. more digits), 
-	 * this should handle it gracefully. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	destination->device_address = (int) strtol(buffer + 1, NULL, 10);
-	reply += offset;
-
-	/* axis number: 1 digit, 0-9 
-	 *
-	 * The axis number may be 2 digits (or more) in the future, but it's
-	 * unlikely to go over 2^31 - 1 any time soon, so we convert to 
-	 * standard int and use that. */
-	offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
-	destination->axis_number = (int) strtol(buffer, NULL, 10);
-	reply += offset;
-
-	destination->reply_flags[0] = '\0';
-	destination->device_status[0] = '\0';
-	destination->warning_flags[0] = '\0';
-
-	/* data: 1+ characters, probably less than 128 characters
-	 *
-	 * Replies and info have data. This can be anything, including spaces,
-	 * numbers, and human-readable text. */
-	length = strlen(reply); /* get length of remaining data */
-	if (length > sizeof(destination->response_data))
-	{
-		PRINTF_ERROR("[ERROR] Reply could not be decoded: response data too "
-				"long. Maximum length: %lu. Your length: %lu. Data: %s.\n",
-				sizeof(destination->response_data), length, reply);
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-	strcpy(destination->response_data, reply);
-
-	return Z_SUCCESS;
+static int decode_info(struct za_reply *destination, char *reply) {
+    size_t length, offset;
+    // needs to be at least 5B: set to 8 because it will be padded to 8 from 5
+    // anyway.
+    char buffer[8];
+
+    if (strlen(reply) < 7) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: shorter than expected. "
+            "It is likely that only a partial reply was read.\n"
+            "Reply value: %s",
+            reply);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+
+    destination->message_type = '#';
+
+    /* device address: 2 digits, 00-99
+     *
+     * The device address is part of the same "token" as the message type,
+     * so we call strtol on the same token, skipping the first char.
+     *
+     * We don't check the length here for future-proofing:
+     * if we add support for more device addresses (ie. more digits),
+     * this should handle it gracefully. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    destination->device_address =
+        static_cast<int>(strtol(buffer + 1, NULL, 10));
+    reply += offset;
+
+    /* axis number: 1 digit, 0-9
+     *
+     * The axis number may be 2 digits (or more) in the future, but it's
+     * unlikely to go over 2^31 - 1 any time soon, so we convert to
+     * standard int and use that. */
+    offset = copy_until_delim(buffer, reply, ' ', sizeof(buffer));
+    destination->axis_number = static_cast<int>(strtol(buffer, NULL, 10));
+    reply += offset;
+
+    destination->reply_flags[0] = '\0';
+    destination->device_status[0] = '\0';
+    destination->warning_flags[0] = '\0';
+
+    /* data: 1+ characters, probably less than 128 characters
+     *
+     * Replies and info have data. This can be anything, including spaces,
+     * numbers, and human-readable text. */
+    length = strlen(reply); /* get length of remaining data */
+    if (length > sizeof(destination->response_data)) {
+        PRINTF_ERROR(
+            "[ERROR] Reply could not be decoded: response data too "
+            "long. Maximum length: %lu. Your length: %lu. Data: %s.\n",
+            sizeof(destination->response_data), length, reply);
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+    strcpy(destination->response_data, reply);
+
+    return Z_SUCCESS;
 }
 
-/* This function tokenizes using the above helper function to copy 
+/* This function tokenizes using the above helper function to copy
  * token-by-token from reply into buffer, or directly into destination,
  * depending on the field in destination we are populating. It could probably
  * be prettier, more clever, or more efficient, but it's written to be
  * readable, reliable, and robust first.
  *
  * Note that we can safely use strcpy here because the above helper function is
- * guaranteed to write a NUL at the end of its destination string. 
+ * guaranteed to write a NUL at the end of its destination string.
  *
  * See http://www.zaber.com/wiki/Manuals/ASCII_Protocol_Manual#Replies for
  * more info on replies.
  */
-int za_decode(struct za_reply *destination, char *reply)
-{
-	char message_type;
-
-	if (destination == NULL || reply == NULL)
-	{
-		PRINT_ERROR("[ERROR] decoding requires both a non-NULL destination "
-				"and reply to decode.");
-		return Z_ERROR_NULL_PARAMETER;
-	}
-
-	if (strlen(reply) == 0)
-	{
-		PRINT_ERROR("[ERROR] Reply could not be decoded: no data.");
-		return Z_ERROR_COULD_NOT_DECODE;
-	}
-	message_type = reply[0];
-
-	/* most replies are 18 chars or longer: info and alerts can be shorter */
-	switch(message_type)
-	{
-		case '@':
-			return decode_reply(destination, reply);
-		case '!':
-			return decode_alert(destination, reply);
-		case '#':
-			return decode_info(destination, reply);
-		default:
-			PRINTF_ERROR("[ERROR] Reply could not be decoded: unexpected "
-					"message type. Valid types are '@' (reply), '!' (alert), "
-					"and '#' (info). Your type: '%c'. \n", message_type);
+int za_decode(struct za_reply *destination, char *reply) {
+    char message_type;
+
+    if (destination == NULL || reply == NULL) {
+        PRINT_ERROR(
+            "[ERROR] decoding requires both a non-NULL destination "
+            "and reply to decode.");
+        return Z_ERROR_NULL_PARAMETER;
+    }
+
+    if (strlen(reply) == 0) {
+        PRINT_ERROR("[ERROR] Reply could not be decoded: no data.");
+        return Z_ERROR_COULD_NOT_DECODE;
+    }
+    message_type = reply[0];
+
+    /* most replies are 18 chars or longer: info and alerts can be shorter */
+    switch (message_type) {
+        case '@':
+            return decode_reply(destination, reply);
+        case '!':
+            return decode_alert(destination, reply);
+        case '#':
+            return decode_info(destination, reply);
+        default:
+            PRINTF_ERROR(
+                "[ERROR] Reply could not be decoded: unexpected "
+                "message type. Valid types are '@' (reply), '!' (alert), "
+                "and '#' (info). Your type: '%c'. \n",
+                message_type);
             PRINTF_ERROR("Full message: %s\n", reply);
-			return Z_ERROR_COULD_NOT_DECODE;
-	}		
+            return Z_ERROR_COULD_NOT_DECODE;
+    }
 }
-
diff --git a/src/libZaber/za_serial.h b/src/libZaber/za_serial.h
index 644beb48..1be9e90e 100644
--- a/src/libZaber/za_serial.h
+++ b/src/libZaber/za_serial.h
@@ -1,11 +1,11 @@
-/** 
+/**
  * \file za_serial.h
  * \author Eric Dand
  * \version 1.0
  * \date 28 November 2014
  * \copyright Apache Software License Version 2.0
- * 
- * \brief Provides a set of functions for interacting with Zaber devices in 
+ *
+ * \brief Provides a set of functions for interacting with Zaber devices in
  * the ASCII protocol.
  */
 
@@ -13,7 +13,7 @@
 #define ZA_SERIAL_H
 
 #if defined(__cplusplus)
-extern "C"{
+extern "C" {
 #endif /* if defined(__cplusplus) */
 
 #include "z_common.h"
@@ -24,52 +24,52 @@ extern "C"{
  * with ASCII replies. The names of the fields are taken straight from the
  * ASCII protocol manual.
  *
- * Note that the response data may contain more than one piece of data: 
+ * Note that the response data may contain more than one piece of data:
  * because many replies will return multiple pieces of data, the response_data
  * field will simply contain the end of the message, without the newline
  * terminators. (ie. "\r\n")
  */
 struct za_reply {
-	/** The message type will always be '@' for replies. 
-	 * Info will have the type '#', and alerts '!'. */
-	char message_type;
-	/** The address of the device, an integer between 1 and 99. */
-	int device_address;
-	/** The axis number: 0-9, where 0 refers to the whole device, 
-	 * and 1-9 refer only to that specific axis. */
-	int axis_number;
-	/** Whether a command was accepted or rejected: either "OK" or "RJ". */
-	char reply_flags[3];
-	/** Either "BUSY" when the axis is moving, or "IDLE" when it isn't. */
-	char device_status[5];
-	/** The highest priority warning for the device,
-	 * or -- under normal conditions. */
-	char warning_flags[3];
-	/** The response for the command executed. See the protocol manual entry
-	 * for your command of choice to know what to expect here. */
-	char response_data[128];
+    /** The message type will always be '@' for replies.
+     * Info will have the type '#', and alerts '!'. */
+    char message_type;
+    /** The address of the device, an integer between 1 and 99. */
+    int device_address;
+    /** The axis number: 0-9, where 0 refers to the whole device,
+     * and 1-9 refer only to that specific axis. */
+    int axis_number;
+    /** Whether a command was accepted or rejected: either "OK" or "RJ". */
+    char reply_flags[3];
+    /** Either "BUSY" when the axis is moving, or "IDLE" when it isn't. */
+    char device_status[5];
+    /** The highest priority warning for the device,
+     * or -- under normal conditions. */
+    char warning_flags[3];
+    /** The response for the command executed. See the protocol manual entry
+     * for your command of choice to know what to expect here. */
+    char response_data[128];
 };
 
-/** Connect to a serial port specified by \a port_name. 
+/** Connect to a serial port specified by \a port_name.
  *
- * Configures the port to the ASCII protocol defaults (115200 baud, 8N1). 
- * If you have set your device to run at a different baud rate, use 
+ * Configures the port to the ASCII protocol defaults (115200 baud, 8N1).
+ * If you have set your device to run at a different baud rate, use
  * za_setbaud() to change it after connecting using this function.
  *
- * On Linux the port name will likely be something like "/dev/ttyUSB0", 
+ * On Linux the port name will likely be something like "/dev/ttyUSB0",
  * on Windows "COM1", and on OS X and BSD systems "/dev/cu.usbserial-A4017CQX".
  * It is important that OS X/BSD systems use the "callout" (cu.* or cua.*) port
- * as opposed to the "dial in" ports with names starting with tty.*, 
+ * as opposed to the "dial in" ports with names starting with tty.*,
  * which will not work with Zaber devices.
  *
- * If you are re-using a `z_port`, make sure to use za_disconnect() to 
+ * If you are re-using a `z_port`, make sure to use za_disconnect() to
  * disconnect the old port before overwriting it with a new one.
  *
- * \param[out] port a pointer to a `z_port` to be written-over with the 
+ * \param[out] port a pointer to a `z_port` to be written-over with the
  * newly-connected port.
- * \param[in] port_name a string containing the name of the port to be opened. 
+ * \param[in] port_name a string containing the name of the port to be opened.
  *
- * \return Z_SUCCESS on success, Z_ERROR_NULL_PARAMETER if \a port or 
+ * \return Z_SUCCESS on success, Z_ERROR_NULL_PARAMETER if \a port or
  * \a port_name is NULL, or Z_ERROR_SYSTEM_ERROR in case of system error.
  */
 int za_connect(z_port *port, const char *port_name);
@@ -85,7 +85,7 @@ int za_disconnect(z_port port);
 /** Sends a command to a serial port.
  *
  * Automatically adds a '/' to begin the command and a '\\n' to end it if
- * these characters are omitted from \a command. 
+ * these characters are omitted from \a command.
  *
  * \param[in] port the port to which to send the command.
  * \param[in] command a string containing the command to be sent.
@@ -95,24 +95,24 @@ int za_disconnect(z_port port);
  */
 int za_send(z_port port, const char *command);
 
-/** Reads a message from the serial port. 
- * 
- * Blocks while reading until it encounters a newline character or its 
+/** Reads a message from the serial port.
+ *
+ * Blocks while reading until it encounters a newline character or its
  * timeout has elapsed.
  *
- * Note: It is recommended that your \a destination buffer be 256B long. 
- * This is long enough to hold any reply from a Zaber device using the 
+ * Note: It is recommended that your \a destination buffer be 256B long.
+ * This is long enough to hold any reply from a Zaber device using the
  * ASCII protocol.
  *
  * Note that this function will simply read the first message on the input
  * buffer, whatever it may be. If you have sent many commands without
  * receiving their corresponding replies, sorting them all out may be a real
  * headache. Note also that the input buffer is finite, and allowing it to
- * fill up will result in undefined behaviour. Try to receive responses to 
+ * fill up will result in undefined behaviour. Try to receive responses to
  * every command you send, or use za_drain() when necessary.
  *
- * Passing NULL for \a destination and 0 for \a length will read a single 
- * reply, discarding it as it is read. This is useful for keeping your 
+ * Passing NULL for \a destination and 0 for \a length will read a single
+ * reply, discarding it as it is read. This is useful for keeping your
  * commands and replies straight without using zb_drain() when you don't care
  * about the contents of most of the replies.
  *
@@ -120,8 +120,8 @@ int za_send(z_port port, const char *command);
  * \param[out] destination a pointer to which to write the reply read.
  * \param[in] length the length of the buffer pointed to by \a destination.
  *
- * \return the number of bytes read, Z_ERROR_SYSTEM_ERROR in case of system 
- * error, or Z_ERROR_BUFFER_TOO_SMALL if \a length is insufficient to store 
+ * \return the number of bytes read, Z_ERROR_SYSTEM_ERROR in case of system
+ * error, or Z_ERROR_BUFFER_TOO_SMALL if \a length is insufficient to store
  * the reply.
  */
 int za_receive(z_port port, char *destination, int length);
@@ -131,20 +131,20 @@ int za_receive(z_port port, char *destination, int length);
  * The #za_reply struct can then be used to gain easier access to the parts
  * of an ASCII reply.
  *
- * \param[out] destination a pointer to a za_reply struct to be populated 
+ * \param[out] destination a pointer to a za_reply struct to be populated
  * with the data found in \a reply.
  * \param[in] reply a pointer to a string containing a full reply from a Zaber
  * device, as specified by the ASCII protocol manual.
  *
- * \return Z_SUCCESS on success, Z_ERROR_NULL_PARAMETER if \a destination or 
- * \a reply is NULL, or Z_ERROR_COULD_NOT_DECODE if the reply is malformed. 
+ * \return Z_SUCCESS on success, Z_ERROR_NULL_PARAMETER if \a destination or
+ * \a reply is NULL, or Z_ERROR_COULD_NOT_DECODE if the reply is malformed.
  */
 int za_decode(struct za_reply *destination, char *reply);
 
-/** Changes the baud rate of both input and output. 
+/** Changes the baud rate of both input and output.
  *
  * This function is unlikely to be necessary for typical use, as za_connect()
- * already sets the baud rate to 115200, the recommended rate for the 
+ * already sets the baud rate to 115200, the recommended rate for the
  * ASCII protocol.
  *
  * Note: za_setbaud() flushes both input and output buffers to ensure a
@@ -159,41 +159,42 @@ int za_decode(struct za_reply *destination, char *reply);
  * \param[in] port the port to change.
  * \param[in] baud the new desired baud rate.
  *
- * \return Z_SUCCESS on success, Z_ERROR_INVALID_BAUDRATE if the baud rate is not one
- * specified above, or Z_ERROR_SYSTEM_ERROR in case of system error.
+ * \return Z_SUCCESS on success, Z_ERROR_INVALID_BAUDRATE if the baud rate is
+ * not one specified above, or Z_ERROR_SYSTEM_ERROR in case of system error.
  */
 int za_setbaud(z_port port, int baud);
 
 /** Flushes all input received but not yet read, and attempts to drain all
- * input that would be incoming. 
+ * input that would be incoming.
  *
- * This function is intended to be used when many commands have been sent 
+ * This function is intended to be used when many commands have been sent
  * without reading any responses, and there is a need to read a response from
- * a certain command. In other words, call this function before sending a 
- * command whose response you would like to read if you have not been 
+ * a certain command. In other words, call this function before sending a
+ * command whose response you would like to read if you have not been
  * consistently reading the responses to previous commands.
  *
  * This function will always take at least 100ms to complete, as it tries to
  * read input until it is certain no more is arriving by waiting 100ms before
  * deciding there is no more input incoming. Do not use it for
- * time-sensitive operations, or in any kind of "chatty" setup, eg. multiple 
+ * time-sensitive operations, or in any kind of "chatty" setup, eg. multiple
  * devices daisy-chained together with move tracking enabled. In such a setup,
  * the only reliable way to retrieve reply data is to always follow
  * calls to za_send() with calls to za_receive().
  *
  * \param[in] port the port to drain.
  *
- * \return Z_SUCCESS on success, or Z_ERROR_SYSTEM_ERROR in case of system error.
+ * \return Z_SUCCESS on success, or Z_ERROR_SYSTEM_ERROR in case of system
+ * error.
  */
 int za_drain(z_port port);
 
-/** Sets whether errors and extra info are reported to `stderr`. 
- * 
+/** Sets whether errors and extra info are reported to `stderr`.
+ *
  * Set \a value to 0 to disable all output. Additionally, you can compile this
  * library with the macro NDEBUG defined, which will disable all output and
  * skip checks to "verbose" altogether in the compiled code.
  *
- * \param[in] value whether or not the program should output error messages 
+ * \param[in] value whether or not the program should output error messages
  * and info to `stderr`.
  */
 void za_set_verbose(int value);
diff --git a/src/tools/ftdi_list.cpp b/src/tools/ftdi_list.cpp
index 548d2287..0cfea770 100644
--- a/src/tools/ftdi_list.cpp
+++ b/src/tools/ftdi_list.cpp
@@ -1,50 +1,51 @@
 // ftdi/usb
 #ifdef LIBUSB_ENABLED
-#include <libusb-1.0/libusb.h>
 #include <libftdi1/ftdi.h>
+#include <libusb-1.0/libusb.h>
 #endif
 
 // std/stl
 #include <getopt.h>
-#include <vector>
-#include <string>
+
 #include <iomanip>
 #include <sstream>
+#include <string>
+#include <vector>
 
 // labremote
 #include "Logger.h"
 
-
 void usage(char* argv[]) {
-
-    std::cerr << "Usage: " <<  argv[0] << " [OPTIONS] [vendor:product]" << std::endl;
+    std::cerr << "Usage: " << argv[0] << " [OPTIONS] [vendor:product]"
+              << std::endl;
     std::cerr << std::endl;
     std::cerr << "Options:" << std::endl;
-    std::cerr << " -d, --debug   Increase verbosity of logging output" << std::endl;
+    std::cerr << " -d, --debug   Increase verbosity of logging output"
+              << std::endl;
     std::cerr << " -h, --help    Print this help message" << std::endl;
     std::cerr << "Optional positional arguments:" << std::endl;
-    std::cerr << " vendor:product   FTDI (USB) device's vendor and product hex-string IDs (default: 0:0, to list all FTDI devices)" << std::endl;
+    std::cerr << " vendor:product   FTDI (USB) device's vendor and product "
+                 "hex-string IDs (default: 0:0, to list all FTDI devices)"
+              << std::endl;
     std::cerr << std::endl;
 }
 
 int main(int argc, char* argv[]) {
-
 #ifndef LIBUSB_ENABLED
-    std::cerr << "libusb marked as not enabled, cannot run program \"" << argv[0] << "\"" << std::endl;
+    std::cerr << "libusb marked as not enabled, cannot run program \""
+              << argv[0] << "\"" << std::endl;
     return 1;
 #else
 
     int _vid = 0;
     int _pid = 0;
 
-    static struct option long_options[] = {
-        {"debug", no_argument, NULL, 'd'},
-        {"help", no_argument, NULL, 'h'},
-        {0,0,0,0}
-    };
+    static struct option long_options[] = {{"debug", no_argument, NULL, 'd'},
+                                           {"help", no_argument, NULL, 'h'},
+                                           {0, 0, 0, 0}};
     int c;
-    while( (c = getopt_long(argc, argv, "hd", long_options, NULL)) != -1 ) {
-        switch(c) {
+    while ((c = getopt_long(argc, argv, "hd", long_options, NULL)) != -1) {
+        switch (c) {
             case 'd':
                 logIt::incrDebug();
                 break;
@@ -52,47 +53,48 @@ int main(int argc, char* argv[]) {
                 usage(argv);
                 return 0;
             case '?':
-                std::cerr << "Invalid option \"" << c << "\" provided" << std::endl;
+                std::cerr << "Invalid option \"" << c << "\" provided"
+                          << std::endl;
                 return 1;
-        } // switch
-    } // while
+        }  // switch
+    }      // while
 
-    if( (argc-optind) > 1)
-    {
+    if ((argc - optind) > 1) {
         logger(logERROR) << "Too many position arguments provided";
         return 1;
     }
-    if(optind == (argc-1))
-    {
+    if (optind == (argc - 1)) {
         std::string idstring = argv[optind++];
         std::size_t sep = idstring.find(":");
-        if(sep == std::string::npos)
-        {
-            logger(logERROR) << "Device vendor:product string formatted incorrectly, must be 0000:0000 (hex strings)";
+        if (sep == std::string::npos) {
+            logger(logERROR) << "Device vendor:product string formatted "
+                                "incorrectly, must be 0000:0000 (hex strings)";
             return 1;
         }
-        _vid = std::stoi(idstring.substr(0,sep),0,16);
-        _pid = std::stoi(idstring.substr(sep+1),0,16);
+        _vid = std::stoi(idstring.substr(0, sep), 0, 16);
+        _pid = std::stoi(idstring.substr(sep + 1), 0, 16);
     }
 
-    logger(logDEBUG) << "Listing devices with VID:PID = 0x" << std::hex << _vid << ":0x" << _pid << std::dec;
+    logger(logDEBUG) << "Listing devices with VID:PID = 0x" << std::hex << _vid
+                     << ":0x" << _pid << std::dec;
 
     int rc = 0;
     int device_count = 0;
 
     struct ftdi_context ftdi;
     struct ftdi_device_list *devlist, *curdev;
-    if((rc = ftdi_init(&ftdi)) != 0) {
+    if ((rc = ftdi_init(&ftdi)) != 0) {
         logger(logERROR) << "ftdi_init failed";
         return 1;
     }
 
-    if((device_count = ftdi_usb_find_all(&ftdi, &devlist, _vid, _pid) < 0)) {
+    if ((device_count = ftdi_usb_find_all(&ftdi, &devlist, _vid, _pid) < 0)) {
         logger(logERROR) << "ftdi_usb_find_all failed with error " << rc;
         ftdi_usb_close(&ftdi);
         return 1;
     }
-    logger(logDEBUG) << "Found " << device_count << " FTDI devices connected on this machine";
+    logger(logDEBUG) << "Found " << device_count
+                     << " FTDI devices connected on this machine";
 
     std::vector<std::string> _mfr;
     std::vector<std::string> _des;
@@ -102,14 +104,14 @@ int main(int argc, char* argv[]) {
 
     int idev = 0;
     for (curdev = devlist; curdev != NULL; idev++) {
-
         libusb_device_descriptor desc = {0};
         libusb_get_device_descriptor(curdev->dev, &desc);
         _vendor.push_back(desc.idVendor);
         _product.push_back(desc.idProduct);
 
         char mfr[128], des[128], ser[128];
-        if((rc = ftdi_usb_get_strings(&ftdi, curdev->dev, mfr, 128, des, 128, ser, 128)) != 0) {
+        if ((rc = ftdi_usb_get_strings(&ftdi, curdev->dev, mfr, 128, des, 128,
+                                       ser, 128)) != 0) {
             _mfr.push_back("");
             _des.push_back("");
             _ser.push_back("");
@@ -124,9 +126,15 @@ int main(int argc, char* argv[]) {
     }
     ftdi_usb_close(&ftdi);
 
-    logger(logINFO) << "Found " << _mfr.size() << " FTDI devices matching " << std::setfill('0') << std::setw(4) << std::hex << _vid << ":" << std::setfill('0') << std::setw(4) << _pid << std::dec;
-    for(size_t ii = 0; ii < _mfr.size(); ii++) {
-        logger(logINFO) << "Device #" << ii << " (" << std::hex << std::setfill('0') << std::setw(4) << _vendor.at(ii) << ":" << std::setfill('0') << std::setw(4) << _product.at(ii) << ")" << std::dec;
+    logger(logINFO) << "Found " << _mfr.size() << " FTDI devices matching "
+                    << std::setfill('0') << std::setw(4) << std::hex << _vid
+                    << ":" << std::setfill('0') << std::setw(4) << _pid
+                    << std::dec;
+    for (size_t ii = 0; ii < _mfr.size(); ii++) {
+        logger(logINFO) << "Device #" << ii << " (" << std::hex
+                        << std::setfill('0') << std::setw(4) << _vendor.at(ii)
+                        << ":" << std::setfill('0') << std::setw(4)
+                        << _product.at(ii) << ")" << std::dec;
         logger(logINFO) << "    MANUFRACTURER ID : " << _mfr.at(ii);
         logger(logINFO) << "    PRODUCT ID       : " << _des.at(ii);
         logger(logINFO) << "    SERIAL NUMBER    : " << _ser.at(ii);
diff --git a/src/tools/ftdi_setidentity.cpp b/src/tools/ftdi_setidentity.cpp
index a68a6e91..cbc72d4f 100644
--- a/src/tools/ftdi_setidentity.cpp
+++ b/src/tools/ftdi_setidentity.cpp
@@ -1,12 +1,11 @@
-#include <unistd.h>
-#include <stdlib.h>
 #include <getopt.h>
+#include <libftdi1/ftdi.h>
+#include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
-#include <iostream>
 #include <iomanip>
-
-#include <libftdi1/ftdi.h>
+#include <iostream>
 
 #include "Logger.h"
 
@@ -17,152 +16,136 @@ std::string mode;
 std::string value;
 //---------------
 
-void usage(char *argv[])
-{
-  std::cerr << "Usage: " << argv[0] << " vendor:product manufacturer/product/serial value" << std::endl;
-  std::cerr << std::endl;
-  std::cerr << "List of options:" << std::endl;
-  std::cerr << " -d, --debug       Enable more verbose printout, use multiple for increased debug level" << std::endl;
-  std::cerr << std::endl;
-  std::cerr << std::endl;
+void usage(char *argv[]) {
+    std::cerr << "Usage: " << argv[0]
+              << " vendor:product manufacturer/product/serial value"
+              << std::endl;
+    std::cerr << std::endl;
+    std::cerr << "List of options:" << std::endl;
+    std::cerr << " -d, --debug       Enable more verbose printout, use "
+                 "multiple for increased debug level"
+              << std::endl;
+    std::cerr << std::endl;
+    std::cerr << std::endl;
 }
 
-int main(int argc, char*argv[])
-{
-
-  //Parse command-line
-  int c;
-  while (1) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"debug",    no_argument      , 0,  'd' },
-      {0,          0,                 0,  0 }
-    };
-
-    c = getopt_long(argc, argv, "d", long_options, &option_index);
-    if (c == -1)
-      break;
-
-    switch (c)
-      {
-      case 'd':
-	logIt::incrDebug();
-	break;
-      default:
-	std::cerr << "Invalid option '" << c << "' supplied. Aborting." << std::endl;
-	std::cerr << std::endl;
-	usage(argv);
-	return 1;
-      }
-  }
-
-  if(optind>argc-3)
-    {
-      logger(logERROR) << "Extra positional arguments.";
-      usage(argv);
-      return 1;
+int main(int argc, char *argv[]) {
+    // Parse command-line
+    int c;
+    while (1) {
+        int option_index = 0;
+        static struct option long_options[] = {{"debug", no_argument, 0, 'd'},
+                                               {0, 0, 0, 0}};
+
+        c = getopt_long(argc, argv, "d", long_options, &option_index);
+        if (c == -1) break;
+
+        switch (c) {
+            case 'd':
+                logIt::incrDebug();
+                break;
+            default:
+                std::cerr << "Invalid option '" << c << "' supplied. Aborting."
+                          << std::endl;
+                std::cerr << std::endl;
+                usage(argv);
+                return 1;
+        }
     }
 
-  std::string idstring = argv[optind++];
-  mode     = argv[optind++];
-  value    = argv[optind++];
-
-  // parse the id string
-  std::size_t sep=idstring.find(':');
-  if(sep==std::string::npos)
-    {
-      logger(logERROR) << "vendor:product must be in format 0000:0000";
-      usage(argv);
-      return 1;
-    }
-  vendor =std::stoi(idstring.substr(0,sep), 0,16);
-  product=std::stoi(idstring.substr(sep+1), 0,16);
-
-  logger(logDEBUG) << "Settings:";
-  logger(logDEBUG) << " vendor = 0x" << std::hex << std::setw(4) << std::setfill('0') << vendor << std::dec;
-  logger(logDEBUG) << " product = 0x" << std::hex << std::setw(4) << std::setfill('0') << product << std::dec;
-  logger(logDEBUG) << " mode = " << mode;
-  logger(logDEBUG) << " value = " << value;
-
-  //
-  // Open FTDI
-  int ret=0;
-  struct ftdi_context ftdi;
-
-  if((ret=ftdi_init(&ftdi))!=0)
-    {
-      logger(logERROR) << "ftdi_init failed: " << ret;
-      return 1;
+    if (optind > argc - 3) {
+        logger(logERROR) << "Extra positional arguments.";
+        usage(argv);
+        return 1;
     }
 
-  if((ret=ftdi_usb_open(&ftdi,0x0403,0x6014))<0)
-    {
-      logger(logERROR) << "ftdi_usb_open failed: " << ret;
-      return 1;
-    }
+    std::string idstring = argv[optind++];
+    mode = argv[optind++];
+    value = argv[optind++];
 
-  //
-  // Read EEPROM
-  if((ret=ftdi_read_eeprom(&ftdi))<0)
-    {
-      logger(logERROR) << "ftdi_read_eeprom failed: " << ret;
-      return 1;
+    // parse the id string
+    std::size_t sep = idstring.find(':');
+    if (sep == std::string::npos) {
+        logger(logERROR) << "vendor:product must be in format 0000:0000";
+        usage(argv);
+        return 1;
     }
-
-  if((ret=ftdi_eeprom_decode(&ftdi, 0))<0)
-    {
-      logger(logERROR) << "ftdi_eeprom_decode failed: " << ret;
-      return 1;
+    vendor = std::stoi(idstring.substr(0, sep), 0, 16);
+    product = std::stoi(idstring.substr(sep + 1), 0, 16);
+
+    logger(logDEBUG) << "Settings:";
+    logger(logDEBUG) << " vendor = 0x" << std::hex << std::setw(4)
+                     << std::setfill('0') << vendor << std::dec;
+    logger(logDEBUG) << " product = 0x" << std::hex << std::setw(4)
+                     << std::setfill('0') << product << std::dec;
+    logger(logDEBUG) << " mode = " << mode;
+    logger(logDEBUG) << " value = " << value;
+
+    //
+    // Open FTDI
+    int ret = 0;
+    struct ftdi_context ftdi;
+
+    if ((ret = ftdi_init(&ftdi)) != 0) {
+        logger(logERROR) << "ftdi_init failed: " << ret;
+        return 1;
     }
 
-  //
-  // Update strings
-  char *cstr = new char[value.length() + 1]; // non-const :(
-  strcpy(cstr, value.c_str());
-
-  if(mode=="manufacturer")
-    {
-      ret=ftdi_eeprom_set_strings(&ftdi, cstr, NULL, NULL);
+    if ((ret = ftdi_usb_open(&ftdi, 0x0403, 0x6014)) < 0) {
+        logger(logERROR) << "ftdi_usb_open failed: " << ret;
+        return 1;
     }
-  else if(mode=="product")
-    {
-      ret=ftdi_eeprom_set_strings(&ftdi, NULL, cstr, NULL);
+
+    //
+    // Read EEPROM
+    if ((ret = ftdi_read_eeprom(&ftdi)) < 0) {
+        logger(logERROR) << "ftdi_read_eeprom failed: " << ret;
+        return 1;
     }
-  else if(mode=="serial")
-    {
-      ret=ftdi_eeprom_set_strings(&ftdi, NULL, NULL, cstr);
+
+    if ((ret = ftdi_eeprom_decode(&ftdi, 0)) < 0) {
+        logger(logERROR) << "ftdi_eeprom_decode failed: " << ret;
+        return 1;
     }
-  else
-    {
-      logger(logERROR) << "Mode must be manufacturer or product or serial";
-      usage(argv);
+
+    //
+    // Update strings
+    char *cstr = new char[value.length() + 1];  // non-const :(
+    strcpy(cstr, value.c_str());
+
+    if (mode == "manufacturer") {
+        ret = ftdi_eeprom_set_strings(&ftdi, cstr, NULL, NULL);
+    } else if (mode == "product") {
+        ret = ftdi_eeprom_set_strings(&ftdi, NULL, cstr, NULL);
+    } else if (mode == "serial") {
+        ret = ftdi_eeprom_set_strings(&ftdi, NULL, NULL, cstr);
+    } else {
+        logger(logERROR) << "Mode must be manufacturer or product or serial";
+        usage(argv);
     }
 
-  if(ret<0)
-    {
-      logger(logERROR) << "ftdi_eeprom_set_strings failed: " << ret;
-      return 1;
-    }  
+    if (ret < 0) {
+        logger(logERROR) << "ftdi_eeprom_set_strings failed: " << ret;
+        return 1;
+    }
 
-  delete [] cstr;
+    delete[] cstr;
 
-  //
-  // Build and save the EEPROM
-  if((ret=ftdi_eeprom_build(&ftdi))<0)
-    {
-      logger(logERROR) << "ftdi_eeprom_decode failed: " << ret;
-      return 1;
+    //
+    // Build and save the EEPROM
+    if ((ret = ftdi_eeprom_build(&ftdi)) < 0) {
+        logger(logERROR) << "ftdi_eeprom_decode failed: " << ret;
+        return 1;
     }
 
-  if((ret=ftdi_write_eeprom(&ftdi))<0)
-    {
-      logger(logERROR) << "ftdi_eeprom_decode failed: " << ret;
-      return 1;
+    if ((ret = ftdi_write_eeprom(&ftdi)) < 0) {
+        logger(logERROR) << "ftdi_eeprom_decode failed: " << ret;
+        return 1;
     }
 
-  //
-  // Clean up
-  ftdi_usb_close(&ftdi);
+    //
+    // Clean up
+    ftdi_usb_close(&ftdi);
 
-  return 0;
+    return 0;
 }
diff --git a/src/tools/gpibscan.cpp b/src/tools/gpibscan.cpp
index a24d9cc2..eec3b656 100644
--- a/src/tools/gpibscan.cpp
+++ b/src/tools/gpibscan.cpp
@@ -1,6 +1,6 @@
-#include <unistd.h>
-#include <stdlib.h>
 #include <getopt.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #include <algorithm>
 #include <chrono>
@@ -16,6 +16,7 @@
 
 #ifdef LINUXGPIB
 #include <gpib/ib.h>
+
 #include "GPIBNICom.h"
 #endif
 
@@ -23,139 +24,132 @@
 std::string port;
 //---------------
 
-
-void usage(char *argv[])
-{
-  std::cerr << "Usage: " << argv[0] << " [options] usbport" << std::endl;
-  std::cerr << "" << std::endl;
-  std::cerr << "List of options:" << std::endl;
-  std::cerr << " -d, --debug       Enable more verbose printout, use multiple for increased debug level"  << std::endl;  
+void usage(char* argv[]) {
+    std::cerr << "Usage: " << argv[0] << " [options] usbport" << std::endl;
+    std::cerr << "" << std::endl;
+    std::cerr << "List of options:" << std::endl;
+    std::cerr << " -d, --debug       Enable more verbose printout, use "
+                 "multiple for increased debug level"
+              << std::endl;
 #ifdef LINUXGPIB
-  std::cerr << " -l, --linuxgpib   Use linux-GPIB package to earch for devices instead of serial."  << std::endl;  
+    std::cerr << " -l, --linuxgpib   Use linux-GPIB package to earch for "
+                 "devices instead of serial."
+              << std::endl;
 #endif
-  std::cerr << "" << std::endl;
-  std::cerr << "" << std::endl;
+    std::cerr << "" << std::endl;
+    std::cerr << "" << std::endl;
 }
 
-int main(int argc, char*argv[])
-{
-
-  if (argc < 1)
-    {
-      usage(argv);
-      return 1;
+int main(int argc, char* argv[]) {
+    if (argc < 1) {
+        usage(argv);
+        return 1;
     }
 
-  //Parse command-line
-  bool useLG = false;
-  int c;
-  while (1) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"debug",     no_argument      , 0,  'd' },
+    // Parse command-line
+    bool useLG = false;
+    int c;
+    while (1) {
+        int option_index = 0;
+        static struct option long_options[] = {
+            {"debug", no_argument, 0, 'd'},
 #ifdef LINUXGPIB
-      {"linuxgpib", no_argument      , 0,  'l' },
+            {"linuxgpib", no_argument, 0, 'l'},
 #endif
-      {0,           0,                 0,  0 }
-    };
-    
+            {0, 0, 0, 0}};
+
 #ifdef LINUXGPIB
-    c = getopt_long(argc, argv, "dl", long_options, &option_index);
+        c = getopt_long(argc, argv, "dl", long_options, &option_index);
 #else
-    c = getopt_long(argc, argv, "d", long_options, &option_index);
+        c = getopt_long(argc, argv, "d", long_options, &option_index);
 #endif
-    if (c == -1)
-      break;
-
-    switch (c)
-      {
-      case 'd':
-	logIt::incrDebug();	
-	break;
-      case 'l':
-	useLG = true;
-	break;
-      default:
-	std::cerr << "Invalid option '" << c << "' supplied. Aborting." << std::endl;
-	std::cerr << std::endl;
-	usage(argv);
-	return 1;
-      }
-  }
-
-  if(argc!=optind+1)
-    {
-      std::cerr << "Required usbport argument missing." << std::endl;
-      std::cerr << std::endl;
-      usage(argv);
-      return 1;
-    }
-  port=argv[optind++];
+        if (c == -1) break;
 
-  //
-#ifdef LINUXGPIB
-  if(useLG){
-    Addr4882_t addresses[32];
-    Addr4882_t instruments[31];
-    
-    // create addresses array
-    for (int i = 0; i < 30; i++) {
-      addresses[i] = (Addr4882_t)(i + 1);
+        switch (c) {
+            case 'd':
+                logIt::incrDebug();
+                break;
+            case 'l':
+                useLG = true;
+                break;
+            default:
+                std::cerr << "Invalid option '" << c << "' supplied. Aborting."
+                          << std::endl;
+                std::cerr << std::endl;
+                usage(argv);
+                return 1;
+        }
     }
-    addresses[30] = NOADDR;
-    
-    // find listeners and fill instruments array
-    FindLstn(std::stoi(port), addresses, instruments , 31);
-    int numbInstruments = ibcntl;
-    if (numbInstruments == 0) {
-      std::cout << "WARNING : No instruments found on interface GPIB" << port << std::endl;
-      return 1;
-    }
-    // loop over instruments array
-    for (int i = 0; i < numbInstruments; i++) {
-      unsigned int PAD = GetPAD(instruments[i]);
-      unsigned int SAD = GetSAD(instruments[i]);
-      std::shared_ptr<GPIBNICom> com(new GPIBNICom(std::stoi(port), PAD, SAD));
-      com->init();
-      std::string idrep = com->sendreceive(std::string("*IDN?"));
-      std::cout << "GPIB"<<port<<", PAD " << PAD << ", SAD " << SAD << ": " << idrep << std::endl;
+
+    if (argc != optind + 1) {
+        std::cerr << "Required usbport argument missing." << std::endl;
+        std::cerr << std::endl;
+        usage(argv);
+        return 1;
     }
-    
-  }
+    port = argv[optind++];
+
+    //
+#ifdef LINUXGPIB
+    if (useLG) {
+        Addr4882_t addresses[32];
+        Addr4882_t instruments[31];
+
+        // create addresses array
+        for (int i = 0; i < 30; i++) {
+            addresses[i] = (Addr4882_t)(i + 1);
+        }
+        addresses[30] = NOADDR;
 
-  else {
+        // find listeners and fill instruments array
+        FindLstn(std::stoi(port), addresses, instruments, 31);
+        int numbInstruments = ibcntl;
+        if (numbInstruments == 0) {
+            std::cout << "WARNING : No instruments found on interface GPIB"
+                      << port << std::endl;
+            return 1;
+        }
+        // loop over instruments array
+        for (int i = 0; i < numbInstruments; i++) {
+            unsigned int PAD = GetPAD(instruments[i]);
+            unsigned int SAD = GetSAD(instruments[i]);
+            std::shared_ptr<GPIBNICom> com(
+                new GPIBNICom(std::stoi(port), PAD, SAD));
+            com->init();
+            std::string idrep = com->sendreceive(std::string("*IDN?"));
+            std::cout << "GPIB" << port << ", PAD " << PAD << ", SAD " << SAD
+                      << ": " << idrep << std::endl;
+        }
+    } else {
 #endif
-    // Create usb connection and scan address ranges
-    
-    // Create and initialize connection
-    std::shared_ptr<SerialCom> com(new SerialCom(port));
-    com->send("++auto 0\n\r");
-    
-    // Start scanning
-    std::string buf;
-    for(uint32_t addr=0;addr<31;addr++)
-      {
-	std::cout << std::setw(2) << addr << ": ";
-	
-	com->send("++addr " + std::to_string(addr) + "\n\r");
-	com->send("*IDN?\n\r");
-	std::this_thread::sleep_for(std::chrono::milliseconds(500));
-	com->send("++read eoi\n\r");
-	std::this_thread::sleep_for(std::chrono::milliseconds(500));
-	try
-	  {
-	    buf=com->receive();
-	    buf.erase(std::remove(buf.begin(),buf.end(),'\n'),buf.end());
-	    buf.erase(std::remove(buf.begin(),buf.end(),'\r'),buf.end());
-	    std::cout << buf;
-	  }
-	catch(const std::runtime_error& e)
-	  { /* Nothing connected here */ }
-	std::cout << std::endl;
-      }
+        // Create usb connection and scan address ranges
+
+        // Create and initialize connection
+        std::shared_ptr<SerialCom> com(new SerialCom(port));
+        com->send("++auto 0\n\r");
+
+        // Start scanning
+        std::string buf;
+        for (uint32_t addr = 0; addr < 31; addr++) {
+            std::cout << std::setw(2) << addr << ": ";
+
+            com->send("++addr " + std::to_string(addr) + "\n\r");
+            com->send("*IDN?\n\r");
+            std::this_thread::sleep_for(std::chrono::milliseconds(500));
+            com->send("++read eoi\n\r");
+            std::this_thread::sleep_for(std::chrono::milliseconds(500));
+            try {
+                buf = com->receive();
+                buf.erase(std::remove(buf.begin(), buf.end(), '\n'), buf.end());
+                buf.erase(std::remove(buf.begin(), buf.end(), '\r'), buf.end());
+                std::cout << buf;
+            } catch (const std::runtime_error& e) { /* Nothing connected here */
+            }
+            std::cout << std::endl;
+        }
 #ifdef LINUXGPIB
-  }
+    }
 #endif
 
-  return 0;
+    return 0;
 }
diff --git a/src/tools/listSupportedPS.cpp b/src/tools/listSupportedPS.cpp
index 50790219..e71b2769 100644
--- a/src/tools/listSupportedPS.cpp
+++ b/src/tools/listSupportedPS.cpp
@@ -1,58 +1,64 @@
 #include <stdlib.h>
-#include <unistd.h>
 #include <sys/types.h>
+#include <unistd.h>
 
-#include <iostream>
 #include <iomanip>
+#include <iostream>
 #include <string>
 #include <vector>
 
-#include "Logger.h"
 #include "EquipConf.h"
 #include "IPowerSupply.h"
+#include "Logger.h"
 #include "PowerSupplyRegistry.h"
 
 loglevel_e loglevel = logINFO;
 
-int main()
-{
-  // get list of registered classes
-  std::vector<std::string> PSlist = EquipRegistry::listPowerSupply();
+int main() {
+    // get list of registered classes
+    std::vector<std::string> PSlist = EquipRegistry::listPowerSupply();
+
+    EquipConf hw;
 
-  EquipConf hw;
+    std::shared_ptr<PowerSupplyChannel> PS;
 
-  std::shared_ptr<PowerSupplyChannel> PS;
-  
-  int classLength = 20;
-  int modelLength = 40;
-  std::cout << "| Class" << std::setfill(' ') << std::setw(classLength-6) <<"|" << " Models"<< std::setw(modelLength-7) << "|"<<std::endl;
-  std::cout << "|" << std::setfill('-') << std::setw(classLength) << "|" <<std::setfill('-') << std::setw(modelLength) <<"|"<<std::endl;
+    int classLength = 20;
+    int modelLength = 40;
+    std::cout << "| Class" << std::setfill(' ') << std::setw(classLength - 6)
+              << "|"
+              << " Models" << std::setw(modelLength - 7) << "|" << std::endl;
+    std::cout << "|" << std::setfill('-') << std::setw(classLength) << "|"
+              << std::setfill('-') << std::setw(modelLength) << "|"
+              << std::endl;
 
-  int l;
+    int l;
 
-  for (int i = 0; i < PSlist.size(); i++) {
-    l = 0; 
+    for (int i = 0; i < PSlist.size(); i++) {
+        l = 0;
 
-    std::cout << "| " << PSlist.at(i) << std::setfill(' ') << std::setw(classLength-PSlist.at(i).size()-1)<<  "|";
-    const std::string name = PSlist.at(i);
+        std::cout << "| " << PSlist.at(i) << std::setfill(' ')
+                  << std::setw(classLength - PSlist.at(i).size() - 1) << "|";
+        const std::string name = PSlist.at(i);
 
-    // create instance of IPowerSupply   
-    std::shared_ptr<IPowerSupply> ps = EquipRegistry::createPowerSupply(name, name);
+        // create instance of IPowerSupply
+        std::shared_ptr<IPowerSupply> ps =
+            EquipRegistry::createPowerSupply(name, name);
 
-    // get list of models   
-    std::vector<std::string> models = ps->getListOfModels();
-    
-    if (models.empty()){
-      std::cout << " N.A" << std::setfill(' ') << std::setw(modelLength-4)<<  "|" << std::endl;
+        // get list of models
+        std::vector<std::string> models = ps->getListOfModels();
+
+        if (models.empty()) {
+            std::cout << " N.A" << std::setfill(' ')
+                      << std::setw(modelLength - 4) << "|" << std::endl;
+        } else {
+            for (int j = 0; j < models.size(); j++) {
+                std::cout << " " << models.at(j);
+                l = l + models.at(j).size() + 1;
+            }
+            std::cout << std::setfill(' ') << std::setw(modelLength - l) << "|"
+                      << std::endl;
+        }
     }
-    else{
-      for (int j = 0; j < models.size(); j++) {
-	std::cout << " " <<  models.at(j);
-	l = l + models.at(j).size()+1;
-      }
-      std::cout << std::setfill(' ') << std::setw(modelLength-l) << "|" << std::endl;
-     }
-  }
-
-  return 0;
+
+    return 0;
 }
diff --git a/src/tools/powersupply.cpp b/src/tools/powersupply.cpp
index f95d0fc1..5cae9a09 100644
--- a/src/tools/powersupply.cpp
+++ b/src/tools/powersupply.cpp
@@ -1,23 +1,21 @@
 #include <getopt.h>
 #include <pwd.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <sys/types.h>
+#include <unistd.h>
 
+#include <algorithm>
 #include <iostream>
+#include <memory>
+#include <nlohmann/json.hpp>
 #include <string>
 #include <vector>
-#include <algorithm>
-#include <memory>
 
-#include "Logger.h"
 #include "EquipConf.h"
 #include "IPowerSupply.h"
-
-#include <nlohmann/json.hpp>
+#include "Logger.h"
 using json = nlohmann::json;
 
-
 //------ SETTINGS
 std::string name("PS");
 int channel = 1;
@@ -25,257 +23,241 @@ std::string channelName;
 std::string configFile;
 //---------------
 
-
-void usage(char *argv[])
-{
-  std::cerr << "Usage: " << argv[0] << " [options] command [parameters]" << std::endl;
-  std::cerr << "List of possible COMMAND:" << std::endl;
-  std::cerr << "  set-current -- I [V] Set current I [A] with maximum voltage V [V]" << std::endl;
-  std::cerr << "  get-current          Get set current level [A]" << std::endl;
-  std::cerr << "  meas-current         Get reading of current [A]" << std::endl;
-  std::cerr << "  set-voltage -- V [I] Set voltage V [V] with maximum current I [A]" << std::endl;
-  std::cerr << "  get-voltage          Get set voltage level [V]" << std::endl;
-  std::cerr << "  meas-voltage         Get reading of voltage [V]" << std::endl;
-  std::cerr << "  program [on]         Execute the program block and optionally turn on the power supply" << std::endl;
-  std::cerr << "  power-on [V I]       Power ON PS, optionally setting voltage to V in Volts and current to I in Ampere" << std::endl;
-  std::cerr << "  power-off            Power OFF PS" << std::endl;
-  std::cerr << std::endl;
-  std::cerr << "List of options:" << std::endl;
-  std::cerr << " -n, --name PS     Name of the power supply from equipment list (default: " << name << ")" << std::endl;  
-  std::cerr << " -c, --channel Ch  Set PS channel (name or number when used in conjunction with --name) to control (default: " << channel << ")" << std::endl;
-  std::cerr << " -e, --equip       config.json Configuration file with the power supply definition (default: " << configFile << ")" << std::endl;
-  std::cerr << " -d, --debug       Enable more verbose printout, use multiple for increased debug level"  << std::endl;
-  std::cerr << " -h, --help        List the commands and options available"  << std::endl;
-  std::cerr << std::endl;
-  std::cerr << std::endl;
+void usage(char* argv[]) {
+    std::cerr << "Usage: " << argv[0] << " [options] command [parameters]"
+              << std::endl;
+    std::cerr << "List of possible COMMAND:" << std::endl;
+    std::cerr
+        << "  set-current -- I [V] Set current I [A] with maximum voltage V [V]"
+        << std::endl;
+    std::cerr << "  get-current          Get set current level [A]"
+              << std::endl;
+    std::cerr << "  meas-current         Get reading of current [A]"
+              << std::endl;
+    std::cerr
+        << "  set-voltage -- V [I] Set voltage V [V] with maximum current I [A]"
+        << std::endl;
+    std::cerr << "  get-voltage          Get set voltage level [V]"
+              << std::endl;
+    std::cerr << "  meas-voltage         Get reading of voltage [V]"
+              << std::endl;
+    std::cerr << "  program [on]         Execute the program block and "
+                 "optionally turn on the power supply"
+              << std::endl;
+    std::cerr << "  power-on [V I]       Power ON PS, optionally setting "
+                 "voltage to V in Volts and current to I in Ampere"
+              << std::endl;
+    std::cerr << "  power-off            Power OFF PS" << std::endl;
+    std::cerr << std::endl;
+    std::cerr << "List of options:" << std::endl;
+    std::cerr << " -n, --name PS     Name of the power supply from equipment "
+                 "list (default: "
+              << name << ")" << std::endl;
+    std::cerr << " -c, --channel Ch  Set PS channel (name or number when used "
+                 "in conjunction with --name) to control (default: "
+              << channel << ")" << std::endl;
+    std::cerr << " -e, --equip       config.json Configuration file with the "
+                 "power supply definition (default: "
+              << configFile << ")" << std::endl;
+    std::cerr << " -d, --debug       Enable more verbose printout, use "
+                 "multiple for increased debug level"
+              << std::endl;
+    std::cerr << " -h, --help        List the commands and options available"
+              << std::endl;
+    std::cerr << std::endl;
+    std::cerr << std::endl;
 }
 
-int main(int argc, char*argv[])
-{
-  // get default hardware config file from ~/.labRemote
-  std::string homedir;
-  if (getenv("HOME")==NULL)
-    homedir = getpwuid(getuid())->pw_dir;
-  else
-    homedir = getenv("HOME");
+int main(int argc, char* argv[]) {
+    // get default hardware config file from ~/.labRemote
+    std::string homedir;
+    if (getenv("HOME") == NULL) {
+        homedir = getpwuid(getuid())->pw_dir;
+    } else {
+        homedir = getenv("HOME");
+    }
 
-  if( access( (homedir+"/.labRemote/hardware.json").c_str(), F_OK ) != -1 )
-    configFile=homedir+"/.labRemote/hardware.json";
+    if (access((homedir + "/.labRemote/hardware.json").c_str(), F_OK) != -1)
+        configFile = homedir + "/.labRemote/hardware.json";
 
-  //
-  //Parse command-line  
-  if (argc < 1)
-    {
-      usage(argv);
-      return 1;
+    //
+    // Parse command-line
+    if (argc < 1) {
+        usage(argv);
+        return 1;
     }
 
-  int c;
-  while (1) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"name",     required_argument, 0,  'n' },
-      {"channel",  required_argument, 0,  'c' },
-      {"equip",    required_argument, 0,  'e' },
-      {"debug",    no_argument      , 0,  'd' },
-      {"help",     no_argument      , 0,  'h' },
-      {0,          0,                 0,  0 }
-    };
-    
-    c = getopt_long(argc, argv, "n:c:p:e:dh", long_options, &option_index);
-    if (c == -1)
-      break;
+    int c;
+    while (1) {
+        int option_index = 0;
+        static struct option long_options[] = {
+            {"name", required_argument, 0, 'n'},
+            {"channel", required_argument, 0, 'c'},
+            {"equip", required_argument, 0, 'e'},
+            {"debug", no_argument, 0, 'd'},
+            {"help", no_argument, 0, 'h'},
+            {0, 0, 0, 0}};
 
-    switch (c)
-      {
-      case 'n':
-	name = optarg;
-	break;
-      case 'c':
-	try
-	  {
-	    channel    = std::stoi(optarg);
-	  }
-	catch(const std::invalid_argument& e)
-	  {
-	    channelName= optarg;
-	  }
-	break;
-      case 'e':
-	configFile = optarg;
-	break;
-      case 'd':
-	logIt::incrDebug();
-	break;
-      case 'h':
-	usage(argv);
-	return 1;
-      default:
-	std::cerr << "Invalid option '" << c << "' supplied. Aborting." << std::endl;
-	std::cerr << std::endl;
-	usage(argv);
-	return 1;
-      }
-  }
+        c = getopt_long(argc, argv, "n:c:p:e:dh", long_options, &option_index);
+        if (c == -1) break;
 
-  std::string command;
-  std::vector<std::string> params;
-  if (optind < argc)
-    {
-      command = argv[optind++];
-      std::transform(command.begin(), command.end(), command.begin(), ::tolower);
-      while (optind < argc)
-	{
-	  std::string p(argv[optind++]);
-	  std::transform(p.begin(), p.end(), p.begin(), ::tolower);
-	  params.push_back(p);
-	}
-    }
-  else
-    {
-      std::cerr << "Required command argument missing." << std::endl;
-      std::cerr << std::endl;
-      usage(argv);
-      return 1;
+        switch (c) {
+            case 'n':
+                name = optarg;
+                break;
+            case 'c':
+                try {
+                    channel = std::stoi(optarg);
+                } catch (const std::invalid_argument& e) {
+                    channelName = optarg;
+                }
+                break;
+            case 'e':
+                configFile = optarg;
+                break;
+            case 'd':
+                logIt::incrDebug();
+                break;
+            case 'h':
+                usage(argv);
+                return 1;
+            default:
+                std::cerr << "Invalid option '" << c << "' supplied. Aborting."
+                          << std::endl;
+                std::cerr << std::endl;
+                usage(argv);
+                return 1;
+        }
     }
 
-  //check if config file is provided, if not create JSON config
-  EquipConf hw;
-  if (configFile.empty())
-    {
-      logger(logERROR) << "No input config file, either create default or use --equip.";
-      return 1;
-    }
-  else
-    {
-      hw.setHardwareConfig(configFile);
+    std::string command;
+    std::vector<std::string> params;
+    if (optind < argc) {
+        command = argv[optind++];
+        std::transform(command.begin(), command.end(), command.begin(),
+                       ::tolower);
+        while (optind < argc) {
+            std::string p(argv[optind++]);
+            std::transform(p.begin(), p.end(), p.begin(), ::tolower);
+            params.push_back(p);
+        }
+    } else {
+        std::cerr << "Required command argument missing." << std::endl;
+        std::cerr << std::endl;
+        usage(argv);
+        return 1;
     }
 
-  logger(logDEBUG) << "Configuring power-supply.";
-  std::shared_ptr<PowerSupplyChannel> PS;
-  if(channelName.empty())
-    {
-      std::shared_ptr<IPowerSupply> PSreal = hw.getPowerSupply(name);
-      PS = std::make_shared<PowerSupplyChannel>(name+std::to_string(channel), PSreal, channel);
+    // check if config file is provided, if not create JSON config
+    EquipConf hw;
+    if (configFile.empty()) {
+        logger(logERROR)
+            << "No input config file, either create default or use --equip.";
+        return 1;
+    } else {
+        hw.setHardwareConfig(configFile);
     }
-  else
-    {
-      PS = hw.getPowerSupplyChannel(channelName);
+
+    logger(logDEBUG) << "Configuring power-supply.";
+    std::shared_ptr<PowerSupplyChannel> PS;
+    if (channelName.empty()) {
+        std::shared_ptr<IPowerSupply> PSreal = hw.getPowerSupply(name);
+        PS = std::make_shared<PowerSupplyChannel>(
+            name + std::to_string(channel), PSreal, channel);
+    } else {
+        PS = hw.getPowerSupplyChannel(channelName);
     }
 
-  logger(logDEBUG) << "Settings:";
-  logger(logDEBUG) << " PS channel: " << channel;
-  
-  //Now interpret command
-  logger(logDEBUG) << "Sending commend to power-supply.";
+    logger(logDEBUG) << "Settings:";
+    logger(logDEBUG) << " PS channel: " << channel;
 
-  if (command == "set-current")
-    {
-      if (params.size() != 1 && params.size() != 2)
-	{
-	  logger(logERROR) << "Invalid number of parameters to set-current command.";
-	  logger(logERROR) << "";
-	  usage(argv);
-	  return 1;
-	}
-      logger(logDEBUG) << "Set current to "<< params[0];
-      PS->setCurrentLevel(std::stod(params[0]));
-      if(params.size()>=2)
-	{
-	  logger(logDEBUG) << "Set maximum voltage to "<< params[1];
-	  PS->setVoltageProtect(std::stod(params[1]));
-	}
-    }  
-  else if (command == "get-current")
-    {
-      if (logIt::loglevel >= logDEBUG) std::cout << "Current: ";
-      std::cout << PS->getCurrentLevel();
-      if (logIt::loglevel >= logDEBUG) std::cout << " A";
-      std::cout << std::endl;
-    }
-  else if (command == "meas-current")
-    {
-      if (logIt::loglevel >= logDEBUG) std::cout << "Current: ";
-      std::cout << PS->measureCurrent();
-      if (logIt::loglevel >= logDEBUG) std::cout << " A";
-      std::cout << std::endl;
-    }
-  else if (command == "set-voltage")
-    {
-      if (params.size() != 1 && params.size() != 2)
-	{
-	  logger(logERROR) << "Invalid number of parameters to set-voltage command.";
-	  logger(logERROR) << "";
-	  usage(argv);
-	  return 1;
-	}
-      logger(logDEBUG) << "Set voltage to "<< params[0];
-      PS->setVoltageLevel(std::stod(params[0]));
-      if(params.size()>=2)
-	{
-	  logger(logDEBUG) << "Set maximum current to "<< params[1];
-	  PS->setCurrentProtect(std::stod(params[1]));
-	}
-    }
-  else if (command == "get-voltage")
-    {
-      if (logIt::loglevel >= logDEBUG) std::cout << "Voltage: ";    
-      std::cout << PS->getVoltageLevel();
-      if (logIt::loglevel >= logDEBUG) std::cout << " V";
-      std::cout << std::endl;
-    }
-  else if (command == "meas-voltage")
-    {
-      if (logIt::loglevel >= logDEBUG) std::cout << "Voltage: ";    
-      std::cout << PS->measureVoltage();
-      if (logIt::loglevel >= logDEBUG) std::cout << " V";
-      std::cout << std::endl;
-    }
-  else if (command == "program")
-    {
-      logger(logDEBUG) << "Programming power-supply.";
-      PS->program();
-      if (params.size() > 0)
-	{ // set both voltage and current
-	  if (params.size() != 1 || params[0]!="on")
-	    {
-	      logger(logERROR) << "Invalid number of parameters to program command.";
-	      logger(logERROR) << "";
-	      usage(argv);
-	      return 1;
-	    }
-	  logger(logDEBUG) << "Powering ON.";
-	  PS->turnOn();
-	}
-    }  
-  else if (command == "power-on")
-    {
-      logger(logDEBUG) << "Initializing power-supply.";
-      if (params.size() > 0)
-	{ // set both voltage and current
-	  if (params.size() != 2)
-	    {
-	      logger(logERROR) << "Invalid number of parameters to power-on command.";
-	      logger(logERROR) << "";
-	      usage(argv);
-	      return 1;
-	    }
-	  PS->setVoltageLevel  (std::stod(params[0]));
-	  PS->setCurrentProtect(std::stod(params[1]));
-	}
-      logger(logDEBUG) << "Powering ON.";
-      PS->turnOn();
-    }
-  else if (command == "power-off")
-    {
-      logger(logDEBUG) << "Powering OFF.";
-      PS->turnOff();
-    }  
-  else
-    {
-      usage(argv);
+    // Now interpret command
+    logger(logDEBUG) << "Sending commend to power-supply.";
+
+    if (command == "set-current") {
+        if (params.size() != 1 && params.size() != 2) {
+            logger(logERROR)
+                << "Invalid number of parameters to set-current command.";
+            logger(logERROR) << "";
+            usage(argv);
+            return 1;
+        }
+        logger(logDEBUG) << "Set current to " << params[0];
+        PS->setCurrentLevel(std::stod(params[0]));
+        if (params.size() >= 2) {
+            logger(logDEBUG) << "Set maximum voltage to " << params[1];
+            PS->setVoltageProtect(std::stod(params[1]));
+        }
+    } else if (command == "get-current") {
+        if (logIt::loglevel >= logDEBUG) std::cout << "Current: ";
+        std::cout << PS->getCurrentLevel();
+        if (logIt::loglevel >= logDEBUG) std::cout << " A";
+        std::cout << std::endl;
+    } else if (command == "meas-current") {
+        if (logIt::loglevel >= logDEBUG) std::cout << "Current: ";
+        std::cout << PS->measureCurrent();
+        if (logIt::loglevel >= logDEBUG) std::cout << " A";
+        std::cout << std::endl;
+    } else if (command == "set-voltage") {
+        if (params.size() != 1 && params.size() != 2) {
+            logger(logERROR)
+                << "Invalid number of parameters to set-voltage command.";
+            logger(logERROR) << "";
+            usage(argv);
+            return 1;
+        }
+        logger(logDEBUG) << "Set voltage to " << params[0];
+        PS->setVoltageLevel(std::stod(params[0]));
+        if (params.size() >= 2) {
+            logger(logDEBUG) << "Set maximum current to " << params[1];
+            PS->setCurrentProtect(std::stod(params[1]));
+        }
+    } else if (command == "get-voltage") {
+        if (logIt::loglevel >= logDEBUG) std::cout << "Voltage: ";
+        std::cout << PS->getVoltageLevel();
+        if (logIt::loglevel >= logDEBUG) std::cout << " V";
+        std::cout << std::endl;
+    } else if (command == "meas-voltage") {
+        if (logIt::loglevel >= logDEBUG) std::cout << "Voltage: ";
+        std::cout << PS->measureVoltage();
+        if (logIt::loglevel >= logDEBUG) std::cout << " V";
+        std::cout << std::endl;
+    } else if (command == "program") {
+        logger(logDEBUG) << "Programming power-supply.";
+        PS->program();
+        if (params.size() > 0) {  // set both voltage and current
+            if (params.size() != 1 || params[0] != "on") {
+                logger(logERROR)
+                    << "Invalid number of parameters to program command.";
+                logger(logERROR) << "";
+                usage(argv);
+                return 1;
+            }
+            logger(logDEBUG) << "Powering ON.";
+            PS->turnOn();
+        }
+    } else if (command == "power-on") {
+        logger(logDEBUG) << "Initializing power-supply.";
+        if (params.size() > 0) {  // set both voltage and current
+            if (params.size() != 2) {
+                logger(logERROR)
+                    << "Invalid number of parameters to power-on command.";
+                logger(logERROR) << "";
+                usage(argv);
+                return 1;
+            }
+            PS->setVoltageLevel(std::stod(params[0]));
+            PS->setCurrentProtect(std::stod(params[1]));
+        }
+        logger(logDEBUG) << "Powering ON.";
+        PS->turnOn();
+    } else if (command == "power-off") {
+        logger(logDEBUG) << "Powering OFF.";
+        PS->turnOff();
+    } else {
+        usage(argv);
     }
 
-  logger(logDEBUG) << "All done.";
-  return 0;
+    logger(logDEBUG) << "All done.";
+    return 0;
 }
diff --git a/src/tools/ps_monitor.cpp b/src/tools/ps_monitor.cpp
index 484339fa..b2b0a0ac 100644
--- a/src/tools/ps_monitor.cpp
+++ b/src/tools/ps_monitor.cpp
@@ -1,18 +1,18 @@
-#include <unistd.h>
-#include <stdlib.h>
 #include <getopt.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+
 #include <iostream>
 #include <memory>
 #include <string>
 #include <thread>
 
-#include <signal.h>
-
-#include "Logger.h"
-#include "EquipConf.h"
 #include "DataSinkConf.h"
-#include "PowerSupplyChannel.h"
+#include "EquipConf.h"
 #include "IDataSink.h"
+#include "Logger.h"
+#include "PowerSupplyChannel.h"
 
 //------ SETTINGS
 uint32_t tsleep = 10;
@@ -21,104 +21,101 @@ std::string channelName;
 std::string streamName;
 //---------------
 
-bool quit=false;
-void cleanup(int signum)
-{ quit=true; }
-
-void usage(char *argv[])
-{
-  std::cerr << "Usage: " << argv[0] << " configfile.json datastreamName channelname" << std::endl;
-  std::cerr << "" << std::endl;
-  std::cerr << "List of options:" << std::endl;
-  std::cerr << " -t, --time        Milliseconds between measurements (default: " << tsleep << ")" << std::endl;
-  std::cerr << " -d, --debug       Enable more verbose printout, use multiple for increased debug level" << std::endl;
-  std::cerr << "" << std::endl;
-  std::cerr << "" << std::endl;
+bool quit = false;
+void cleanup(int signum) { quit = true; }
+
+void usage(char *argv[]) {
+    std::cerr << "Usage: " << argv[0]
+              << " configfile.json datastreamName channelname" << std::endl;
+    std::cerr << "" << std::endl;
+    std::cerr << "List of options:" << std::endl;
+    std::cerr
+        << " -t, --time        Milliseconds between measurements (default: "
+        << tsleep << ")" << std::endl;
+    std::cerr << " -d, --debug       Enable more verbose printout, use "
+                 "multiple for increased debug level"
+              << std::endl;
+    std::cerr << "" << std::endl;
+    std::cerr << "" << std::endl;
 }
 
-int main(int argc, char*argv[])
-{
+int main(int argc, char *argv[]) {
+    if (argc < 1) {
+        usage(argv);
+        return 1;
+    }
 
-  if (argc < 1)
-    {
-      usage(argv);
-      return 1;
+    // Parse command-line
+    int c;
+    while (1) {
+        int option_index = 0;
+        static struct option long_options[] = {{"time", no_argument, 0, 't'},
+                                               {"debug", no_argument, 0, 'd'},
+                                               {0, 0, 0, 0}};
+
+        c = getopt_long(argc, argv, "t:d", long_options, &option_index);
+        if (c == -1) break;
+
+        switch (c) {
+            case 't':
+                tsleep = std::atoi(optarg);
+                break;
+            case 'd':
+                logIt::incrDebug();
+                break;
+            default:
+                std::cerr << "Invalid option '" << c << "' supplied. Aborting."
+                          << std::endl;
+                std::cerr << std::endl;
+                usage(argv);
+                return 1;
+        }
     }
 
-  //Parse command-line
-  int c;
-  while (1) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"time" ,    no_argument      , 0,  't' },
-      {"debug",    no_argument      , 0,  'd' },
-      {0,          0,                 0,  0 }
-    };
-    
-    c = getopt_long(argc, argv, "t:d", long_options, &option_index);
-    if (c == -1)
-      break;
-
-    switch (c)
-      {
-      case 't':
-	tsleep = std::atoi(optarg);
-	break;
-      case 'd':
-	logIt::incrDebug();
-	break;
-      default:
-	std::cerr << "Invalid option '" << c << "' supplied. Aborting." << std::endl;
-	std::cerr << std::endl;
-	usage(argv);
-	return 1;
-      }
-  }
-
-  if(optind>argc-3)
-    {
-      logger(logERROR) << "Missing positional arguments.";
-      usage(argv);
-      return 1;
+    if (optind > argc - 3) {
+        logger(logERROR) << "Missing positional arguments.";
+        usage(argv);
+        return 1;
     }
 
-  configFile =argv[optind++];
-  streamName = argv[optind++];
-  channelName=argv[optind++];
-
-  logger(logDEBUG) << "Settings:";
-  logger(logDEBUG) << " Config file: " << configFile;
-  logger(logDEBUG) << " stream name: " << streamName;
-  logger(logDEBUG) << " PS channel: " << channelName;
-
-  // Register interrupt for cleanup
-  signal(SIGINT, cleanup);
-
-  // Create sink
-  DataSinkConf ds;
-  ds.setHardwareConfig(configFile);
-  std::shared_ptr<IDataSink> stream = ds.getDataStream(streamName);
-
-  stream->setTag("Channel", channelName);
-
-  //
-  // Create hardware database
-  EquipConf hw;
-  hw.setHardwareConfig(configFile);
-
-  logger(logDEBUG) << "Configuring power-supply.";
-  std::shared_ptr<PowerSupplyChannel> PS = hw.getPowerSupplyChannel(channelName);
-
-  stream->setTag("Channel", channelName);
-  while(!quit)
-    {
-      stream->startMeasurement("powersupply", std::chrono::system_clock::now());
-      stream->setField("Voltage", PS->measureVoltage());
-      stream->setField("Current", PS->measureCurrent());
-      stream->recordPoint();
-      stream->endMeasurement();
-      std::this_thread::sleep_for(std::chrono::milliseconds(tsleep));
+    configFile = argv[optind++];
+    streamName = argv[optind++];
+    channelName = argv[optind++];
+
+    logger(logDEBUG) << "Settings:";
+    logger(logDEBUG) << " Config file: " << configFile;
+    logger(logDEBUG) << " stream name: " << streamName;
+    logger(logDEBUG) << " PS channel: " << channelName;
+
+    // Register interrupt for cleanup
+    signal(SIGINT, cleanup);
+
+    // Create sink
+    DataSinkConf ds;
+    ds.setHardwareConfig(configFile);
+    std::shared_ptr<IDataSink> stream = ds.getDataStream(streamName);
+
+    stream->setTag("Channel", channelName);
+
+    //
+    // Create hardware database
+    EquipConf hw;
+    hw.setHardwareConfig(configFile);
+
+    logger(logDEBUG) << "Configuring power-supply.";
+    std::shared_ptr<PowerSupplyChannel> PS =
+        hw.getPowerSupplyChannel(channelName);
+
+    stream->setTag("Channel", channelName);
+    while (!quit) {
+        stream->startMeasurement("powersupply",
+                                 std::chrono::system_clock::now());
+        stream->setField("Voltage", PS->measureVoltage());
+        stream->setField("Current", PS->measureCurrent());
+        stream->recordPoint();
+        stream->endMeasurement();
+        std::this_thread::sleep_for(std::chrono::milliseconds(tsleep));
     }
 
-  return 0;
+    return 0;
 }
-- 
GitLab


From 9db100fbb60069ee03969d9098534f461dfdabb7 Mon Sep 17 00:00:00 2001
From: Daniel Joseph Antrim <daniel.joseph.antrim@cern.ch>
Date: Tue, 1 Dec 2020 11:06:06 -0800
Subject: [PATCH 05/13] fix some typos

---
 src/examples/chiller_example.cpp | 6 +++---
 src/examples/ntc_example.cpp     | 2 +-
 src/libDevCom/HIH4000.cpp        | 2 +-
 src/libDevCom/PtSensor.cpp       | 2 +-
 src/libLoad/Bk85xx.cpp           | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/examples/chiller_example.cpp b/src/examples/chiller_example.cpp
index 33c7af3d..742d23a6 100644
--- a/src/examples/chiller_example.cpp
+++ b/src/examples/chiller_example.cpp
@@ -9,6 +9,7 @@
 #include "Logger.h"
 #include "PolySciLM.h"
 
+
 void usage(char* argv[]) {
     std::cerr << "" << std::endl;
     std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
@@ -20,8 +21,7 @@ void usage(char* argv[]) {
                  "(default: 9600)"
               << std::endl;
     std::cerr << " -t, --temperature T Set the target temperature of the "
-                 "chiller (default: "
-              << target_temp << ")" << std::endl;
+                 "chiller" << std::endl;
     std::cerr << " -d, --debug         Enable more verbose printout, use "
                  "multiple for increased debug level"
               << std::endl;
@@ -37,9 +37,9 @@ int main(int argc, char* argv[]) {
     }
 
     // inputs
-    float target_temp = 15; // Celsius
     std::string device = "";
     speed_t baud = B9600;
+    float target_temp = 20; // something safe
 
     int c;
     while (true) {
diff --git a/src/examples/ntc_example.cpp b/src/examples/ntc_example.cpp
index f126745b..f3007fb4 100644
--- a/src/examples/ntc_example.cpp
+++ b/src/examples/ntc_example.cpp
@@ -125,7 +125,7 @@ int main(int argc, char* argv[]) {
     }
 
     logger(logDEBUG) << "Device port: " << device;
-    logger(logDEBUG) << "Pin: " << static_cast<int>(pin;)
+    logger(logDEBUG) << "Pin: " << static_cast<int>(pin);
 
     std::shared_ptr<TextSerialCom> com =
         std::make_shared<TextSerialCom>(device, B9600);
diff --git a/src/libDevCom/HIH4000.cpp b/src/libDevCom/HIH4000.cpp
index 2791b87c..efb85253 100644
--- a/src/libDevCom/HIH4000.cpp
+++ b/src/libDevCom/HIH4000.cpp
@@ -20,7 +20,7 @@ void HIH4000::read() {
     m_humidity = 0.;
     const uint navg = 5;
     for (uint i = 0; i < navg; i++)
-        m_humidity += static_cast<float>(m_adcdev)->read(m_chan);
+        m_humidity += static_cast<float>(m_adcdev->read(m_chan));
     m_humidity /= static_cast<float>(navg);
     // temperature correction
     m_humidity =
diff --git a/src/libDevCom/PtSensor.cpp b/src/libDevCom/PtSensor.cpp
index 361a892c..b086609e 100644
--- a/src/libDevCom/PtSensor.cpp
+++ b/src/libDevCom/PtSensor.cpp
@@ -22,7 +22,7 @@ void PtSensor::reset() {}
 void PtSensor::read() {
     m_temperature = 0.;
     for (uint i = 0; i < 10; i++)
-        m_temperature += static_cast<float>(m_adcdev)->read(m_chan);
+        m_temperature += static_cast<float>(m_adcdev->read(m_chan));
     m_temperature /= 10;
     m_temperature = raw_to_C(m_temperature);
 }
diff --git a/src/libLoad/Bk85xx.cpp b/src/libLoad/Bk85xx.cpp
index 5eebae09..e7e173e0 100644
--- a/src/libLoad/Bk85xx.cpp
+++ b/src/libLoad/Bk85xx.cpp
@@ -25,7 +25,7 @@ void Bk85xx::send(union u_packet packet) {
 union u_packet Bk85xx::receive() {
     union u_packet answer;
     m_com->receive(
-        reinterpret_cast<char *>(answer.bytes, sizeof(answer.bytes)));
+        reinterpret_cast<char *>(answer.bytes), sizeof(answer.bytes));
     logger(logDEBUG3) << __PRETTY_FUNCTION__ << " -> Read packet! "
                       << sizeof(answer);
     for (unsigned i = 0; i < sizeof(answer); i++)
-- 
GitLab


From dafc58a76f711db04b6bfd837b58bf6c34a7037f Mon Sep 17 00:00:00 2001
From: Daniel Joseph Antrim <daniel.joseph.antrim@cern.ch>
Date: Tue, 1 Dec 2020 11:14:24 -0800
Subject: [PATCH 06/13] newline missing in help message of check_format

---
 bash/check_format.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bash/check_format.sh b/bash/check_format.sh
index c6a971f6..a7efebb3 100644
--- a/bash/check_format.sh
+++ b/bash/check_format.sh
@@ -22,7 +22,7 @@ function print_usage {
     printf " Usage: source /path/to/check_format.sh [OPTIONS]\n"
     printf "\n"
     printf " Options:\n"
-    printf "     -v|--verbose   print-out all cpplint and clang-format output"
+    printf "     -v|--verbose   print-out all cpplint and clang-format output\n"
     printf "     -a|--apply     apply the suggested format fixes in place (WARNING: overwrites existing files)\n"
     printf "     -h|--help      show this help message\n"
     printf "\n"
-- 
GitLab


From 1d5c1cc8918b2c6ecfd9ee8968e6a51ffcf1daac Mon Sep 17 00:00:00 2001
From: Daniel Joseph Antrim <daniel.joseph.antrim@cern.ch>
Date: Tue, 1 Dec 2020 11:29:07 -0800
Subject: [PATCH 07/13] fix where CI looks for Dockerfile in package-image step

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e3aec108..437cfa54 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -114,7 +114,7 @@ package_image:
   script:
     - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
     - /kaniko/executor --context $CI_PROJECT_DIR
-                       --dockerfile $CI_PROJECT_DIR/Dockerfile
+                       --dockerfile $CI_PROJECT_DIR/ci/Dockerfile
                        --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
 
 deploy:
-- 
GitLab


From 5cfd0f249d08b475816b7b0f965f378da9c4bbe5 Mon Sep 17 00:00:00 2001
From: Daniel Joseph Antrim <daniel.joseph.antrim@cern.ch>
Date: Mon, 4 Jan 2021 10:59:04 -0800
Subject: [PATCH 08/13] fix cpplint status check

---
 bash/check_format.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bash/check_format.sh b/bash/check_format.sh
index a7efebb3..b3dd59f3 100644
--- a/bash/check_format.sh
+++ b/bash/check_format.sh
@@ -61,10 +61,12 @@ function check_files {
                 cmd="cpplint ${fname}"
                 if [[ "${verbose}" == "0" ]]; then
                     $cmd 2> /dev/null
+                    cpplint_status=$?
                 else
                     $cmd
+                    cpplint_status=$?
                 fi
-                if [[ "$?" == "1" ]]; then
+                if [[ "${cpplint_status}" != "0" ]]; then
                     printf "${RED} -- check_format: FORMAT FAILURE: File ${fname} fails formatting check${RESET}\n"
                     cmd="./ci/run-clang-format.py ${fname}"
                     if [[ "${verbose}" == "0" ]]; then
-- 
GitLab


From 7c4b1a1361a59c448826d8faec2d4889314d5a33 Mon Sep 17 00:00:00 2001
From: Daniel Joseph Antrim <daniel.joseph.antrim@cern.ch>
Date: Mon, 4 Jan 2021 11:02:46 -0800
Subject: [PATCH 09/13] make check format script executable

---
 .gitlab-ci.yml       | 2 +-
 bash/check_format.sh | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 mode change 100644 => 100755 bash/check_format.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 437cfa54..2be1bd0a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,7 +29,7 @@ format_check:
       - python3 -m pip install cpplint
       - python3 -m pip install clang-format
       - echo " *** Checking format ***"
-      - source bash/check_format.sh --verbose
+      - ./bash/check_format.sh --verbose
 
 build-bare:
   extends: .base
diff --git a/bash/check_format.sh b/bash/check_format.sh
old mode 100644
new mode 100755
-- 
GitLab


From e2d9c786bb278d8b31596b77514ce1fb201881e2 Mon Sep 17 00:00:00 2001
From: Daniel Joseph Antrim <daniel.joseph.antrim@cern.ch>
Date: Thu, 28 Jan 2021 14:32:27 -0800
Subject: [PATCH 10/13] rely entirely on clang-format via run-clang-format

---
 .clang-format-ignore |  9 +++++++++
 .gitlab-ci.yml       |  6 ++----
 CPPLINT.cfg          | 20 --------------------
 3 files changed, 11 insertions(+), 24 deletions(-)
 create mode 100644 .clang-format-ignore
 delete mode 100644 CPPLINT.cfg

diff --git a/.clang-format-ignore b/.clang-format-ignore
new file mode 100644
index 00000000..8b97a7e9
--- /dev/null
+++ b/.clang-format-ignore
@@ -0,0 +1,9 @@
+# labRemote external dependencies
+./src/exts/*
+./src/libGalil/*
+./src/libZaber/*
+
+# labRemote configuration files
+./src/configs/*
+
+
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2be1bd0a..51c3d05c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,16 +20,14 @@ variables:
                      json-devel
                      libusb-devel
                      python3-devel
-    - python3 -m pip install --upgrade --no-cache-dir pip setuptools wheel
+                     clang.x86_64
 
 format_check:
     extends: .base
     stage: format_check
     script:
-      - python3 -m pip install cpplint
-      - python3 -m pip install clang-format
       - echo " *** Checking format ***"
-      - ./bash/check_format.sh --verbose
+      - ./ci/run-clang-format.py -r ./src/ ./arduino/ --extensions c,h,cpp,hpp,cxx,hxx,ino
 
 build-bare:
   extends: .base
diff --git a/CPPLINT.cfg b/CPPLINT.cfg
deleted file mode 100644
index bd0646dc..00000000
--- a/CPPLINT.cfg
+++ /dev/null
@@ -1,20 +0,0 @@
-set noparent
-linelength = 80
-filter=-legal/copyright
-filter=-build/header_guard
-filter=-build/include_what_you_use
-filter=-runtime/int
-filter=-runtime/explicit
-filter=-runtime/references
-filter=-whitespace/comments
-filter=-build/include_order
-filter=-build/include_subdir
-filter=-build/c++11
-filter=-runtime/printf
-filter=-build/namespaces
-filter=-runtime/string
-filter=-readability/todo
-filter=-whitespace/parens
-filter=-readability/braces
-filter=-whitespace/braces
-filter=-runtime/threadsafe
-- 
GitLab


From feb1e82d9fda255a3ce568001769d50c738570be Mon Sep 17 00:00:00 2001
From: Daniel Joseph Antrim <daniel.joseph.antrim@cern.ch>
Date: Thu, 28 Jan 2021 15:19:08 -0800
Subject: [PATCH 11/13] yum install clang.x86_64 leads to super old
 clang-format version, so go back to pip installing clang-format which picks
 up more recent clang-format

---
 .gitlab-ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 51c3d05c..f3201ca5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,12 +20,13 @@ variables:
                      json-devel
                      libusb-devel
                      python3-devel
-                     clang.x86_64
 
 format_check:
     extends: .base
     stage: format_check
     script:
+      - python3 -m pip install --upgrade pip wheel
+      - python3 -m pip install clang-format
       - echo " *** Checking format ***"
       - ./ci/run-clang-format.py -r ./src/ ./arduino/ --extensions c,h,cpp,hpp,cxx,hxx,ino
 
-- 
GitLab


From 67ee37b0bc3de5993b04d30211cafcafc1fb0264 Mon Sep 17 00:00:00 2001
From: Daniel Joseph Antrim <daniel.joseph.antrim@cern.ch>
Date: Thu, 28 Jan 2021 15:48:47 -0800
Subject: [PATCH 12/13] apply run-clang-format

---
 arduino/devcomuino/devcomuino.ino       | 285 +++++++++++-------------
 src/examples/chiller_example.cpp        |   6 +-
 src/examples/datasink_example.cpp       |   1 -
 src/libCom/ICom.cpp                     |   7 +-
 src/libDevCom/ComException.h            |   5 +-
 src/libDevCom/ComIOException.cpp        |   6 +-
 src/libDevCom/DeviceCalibration.cpp     |   6 +-
 src/libDevCom/DeviceCom.cpp             |   3 +-
 src/libDevCom/DummyCalibration.cpp      |   6 +-
 src/libDevCom/MuxDevice.cpp             |   3 +-
 src/libDevCom/NotSupportedException.cpp |   8 +-
 src/libDevCom/SPICom.cpp                |   6 +-
 src/libLoad/Bk85xx.cpp                  |   4 +-
 src/libPS/AgilentE36300APs.cpp          |   7 +-
 src/libPS/AgilentE3634APs.cpp           |   7 +-
 src/libPS/AgilentE364xAPs.cpp           |   7 +-
 src/libPS/Bk16XXPs.cpp                  |   6 +-
 src/libPS/RS_HMPXXXX.cpp                |   7 +-
 src/libPS/RigolDP832.cpp                |   9 +-
 src/libPS/TTIXXXDPPs.cpp                |   7 +-
 src/libPS/TTIXXXSPPs.cpp                |   7 +-
 src/libScope/PicoScope.cpp              |   6 +-
 22 files changed, 179 insertions(+), 230 deletions(-)
 mode change 100755 => 100644 src/libCom/ICom.cpp

diff --git a/arduino/devcomuino/devcomuino.ino b/arduino/devcomuino/devcomuino.ino
index e8c10dd7..5a978fae 100644
--- a/arduino/devcomuino/devcomuino.ino
+++ b/arduino/devcomuino/devcomuino.ino
@@ -1,70 +1,56 @@
 #include "Wire.h"
 
-const unsigned int MAXARGS=5;
-const unsigned int MAXBYTES=16;
-const unsigned int MAXCMDLENGTH=256;
-const unsigned int MAXARGLENGTH=16;
+const unsigned int MAXARGS = 5;
+const unsigned int MAXBYTES = 16;
+const unsigned int MAXCMDLENGTH = 256;
+const unsigned int MAXARGLENGTH = 16;
 
 // Command parsing
-size_t cmdptr=0;
+size_t cmdptr = 0;
 char command[MAXCMDLENGTH];
-unsigned int argc=0;
+unsigned int argc = 0;
 char argv[MAXARGS][MAXARGLENGTH];
 
 // Parse command execute the right function
-void runcommand()
-{
-  // Tokenize string into command and argument
-  char* tok=strtok(command," ");
-  argc=0;
-  while(tok != NULL)
-    {
-      strcpy(argv[argc++], tok);
-      tok = strtok(NULL, " ");
+void runcommand() {
+    // Tokenize string into command and argument
+    char *tok = strtok(command, " ");
+    argc = 0;
+    while (tok != NULL) {
+        strcpy(argv[argc++], tok);
+        tok = strtok(NULL, " ");
     }
 
-  // Execute the right command                                                                            
-  if(strncmp("HELP", argv[0], 4)==0)
-    { // Print help menu
-      cmdHELP();
+    // Execute the right command
+    if (strncmp("HELP", argv[0], 4) == 0) {  // Print help menu
+        cmdHELP();
     }
-    //need to check ADC functionality 
-  else if( strncmp("ADC", argv[0], 3)==0)
-    { // Read ADC
-      if(argc!=2)
-        {
-          Serial.println("ERR wrong number of arguments to ADC");
-          return;
+    // need to check ADC functionality
+    else if (strncmp("ADC", argv[0], 3) == 0) {  // Read ADC
+        if (argc != 2) {
+            Serial.println("ERR wrong number of arguments to ADC");
+            return;
         }
-      cmdADC(atoi(argv[1]));
-    }
-  else if(strncmp("I2C", argv[0], 3)==0)
-    { // I2C commands
-      if(argc<4)
-        {
-          Serial.println("ERR wrong number of arguments to I2C");
-          return;
+        cmdADC(atoi(argv[1]));
+    } else if (strncmp("I2C", argv[0], 3) == 0) {  // I2C commands
+        if (argc < 4) {
+            Serial.println("ERR wrong number of arguments to I2C");
+            return;
         }
 
-      int addr =0;
-      sscanf(argv[2], "%02x", &addr);
-      if(strncmp("WRITE",argv[1],5)==0)
-        {
-          cmdI2Cwrite(addr, argv[3]);
-        }
-      else if(strncmp("READ",argv[1],4)==0)
-        {
-          cmdI2Cread(addr,atoi(argv[3]));
-        }
-      else
-        {
-          Serial.println("ERR unknown I2C command");
+        int addr = 0;
+        sscanf(argv[2], "%02x", &addr);
+        if (strncmp("WRITE", argv[1], 5) == 0) {
+            cmdI2Cwrite(addr, argv[3]);
+        } else if (strncmp("READ", argv[1], 4) == 0) {
+            cmdI2Cread(addr, atoi(argv[3]));
+        } else {
+            Serial.println("ERR unknown I2C command");
         }
     }
-                                                                      
- else
-    {
-      Serial.println("ERR unknown command");
+
+    else {
+        Serial.println("ERR unknown command");
     }
 }
 
@@ -74,94 +60,86 @@ void runcommand()
 
 //
 // Print
-void cmdHELP()
-{
-  Serial.println("Hello World from DevComduino!");
-  Serial.println("");
-  Serial.println("Available commands:");
-  Serial.println("\tHELP - Print this help");
-  Serial.println("\tADC ch - Return ADC reading on channel ch");
-  Serial.println("\tI2C WRITE addr byte-string - Write a byte-string using I2C to addr, MSB first");
-  Serial.println("\tI2C READ addr nbytes - Read number of bytes from addr");
+void cmdHELP() {
+    Serial.println("Hello World from DevComduino!");
+    Serial.println("");
+    Serial.println("Available commands:");
+    Serial.println("\tHELP - Print this help");
+    Serial.println("\tADC ch - Return ADC reading on channel ch");
+    Serial.println(
+        "\tI2C WRITE addr byte-string - Write a byte-string using I2C to addr, "
+        "MSB first");
+    Serial.println("\tI2C READ addr nbytes - Read number of bytes from addr");
 }
 
 //
 // Read an analogue pin
 
-void cmdADC(int channel)
-{
-  float V;
-  switch(channel)
-    {
-    case 0:
-      V=analogRead(A0);
-      break;
-    case 1:
-      V=analogRead(A1);
-      break;
-    case 2:
-      V=analogRead(A2);
-      break;
-    case 3:
-      V=analogRead(A3);
-      break;
-    case 4:
-      V=analogRead(A4);
-      break;
-    case 5:
-      V=analogRead(A5);
-      break;
-    default:
-      Serial.println("ERR invalid channel");
-      break;
-  }
-
-  Serial.println(V);
+void cmdADC(int channel) {
+    float V;
+    switch (channel) {
+        case 0:
+            V = analogRead(A0);
+            break;
+        case 1:
+            V = analogRead(A1);
+            break;
+        case 2:
+            V = analogRead(A2);
+            break;
+        case 3:
+            V = analogRead(A3);
+            break;
+        case 4:
+            V = analogRead(A4);
+            break;
+        case 5:
+            V = analogRead(A5);
+            break;
+        default:
+            Serial.println("ERR invalid channel");
+            break;
+    }
+
+    Serial.println(V);
 }
 
 //
 // I2C write
-void cmdI2Cwrite(int address, char *cmd)
-{
-  Wire.beginTransmission(address);
-
-  int c =0;
-  for(int i=0; i<strlen(cmd); i+=2)
-    {
-      sscanf(&cmd[i], "%02x", &c);
-      Wire.write(c);
+void cmdI2Cwrite(int address, char *cmd) {
+    Wire.beginTransmission(address);
+
+    int c = 0;
+    for (int i = 0; i < strlen(cmd); i += 2) {
+        sscanf(&cmd[i], "%02x", &c);
+        Wire.write(c);
     }
-  Wire.endTransmission();
-  Serial.println("OK");
+    Wire.endTransmission();
+    Serial.println("OK");
 }
 
 //
 // I2C read
-void cmdI2Cread(int address, unsigned int nBytes)
-{
-  Wire.requestFrom(address,nBytes);
-
-  unsigned char c;
-  char cstr[4];
-
-  //sprintf(cstr, "%02x:", nBytes);
-  //Serial.print(cstr);
-
-  for(unsigned int i=0;i<nBytes;i++)
-    {
-      if(Wire.available())
-	{
-	  c=Wire.read();
-	  sprintf(cstr, "%02x", c);
-	  Serial.print(cstr);
-	  //Serial.print(strlen(cstr));
-	}
-      else
-	{
-	  Serial.print("ERR");
-	}
+void cmdI2Cread(int address, unsigned int nBytes) {
+    Wire.requestFrom(address, nBytes);
+
+    unsigned char c;
+    char cstr[4];
+
+    // sprintf(cstr, "%02x:", nBytes);
+    // Serial.print(cstr);
+
+    for (unsigned int i = 0; i < nBytes; i++) {
+        if (Wire.available()) {
+            c = Wire.read();
+            sprintf(cstr, "%02x", c);
+            Serial.print(cstr);
+            // Serial.print(strlen(cstr));
+        } else {
+            Serial.print("ERR");
+        }
     }
-  Serial.println();
+    Serial.println();
 }
 
 //
@@ -170,40 +148,41 @@ void cmdI2Cread(int address, unsigned int nBytes)
 
 //
 // Setup serial
-void setup()
-{
-  Serial.begin(9600);
-  Wire.begin();
+void setup() {
+    Serial.begin(9600);
+    Wire.begin();
 }
 
 //
 // The main loop looks for commands
-void loop()
-{
-  if(Serial.available()==0)
-    return;
-
-  // Read new data
-  size_t length=Serial.readBytes(&command[cmdptr], min(Serial.available(), MAXCMDLENGTH-cmdptr));
-  if(length==0) return; // No new data...
-  cmdptr+=length;
-
-  // Check if command finished (new line)
-  if (cmdptr < 2) return;
-  if (command[cmdptr-2]!='\r' && command[cmdptr-1]!='\n') {
-    if (cmdptr >= MAXCMDLENGTH-1) {
-      //overflow command. Clean-up buffer to avoid stalled program
-      cmdptr=0;
-      Serial.print("ERR Command too long");
+void loop() {
+    if (Serial.available() == 0) return;
+
+    // Read new data
+    size_t length = Serial.readBytes(
+        &command[cmdptr], min(Serial.available(), MAXCMDLENGTH - cmdptr));
+    if (length == 0) return;  // No new data...
+    cmdptr += length;
+
+    // Check if command finished (new line)
+    if (cmdptr < 2) return;
+    if (command[cmdptr - 2] != '\r' && command[cmdptr - 1] != '\n') {
+        if (cmdptr >= MAXCMDLENGTH - 1) {
+            // overflow command. Clean-up buffer to avoid stalled program
+            cmdptr = 0;
+            Serial.print("ERR Command too long");
+        }
+        return;
     }
-    return;
-  }
 
-  // There is a command! Process it...
-  char *c=command; while(*c) { *c=toupper(*c); c++; }
-  command[cmdptr-2]='\0';
-
-  runcommand();
-  cmdptr=0; // Reset command
+    // There is a command! Process it...
+    char *c = command;
+    while (*c) {
+        *c = toupper(*c);
+        c++;
+    }
+    command[cmdptr - 2] = '\0';
 
+    runcommand();
+    cmdptr = 0;  // Reset command
 }
diff --git a/src/examples/chiller_example.cpp b/src/examples/chiller_example.cpp
index 742d23a6..b441d45c 100644
--- a/src/examples/chiller_example.cpp
+++ b/src/examples/chiller_example.cpp
@@ -9,7 +9,6 @@
 #include "Logger.h"
 #include "PolySciLM.h"
 
-
 void usage(char* argv[]) {
     std::cerr << "" << std::endl;
     std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
@@ -21,7 +20,8 @@ void usage(char* argv[]) {
                  "(default: 9600)"
               << std::endl;
     std::cerr << " -t, --temperature T Set the target temperature of the "
-                 "chiller" << std::endl;
+                 "chiller"
+              << std::endl;
     std::cerr << " -d, --debug         Enable more verbose printout, use "
                  "multiple for increased debug level"
               << std::endl;
@@ -39,7 +39,7 @@ int main(int argc, char* argv[]) {
     // inputs
     std::string device = "";
     speed_t baud = B9600;
-    float target_temp = 20; // something safe
+    float target_temp = 20;  // something safe
 
     int c;
     while (true) {
diff --git a/src/examples/datasink_example.cpp b/src/examples/datasink_example.cpp
index b62fa7f3..8db9eed5 100644
--- a/src/examples/datasink_example.cpp
+++ b/src/examples/datasink_example.cpp
@@ -12,7 +12,6 @@
 #include "IDataSink.h"
 #include "Logger.h"
 
-
 void usage(char *argv[]) {
     std::cerr << "Usage: " << argv[0] << " configfile.json streamName"
               << std::endl;
diff --git a/src/libCom/ICom.cpp b/src/libCom/ICom.cpp
old mode 100755
new mode 100644
index 7017cf18..187f5354
--- a/src/libCom/ICom.cpp
+++ b/src/libCom/ICom.cpp
@@ -1,8 +1,5 @@
 #include "ICom.h"
 
-ICom::ICom()
-{ }
-
-bool ICom::is_open()
-{ return m_good; }
+ICom::ICom() {}
 
+bool ICom::is_open() { return m_good; }
diff --git a/src/libDevCom/ComException.h b/src/libDevCom/ComException.h
index 03b9b7bb..b5142efb 100644
--- a/src/libDevCom/ComException.h
+++ b/src/libDevCom/ComException.h
@@ -3,7 +3,6 @@
 
 #include <exception>
 
-class ComException : public std::exception
-{ };
+class ComException : public std::exception {};
 
-#endif // COMEXCEPTION_H
+#endif  // COMEXCEPTION_H
diff --git a/src/libDevCom/ComIOException.cpp b/src/libDevCom/ComIOException.cpp
index be2c6cd5..b40f9b62 100644
--- a/src/libDevCom/ComIOException.cpp
+++ b/src/libDevCom/ComIOException.cpp
@@ -1,8 +1,6 @@
 #include "ComIOException.h"
 
 ComIOException::ComIOException(const std::string& msg)
-  : m_msg("ComIOException: "+msg)
-{ }
+    : m_msg("ComIOException: " + msg) {}
 
-const char* ComIOException::what() const throw()
-{ return m_msg.c_str(); }
+const char* ComIOException::what() const throw() { return m_msg.c_str(); }
diff --git a/src/libDevCom/DeviceCalibration.cpp b/src/libDevCom/DeviceCalibration.cpp
index ca0bbd5c..1ce93c77 100644
--- a/src/libDevCom/DeviceCalibration.cpp
+++ b/src/libDevCom/DeviceCalibration.cpp
@@ -1,7 +1,5 @@
 #include "DeviceCalibration.h"
 
-DeviceCalibration::DeviceCalibration()
-{ }
+DeviceCalibration::DeviceCalibration() {}
 
-DeviceCalibration::~DeviceCalibration()
-{ }
+DeviceCalibration::~DeviceCalibration() {}
diff --git a/src/libDevCom/DeviceCom.cpp b/src/libDevCom/DeviceCom.cpp
index 39393032..645a2e5b 100644
--- a/src/libDevCom/DeviceCom.cpp
+++ b/src/libDevCom/DeviceCom.cpp
@@ -1,4 +1,3 @@
 #include "DeviceCom.h"
 
-DeviceCom::DeviceCom()
-{ }
+DeviceCom::DeviceCom() {}
diff --git a/src/libDevCom/DummyCalibration.cpp b/src/libDevCom/DummyCalibration.cpp
index 1676a6bc..0724aea5 100644
--- a/src/libDevCom/DummyCalibration.cpp
+++ b/src/libDevCom/DummyCalibration.cpp
@@ -2,8 +2,6 @@
 
 #include <cmath>
 
-double DummyCalibration::calibrate(int32_t counts)
-{ return counts; }
+double DummyCalibration::calibrate(int32_t counts) { return counts; }
 
-int32_t DummyCalibration::uncalibrate(double value)
-{ return round(value); }
+int32_t DummyCalibration::uncalibrate(double value) { return round(value); }
diff --git a/src/libDevCom/MuxDevice.cpp b/src/libDevCom/MuxDevice.cpp
index 294ba0d1..a542385a 100644
--- a/src/libDevCom/MuxDevice.cpp
+++ b/src/libDevCom/MuxDevice.cpp
@@ -1,4 +1,3 @@
 #include "MuxDevice.h"
 
-MuxDevice::MuxDevice()
-{ }
+MuxDevice::MuxDevice() {}
diff --git a/src/libDevCom/NotSupportedException.cpp b/src/libDevCom/NotSupportedException.cpp
index 4daac268..e29eba8a 100644
--- a/src/libDevCom/NotSupportedException.cpp
+++ b/src/libDevCom/NotSupportedException.cpp
@@ -1,8 +1,8 @@
 #include "NotSupportedException.h"
 
 NotSupportedException::NotSupportedException(const std::string& msg)
-  : m_msg("NotSupportedException: "+msg)
-{ }
+    : m_msg("NotSupportedException: " + msg) {}
 
-const char* NotSupportedException::what() const throw()
-{ return m_msg.c_str(); }
+const char* NotSupportedException::what() const throw() {
+    return m_msg.c_str();
+}
diff --git a/src/libDevCom/SPICom.cpp b/src/libDevCom/SPICom.cpp
index 757f0314..403e8a39 100644
--- a/src/libDevCom/SPICom.cpp
+++ b/src/libDevCom/SPICom.cpp
@@ -1,7 +1,5 @@
 #include "SPICom.h"
 
-SPICom::SPICom()
-{ }
+SPICom::SPICom() {}
 
-SPICom::~SPICom()
-{ }
+SPICom::~SPICom() {}
diff --git a/src/libLoad/Bk85xx.cpp b/src/libLoad/Bk85xx.cpp
index e7e173e0..9917659f 100644
--- a/src/libLoad/Bk85xx.cpp
+++ b/src/libLoad/Bk85xx.cpp
@@ -24,8 +24,8 @@ void Bk85xx::send(union u_packet packet) {
 
 union u_packet Bk85xx::receive() {
     union u_packet answer;
-    m_com->receive(
-        reinterpret_cast<char *>(answer.bytes), sizeof(answer.bytes));
+    m_com->receive(reinterpret_cast<char *>(answer.bytes),
+                   sizeof(answer.bytes));
     logger(logDEBUG3) << __PRETTY_FUNCTION__ << " -> Read packet! "
                       << sizeof(answer);
     for (unsigned i = 0; i < sizeof(answer); i++)
diff --git a/src/libPS/AgilentE36300APs.cpp b/src/libPS/AgilentE36300APs.cpp
index 63386b14..a7669f46 100644
--- a/src/libPS/AgilentE36300APs.cpp
+++ b/src/libPS/AgilentE36300APs.cpp
@@ -1,9 +1,8 @@
 #include "AgilentE36300APs.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(AgilentE36300APs)
 
-AgilentE36300APs::AgilentE36300APs(const std::string& name) :
-AgilentPs(name, {"E36311A", "E36312A", "E36313A"}, 3)
-{ }
+AgilentE36300APs::AgilentE36300APs(const std::string& name)
+    : AgilentPs(name, {"E36311A", "E36312A", "E36313A"}, 3) {}
diff --git a/src/libPS/AgilentE3634APs.cpp b/src/libPS/AgilentE3634APs.cpp
index 249b5a98..0e837435 100644
--- a/src/libPS/AgilentE3634APs.cpp
+++ b/src/libPS/AgilentE3634APs.cpp
@@ -1,9 +1,8 @@
 #include "AgilentE3634APs.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(AgilentE3634APs)
 
-AgilentE3634APs::AgilentE3634APs(const std::string& name) :
-AgilentPs(name, {"E3633A", "E3634A"}, 1)
-{ }
+AgilentE3634APs::AgilentE3634APs(const std::string& name)
+    : AgilentPs(name, {"E3633A", "E3634A"}, 1) {}
diff --git a/src/libPS/AgilentE364xAPs.cpp b/src/libPS/AgilentE364xAPs.cpp
index e2632a09..6370c4c2 100644
--- a/src/libPS/AgilentE364xAPs.cpp
+++ b/src/libPS/AgilentE364xAPs.cpp
@@ -1,9 +1,8 @@
 #include "AgilentE364xAPs.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(AgilentE364xAPs)
 
-AgilentE364xAPs::AgilentE364xAPs(const std::string& name) :
-AgilentPs(name, {"E3642A", "E3644A"}, 1)
-{ }
+AgilentE364xAPs::AgilentE364xAPs(const std::string& name)
+    : AgilentPs(name, {"E3642A", "E3644A"}, 1) {}
diff --git a/src/libPS/Bk16XXPs.cpp b/src/libPS/Bk16XXPs.cpp
index 9ed37278..51265924 100644
--- a/src/libPS/Bk16XXPs.cpp
+++ b/src/libPS/Bk16XXPs.cpp
@@ -86,7 +86,7 @@ double Bk16XXPs::getCurrentProtect(unsigned channel) {
     const std::string& max_curr = ret[0];
     std::string current = max_curr.substr(0, max_curr.find("\r"));
     int curr_int = stoi(current);
-    double curr = floor(   static_cast<double>(curr_int) / 10);
+    double curr = floor(static_cast<double>(curr_int) / 10);
     return curr;
 }
 
@@ -148,7 +148,7 @@ double Bk16XXPs::getVoltageProtect(unsigned channel) {
     const std::vector<std::string>& ret = command("GOVP");
     const std::string& voltage = ret[0];
     int volt_int = stoi(voltage);
-    double volt = floor(  static_cast<double>(volt_int) / 10);
+    double volt = floor(static_cast<double>(volt_int) / 10);
     return volt;
 }
 
@@ -160,7 +160,7 @@ double Bk16XXPs::measureVoltage(unsigned channel) {
     const std::vector<std::string>& ret = command("GETD");
     const std::string& volt_curr = ret[0];
     int volt_curr_int = stoi(volt_curr);
-    double volt = floor( static_cast<double>(volt_curr_int) / 100000);
+    double volt = floor(static_cast<double>(volt_curr_int) / 100000);
     return volt / 100;
 }
 
diff --git a/src/libPS/RS_HMPXXXX.cpp b/src/libPS/RS_HMPXXXX.cpp
index b7b71bbd..0e0bfb69 100644
--- a/src/libPS/RS_HMPXXXX.cpp
+++ b/src/libPS/RS_HMPXXXX.cpp
@@ -5,11 +5,8 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(RS_HMPXXXX)
 
-RS_HMPXXXX::RS_HMPXXXX(const std::string& name) :
-SCPIPs(name, {"HMP4040"})
-{ }
-
+RS_HMPXXXX::RS_HMPXXXX(const std::string& name) : SCPIPs(name, {"HMP4040"}) {}
diff --git a/src/libPS/RigolDP832.cpp b/src/libPS/RigolDP832.cpp
index 239f965a..51b86811 100644
--- a/src/libPS/RigolDP832.cpp
+++ b/src/libPS/RigolDP832.cpp
@@ -5,13 +5,8 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(RigolDP832)
 
-
-RigolDP832::RigolDP832(const std::string& name) :
-SCPIPs(name, {"DP832"})
-{ }
-
-
+RigolDP832::RigolDP832(const std::string& name) : SCPIPs(name, {"DP832"}) {}
diff --git a/src/libPS/TTIXXXDPPs.cpp b/src/libPS/TTIXXXDPPs.cpp
index 418fcacd..2aeb6339 100644
--- a/src/libPS/TTIXXXDPPs.cpp
+++ b/src/libPS/TTIXXXDPPs.cpp
@@ -5,10 +5,9 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(TTIXXXDPPs)
 
-TTIXXXDPPs::TTIXXXDPPs(const std::string& name) :
-TTIPs(name, {"PL303QMD-P"}, 2)
-{ }
+TTIXXXDPPs::TTIXXXDPPs(const std::string& name)
+    : TTIPs(name, {"PL303QMD-P"}, 2) {}
diff --git a/src/libPS/TTIXXXSPPs.cpp b/src/libPS/TTIXXXSPPs.cpp
index d32f90b2..2ac101ad 100644
--- a/src/libPS/TTIXXXSPPs.cpp
+++ b/src/libPS/TTIXXXSPPs.cpp
@@ -5,10 +5,9 @@
 
 #include "Logger.h"
 
-//Register power supply
+// Register power supply
 #include "PowerSupplyRegistry.h"
 REGISTER_POWERSUPPLY(TTIXXXSPPs)
 
-TTIXXXSPPs::TTIXXXSPPs(const std::string& name) :
-TTIPs(name, {"TSX1820P"}, 1)
-{ }
+TTIXXXSPPs::TTIXXXSPPs(const std::string& name)
+    : TTIPs(name, {"TSX1820P"}, 1) {}
diff --git a/src/libScope/PicoScope.cpp b/src/libScope/PicoScope.cpp
index 819a70b3..fb36df8c 100644
--- a/src/libScope/PicoScope.cpp
+++ b/src/libScope/PicoScope.cpp
@@ -1,7 +1,5 @@
 #include "PicoScope.h"
 
-PicoScope::PicoScope()
-{ }
+PicoScope::PicoScope() {}
 
-PicoScope::~PicoScope()
-{ }
+PicoScope::~PicoScope() {}
-- 
GitLab


From 8fcb810ec36fc591304eb552131b189d1f8cc1c4 Mon Sep 17 00:00:00 2001
From: Daniel Joseph Antrim <daniel.joseph.antrim@cern.ch>
Date: Thu, 28 Jan 2021 16:42:35 -0800
Subject: [PATCH 13/13] remove check_format.sh

---
 bash/check_format.sh | 143 -------------------------------------------
 1 file changed, 143 deletions(-)
 delete mode 100755 bash/check_format.sh

diff --git a/bash/check_format.sh b/bash/check_format.sh
deleted file mode 100755
index b3dd59f3..00000000
--- a/bash/check_format.sh
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/bin/bash
-
-############################################################
-#
-# A script to check the formatting of the labRemote source
-# code, according to clang-format and CPPLINT rules.
-#
-# author: Daniel Joseph Antrim
-# author-email: daniel.joseph.antrim AT cern.ch
-# date: December 2020
-#
-############################################################
-
-RESET="\033[0m"
-RED="\033[1m\033[31m"
-BLUE="\033[1m\033[34m"
-YELLOW="\033[1m\033[33m"
-GREEN="\033[1m\033[32m"
-
-function print_usage {
-
-    printf " Usage: source /path/to/check_format.sh [OPTIONS]\n"
-    printf "\n"
-    printf " Options:\n"
-    printf "     -v|--verbose   print-out all cpplint and clang-format output\n"
-    printf "     -a|--apply     apply the suggested format fixes in place (WARNING: overwrites existing files)\n"
-    printf "     -h|--help      show this help message\n"
-    printf "\n"
-    printf " Notes:\n"
-    printf "      Providing the -a (--apply) command line option performs an IN-PLACE\n"
-    printf "      application of the fixes that are suggested when you run this\n"
-    printf "      script without providing any command line options. That means\n"
-    printf "      the files will be over-written. Be sure to back-up with git beforehand\n"
-    printf "      if you are worried about any issues.\n"
-}
-
-function check_files {
-
-    apply_format_fix=${1}
-    verbose=${2}
-    if [[ "${apply_format_fix}" == "1" ]]; then
-        printf "${YELLOW} -- check_format: Applying formatting fixes to files that fail formatting check!${RESET}\n"
-    fi
-
-    dirs_to_exclude="exts configs libGalil"
-
-    format_status="0"
-    extensions=".cpp .h"
-    for extension in ${extensions};
-    do
-        printf "${BLUE} -- check_format: Checking *${extension} files %s${RESET}\n"
-        for labremote_subdirectory in ./src/*; do
-            subdirectory_name=$(basename ${labremote_subdirectory})
-            if $(echo ${dirs_to_exclude} |grep -w -q ${subdirectory_name}); then
-                continue
-            fi
-            files=$(find ${labremote_subdirectory} -name *${extension})
-            for fname in ${files};
-            do    
-                printf "${BLUE} -- check_format: > file: ${fname}${RESET}\n"
-                cmd="cpplint ${fname}"
-                if [[ "${verbose}" == "0" ]]; then
-                    $cmd 2> /dev/null
-                    cpplint_status=$?
-                else
-                    $cmd
-                    cpplint_status=$?
-                fi
-                if [[ "${cpplint_status}" != "0" ]]; then
-                    printf "${RED} -- check_format: FORMAT FAILURE: File ${fname} fails formatting check${RESET}\n"
-                    cmd="./ci/run-clang-format.py ${fname}"
-                    if [[ "${verbose}" == "0" ]]; then
-                        cmd="${cmd} --quiet"
-                    fi
-                    $cmd
-                    if [[ "${apply_format_fix}" == "1" ]]; then
-                        printf "${YELLOW} -- check_format: Applying format fixes to ${fname}...${RESET}\n"
-                        clang-format -i ${fname}
-                    fi
-                    format_status="1"
-                fi
-            done # fname
-        done # labremote_subdirectory
-    done # extension
-    if [ ! ${format_status} -eq "0" ];
-    then
-        return 1
-    else
-        return 0
-    fi
-}
-
-function main {
-
-    apply_format_fix=0
-    verbose=0
-    while test $# -gt 0
-    do
-        case $1 in
-            -h)
-                print_usage
-                return 0
-                ;;
-            --help)
-                print_usage
-                return 0
-                ;;
-            -a)
-                apply_format_fix=1
-                ;;
-            --apply)
-                apply_format_fix=1
-                ;;
-            -v)
-                verbose=1
-                ;;
-            --verbose)
-                verbose=1
-                ;;
-            *)
-                printf "${RED} check_format: Invalid argument provided: $1\n ${RESET}"
-                return 1
-        esac
-        shift
-    done
-                
-    format_ok=0
-    if ! check_files ${apply_format_fix} ${verbose}; then
-        format_ok=1
-    fi
-    if [[ "${format_ok}" == "1" ]]; then
-        printf "${RED} -- check_format: RESULT: FORMATTING FAILED${RESET}\n"
-        return 1
-    else
-        printf "${GREEN} -- check_format: RESULT: FORMATTING SUCCESS${RESET}\n"
-        return 0
-    fi
-}
-
-#______________
-main $*
-
-
-- 
GitLab