From b2db7f712e3ba510853ef66aa5aa4ac9ae859f40 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 21:41:03 +0100 Subject: [PATCH 01/17] Start adding Travis Continuous Integration to the repo --- .travis-ci.sh | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .travis-ci.sh diff --git a/.travis-ci.sh b/.travis-ci.sh new file mode 100644 index 0000000..80cb733 --- /dev/null +++ b/.travis-ci.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# This script is triggered from the script section of .travis.yml +# It runs the appropriate commands depending on the task requested. + +set -e + +CPP_LINT_URL="https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py"; + +SPELLINGBLACKLIST=$(cat <<-BLACKLIST + -wholename "./.codespellignore" -or \ + -wholename "./.git/*" +BLACKLIST +) + +if [[ $TASK = 'lint' ]]; then + # run the lint tool only if it is the requested task + # first check we've not got any generic NOLINTs + # count the number of generic NOLINTs + nolints=$(grep -IR NOLINT * | grep -v "NOLINT(" | wc -l) + if [[ $nolints -ne 0 ]]; then + # print the output for info + echo $(grep -IR NOLINT * | grep -v "NOLINT(") + echo "Found $nolints generic NOLINTs" + exit 1; + else + echo "Found $nolints generic NOLINTs" + fi; + # then fetch and run the main cpplint tool + wget -O cpplint.py $CPP_LINT_URL; + chmod u+x cpplint.py; + ./cpplint.py \ + --filter=-legal/copyright,-readability/streams,-runtime/arrays \ + $(find ./ \( -name "*.h" -or -name "*.cpp" \) | xargs) + if [[ $? -ne 0 ]]; then + exit 1; + fi; +elif [[ $TASK = 'spellintian' ]]; then + # run spellintian only if it is the requested task, ignoring duplicate words + spellingfiles=$(eval "find ./ -type f -and ! \( \ + $SPELLINGBLACKLIST \ + \) | xargs") + # count the number of spellintian errors, ignoring duplicate words + spellingerrors=$(zrun spellintian $spellingfiles 2>&1 | grep -v "\(duplicate word\)" | wc -l) + if [[ $spellingerrors -ne 0 ]]; then + # print the output for info + zrun spellintian $spellingfiles | grep -v "\(duplicate word\)" + echo "Found $spellingerrors spelling errors via spellintian, ignoring duplicates" + exit 1; + else + echo "Found $spellingerrors spelling errors via spellintian, ignoring duplicates" + fi; +elif [[ $TASK = 'spellintian-duplicates' ]]; then + # run spellintian only if it is the requested task + spellingfiles=$(eval "find ./ -type f -and ! \( \ + $SPELLINGBLACKLIST \ + \) | xargs") + # count the number of spellintian errors + spellingerrors=$(zrun spellintian $spellingfiles 2>&1 | wc -l) + if [[ $spellingerrors -ne 0 ]]; then + # print the output for info + zrun spellintian $spellingfiles + echo "Found $spellingerrors spelling errors via spellintian" + exit 1; + else + echo "Found $spellingerrors spelling errors via spellintian" + fi; +elif [[ $TASK = 'codespell' ]]; then + # run codespell only if it is the requested task + spellingfiles=$(eval "find ./ -type f -and ! \( \ + $SPELLINGBLACKLIST \ + \) | xargs") + # count the number of codespell errors + spellingerrors=$(zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignore $spellingfiles 2>&1 | wc -l) + if [[ $spellingerrors -ne 0 ]]; then + # print the output for info + zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignore $spellingfiles + echo "Found $spellingerrors spelling errors via codespell" + exit 1; + else + echo "Found $spellingerrors spelling errors via codespell" + fi; +else + platformio ci --lib="." --board=$BOARD +fi From 8194d1d2654e384993c6f205ba34be53647486af Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 21:55:45 +0100 Subject: [PATCH 02/17] More work on Travis CI --- .travis.yml | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..cdc6ecb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,99 @@ +language: python +python: + - "2.7" + +os: linux +dist: trusty +# Short duration job, use the container/without sudo image as it boots faster +sudo: false +# Use the latest Travis images since they are more up to date than the stable release. +group: edge + +before_cache: + - rm -f $HOME/.cache/pip/log/debug.log # erase log + +cache: + directories: + - "~/.platformio" + - $HOME/.cache/pip # pip cache + +env: + global: + # Warnings are errors + - PLATFORMIO_BUILD_FLAGS="-Werror -Wno-error=deprecated-declarations" + +matrix: + fast_finish: true + include: + - env: BOARD=uno PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientKitchenSink + - env: BOARD=uno PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientToggle + - env: BOARD=uno PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerKitchenSink + - env: BOARD=uno PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerLED + - env: BOARD=uno PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUTemperatureSensor + - env: BOARD=uno PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusClientToggle + - env: BOARD=uno PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusServerLED + + - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientKitchenSink + - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientToggle + - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerKitchenSink + - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerLED + - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUTemperatureSensor + - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusClientToggle + - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusServerLED + + - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientKitchenSink + - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientToggle + - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerKitchenSink + - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerLED + - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUTemperatureSensor + - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusClientToggle + - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusServerLED + + - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientKitchenSink + - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientToggle + - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerKitchenSink + - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerLED + - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUTemperatureSensor + - env: BOARD=due PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusClientToggle + - env: BOARD=due PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusServerLED + + - os: linux + dist: trusty + # Short duration job, would use the container/without sudo image as it boots faster, but we need a backported lintian, so don't + sudo: required + env: TASK='spellintian' + addons: + apt: + packages: + - moreutils + - os: linux + dist: trusty + # Short duration job, would use the container/without sudo image as it boots faster, but we need a backported lintian, so don't + sudo: required + env: TASK='spellintian-duplicates' + addons: + apt: + packages: + - moreutils + - os: linux + dist: trusty + env: TASK='codespell' + addons: + apt: + packages: + - moreutils + + allow_failures: + - os: linux + dist: trusty + env: TASK='spellintian-duplicates' + +before_install: + - if [ "$TASK" == "spellintian" -o "$TASK" == "spellintian-duplicates" ]; then sudo add-apt-repository ppa:waja/trusty-backports -y; sudo apt-get update -qq; sudo apt-get install lintian -y; fi # Install a late enough lintian + +install: + - if [ -z "$TASK" ]; then pip install --upgrade platformio; fi + - if [ "$TASK" = "codespell" ]; then pip install --upgrade git+https://github.com/codespell-project/codespell.git; fi + +script: + - bash -ex .travis-ci.sh From 32f70c43e068ddf1f7ac43bebfb3b5976e3f591b Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:02:26 +0100 Subject: [PATCH 03/17] Try and add a build status to the readme too. --- README.adoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.adoc b/README.adoc index 79fab17..e25817f 100644 --- a/README.adoc +++ b/README.adoc @@ -1,3 +1,6 @@ +[caption="Build Status",link=https://travis-ci.com/arduino-libraries/ArduinoModbus] +image::https://travis-ci.com/arduino-libraries/ArduinoModbus.svg?branch=master[Build Status] + = Modbus Library for Arduino = Use http://www.modbus.org/[Modbus] with your Arduino. From 5ccd5a38c54c8725e77796e1c37da2449c0071a3 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:09:31 +0100 Subject: [PATCH 04/17] Add the ArduinoRS485 library --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index cdc6ecb..afc44cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,6 +93,7 @@ before_install: install: - if [ -z "$TASK" ]; then pip install --upgrade platformio; fi + - if [ -z "$TASK" ]; then platformio lib install "ArduinoRS485"; fi - if [ "$TASK" = "codespell" ]; then pip install --upgrade git+https://github.com/codespell-project/codespell.git; fi script: From 9de1210f97039921888de69821826497dd9492f7 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:11:05 +0100 Subject: [PATCH 05/17] Fix a typo --- .../ModbusRTUClientKitchenSink/ModbusRTUClientKitchenSink.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/RTU/ModbusRTUClientKitchenSink/ModbusRTUClientKitchenSink.ino b/examples/RTU/ModbusRTUClientKitchenSink/ModbusRTUClientKitchenSink.ino index 1fa14ec..f468e07 100644 --- a/examples/RTU/ModbusRTUClientKitchenSink/ModbusRTUClientKitchenSink.ino +++ b/examples/RTU/ModbusRTUClientKitchenSink/ModbusRTUClientKitchenSink.ino @@ -1,7 +1,7 @@ /* Modbus RTU Client Kitchen Sink - This sketch creates a Modbus RTU Client and demostrates + This sketch creates a Modbus RTU Client and demonstrates how to use various Modbus Client APIs. Circuit: From dd9b3fae3b101baa3dbf58a429eb33223cf11903 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:13:07 +0100 Subject: [PATCH 06/17] Fix another typo --- .../ModbusRTUServerKitchenSink/ModbusRTUServerKitchenSink.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/RTU/ModbusRTUServerKitchenSink/ModbusRTUServerKitchenSink.ino b/examples/RTU/ModbusRTUServerKitchenSink/ModbusRTUServerKitchenSink.ino index 8501aa3..f6baabd 100644 --- a/examples/RTU/ModbusRTUServerKitchenSink/ModbusRTUServerKitchenSink.ino +++ b/examples/RTU/ModbusRTUServerKitchenSink/ModbusRTUServerKitchenSink.ino @@ -1,7 +1,7 @@ /* Modbus RTU Server Kitchen Sink - This sketch creates a Modbus RTU Server and demostrates + This sketch creates a Modbus RTU Server and demonstrates how to use various Modbus Server APIs. Circuit: From 2f6d082aa9a547a65a6b6ca87a72fc0141b99670 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:13:49 +0100 Subject: [PATCH 07/17] Don't use an ignore file for now --- .travis-ci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis-ci.sh b/.travis-ci.sh index 80cb733..6942ed7 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -71,10 +71,10 @@ elif [[ $TASK = 'codespell' ]]; then $SPELLINGBLACKLIST \ \) | xargs") # count the number of codespell errors - spellingerrors=$(zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignore $spellingfiles 2>&1 | wc -l) + spellingerrors=$(zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles 2>&1 | wc -l) if [[ $spellingerrors -ne 0 ]]; then # print the output for info - zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignore $spellingfiles + zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles echo "Found $spellingerrors spelling errors via codespell" exit 1; else From 4a9d7b997dddfbd570733a38c0b88be876da91d9 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:16:16 +0100 Subject: [PATCH 08/17] Another typo --- src/libmodbus/modbus-rtu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libmodbus/modbus-rtu.cpp b/src/libmodbus/modbus-rtu.cpp index d24b520..71badb5 100644 --- a/src/libmodbus/modbus-rtu.cpp +++ b/src/libmodbus/modbus-rtu.cpp @@ -923,7 +923,7 @@ static int _modbus_rtu_connect(modbus_t *ctx) ONCLR ant others needs OPOST to be enabled */ - /* Raw ouput */ + /* Raw output */ tios.c_oflag &=~ OPOST; /* C_CC Control characters From 92dac0df96512de1dcea908c75df9c1b38edb265 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:17:17 +0100 Subject: [PATCH 09/17] More typos --- src/libmodbus/modbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libmodbus/modbus.c b/src/libmodbus/modbus.c index acf5b10..31e17be 100644 --- a/src/libmodbus/modbus.c +++ b/src/libmodbus/modbus.c @@ -1460,7 +1460,7 @@ int modbus_mask_write_register(modbus_t *ctx, int addr, uint16_t and_mask, uint1 int rc; int req_length; /* The request length can not exceed _MIN_REQ_LENGTH - 2 and 4 bytes to - * store the masks. The ugly substraction is there to remove the 'nb' value + * store the masks. The ugly subtraction is there to remove the 'nb' value * (2 bytes) which is not used. */ uint8_t req[_MIN_REQ_LENGTH + 2]; From 4a5ecc238c505a7f8aed47bd5606ed1bc56a607e Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:21:08 +0100 Subject: [PATCH 10/17] More typos --- src/libmodbus/modbus-tcp-private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libmodbus/modbus-tcp-private.h b/src/libmodbus/modbus-tcp-private.h index c87c33f..17ffd9a 100644 --- a/src/libmodbus/modbus-tcp-private.h +++ b/src/libmodbus/modbus-tcp-private.h @@ -21,7 +21,7 @@ #define _MODBUS_TCP_CHECKSUM_LENGTH 0 /* In both structures, the transaction ID must be placed on first position - to have a quick access not dependant of the TCP backend */ + to have a quick access not dependent of the TCP backend */ typedef struct _modbus_tcp { /* Extract from MODBUS Messaging on TCP/IP Implementation Guide V1.0b (page 23/46): From 3d38ccb5efe42d9f1a4212237f42d2b966ca0f71 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:22:07 +0100 Subject: [PATCH 11/17] Fix the final typos --- src/libmodbus/modbus-tcp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libmodbus/modbus-tcp.cpp b/src/libmodbus/modbus-tcp.cpp index 57b94fe..943a6de 100644 --- a/src/libmodbus/modbus-tcp.cpp +++ b/src/libmodbus/modbus-tcp.cpp @@ -184,7 +184,7 @@ static int _modbus_tcp_prepare_response_tid(const uint8_t *req, int *req_length) static int _modbus_tcp_send_msg_pre(uint8_t *req, int req_length) { - /* Substract the header length to the message length */ + /* Subtract the header length to the message length */ int mbap_length = req_length - 6; req[4] = mbap_length >> 8; @@ -1024,7 +1024,7 @@ modbus_t* modbus_new_tcp_pi(const char *node, const char *service) dest_size = sizeof(char) * _MODBUS_TCP_PI_SERVICE_LENGTH; ret_size = strlcpy(ctx_tcp_pi->service, service, dest_size); } else { - /* Empty service is not allowed, error catched below. */ + /* Empty service is not allowed, error caught below. */ ret_size = 0; } From 665f3cfaadd039b6d6329b4ba18875dff4fcf9df Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 25 Aug 2019 22:29:30 +0100 Subject: [PATCH 12/17] Tweak the matrix to match what should work --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index afc44cf..1994c52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,32 +30,32 @@ matrix: - env: BOARD=uno PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerKitchenSink - env: BOARD=uno PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerLED - env: BOARD=uno PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUTemperatureSensor - - env: BOARD=uno PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusClientToggle - - env: BOARD=uno PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusServerLED - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientKitchenSink - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientToggle - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerKitchenSink - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerLED - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUTemperatureSensor - - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusClientToggle - - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusServerLED - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientKitchenSink - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientToggle - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerKitchenSink - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerLED - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUTemperatureSensor - - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusClientToggle - - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusServerLED - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientKitchenSink - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientToggle - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerKitchenSink - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerLED - env: BOARD=due PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUTemperatureSensor - - env: BOARD=due PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusClientToggle - - env: BOARD=due PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusServerLED + + - env: BOARD=mkrwifi1010 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientKitchenSink + - env: BOARD=mkrwifi1010 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUClientToggle + - env: BOARD=mkrwifi1010 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerKitchenSink + - env: BOARD=mkrwifi1010 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUServerLED + - env: BOARD=mkrwifi1010 PLATFORMIO_CI_SRC=examples/RTU/ModbusRTUTemperatureSensor + - env: BOARD=mkrwifi1010 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusClientToggle + - env: BOARD=mkrwifi1010 PLATFORMIO_CI_SRC=examples/TCP/WiFiModbusServerLED - os: linux dist: trusty From 9c318118e61ecaa0991fe187ad49ae3d69df7b4a Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Mon, 26 Aug 2019 13:33:24 +0100 Subject: [PATCH 13/17] Fix another typo --- src/libmodbus/modbus-tcp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libmodbus/modbus-tcp.cpp b/src/libmodbus/modbus-tcp.cpp index 943a6de..b73f1dd 100644 --- a/src/libmodbus/modbus-tcp.cpp +++ b/src/libmodbus/modbus-tcp.cpp @@ -933,7 +933,7 @@ modbus_t* modbus_new_tcp(const char *ip, int port) sa.sa_handler = SIG_IGN; if (sigaction(SIGPIPE, &sa, NULL) < 0) { /* The debug flag can't be set here... */ - fprintf(stderr, "Coud not install SIGPIPE handler.\n"); + fprintf(stderr, "Could not install SIGPIPE handler.\n"); return NULL; } #endif From a058c303ed80b1fc477767b03e2449dca472254b Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Mon, 26 Aug 2019 13:38:54 +0100 Subject: [PATCH 14/17] Ignore "ser" as it's used as a shortened version of serial all over the place --- .travis-ci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis-ci.sh b/.travis-ci.sh index 6942ed7..2a59842 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -71,10 +71,10 @@ elif [[ $TASK = 'codespell' ]]; then $SPELLINGBLACKLIST \ \) | xargs") # count the number of codespell errors - spellingerrors=$(zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles 2>&1 | wc -l) + spellingerrors=$(zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" -L ser $spellingfiles 2>&1 | wc -l) if [[ $spellingerrors -ne 0 ]]; then # print the output for info - zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles + zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" -L ser $spellingfiles echo "Found $spellingerrors spelling errors via codespell" exit 1; else From 78d7f5330b42af2db9f1151d623da4c86bd90557 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Mon, 26 Aug 2019 13:42:09 +0100 Subject: [PATCH 15/17] Install WiFiNINA library if necessary --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1994c52..a5a3de1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,6 +94,7 @@ before_install: install: - if [ -z "$TASK" ]; then pip install --upgrade platformio; fi - if [ -z "$TASK" ]; then platformio lib install "ArduinoRS485"; fi + - if [ -z "$TASK" -a "$BOARD" == "mkrwifi1010" ]; then platformio lib install "WiFiNINA"; fi - if [ "$TASK" = "codespell" ]; then pip install --upgrade git+https://github.com/codespell-project/codespell.git; fi script: From 1bb420908dab0add4792ef2eda674a1fed1679d0 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 30 Aug 2019 11:50:06 +0100 Subject: [PATCH 16/17] Revert some spelling fixes Pushed upstream instead in https://github.com/stephane/libmodbus/pull/492 --- src/libmodbus/modbus-rtu.cpp | 2 +- src/libmodbus/modbus-tcp-private.h | 2 +- src/libmodbus/modbus-tcp.cpp | 6 +++--- src/libmodbus/modbus.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libmodbus/modbus-rtu.cpp b/src/libmodbus/modbus-rtu.cpp index 71badb5..d24b520 100644 --- a/src/libmodbus/modbus-rtu.cpp +++ b/src/libmodbus/modbus-rtu.cpp @@ -923,7 +923,7 @@ static int _modbus_rtu_connect(modbus_t *ctx) ONCLR ant others needs OPOST to be enabled */ - /* Raw output */ + /* Raw ouput */ tios.c_oflag &=~ OPOST; /* C_CC Control characters diff --git a/src/libmodbus/modbus-tcp-private.h b/src/libmodbus/modbus-tcp-private.h index 17ffd9a..c87c33f 100644 --- a/src/libmodbus/modbus-tcp-private.h +++ b/src/libmodbus/modbus-tcp-private.h @@ -21,7 +21,7 @@ #define _MODBUS_TCP_CHECKSUM_LENGTH 0 /* In both structures, the transaction ID must be placed on first position - to have a quick access not dependent of the TCP backend */ + to have a quick access not dependant of the TCP backend */ typedef struct _modbus_tcp { /* Extract from MODBUS Messaging on TCP/IP Implementation Guide V1.0b (page 23/46): diff --git a/src/libmodbus/modbus-tcp.cpp b/src/libmodbus/modbus-tcp.cpp index b73f1dd..57b94fe 100644 --- a/src/libmodbus/modbus-tcp.cpp +++ b/src/libmodbus/modbus-tcp.cpp @@ -184,7 +184,7 @@ static int _modbus_tcp_prepare_response_tid(const uint8_t *req, int *req_length) static int _modbus_tcp_send_msg_pre(uint8_t *req, int req_length) { - /* Subtract the header length to the message length */ + /* Substract the header length to the message length */ int mbap_length = req_length - 6; req[4] = mbap_length >> 8; @@ -933,7 +933,7 @@ modbus_t* modbus_new_tcp(const char *ip, int port) sa.sa_handler = SIG_IGN; if (sigaction(SIGPIPE, &sa, NULL) < 0) { /* The debug flag can't be set here... */ - fprintf(stderr, "Could not install SIGPIPE handler.\n"); + fprintf(stderr, "Coud not install SIGPIPE handler.\n"); return NULL; } #endif @@ -1024,7 +1024,7 @@ modbus_t* modbus_new_tcp_pi(const char *node, const char *service) dest_size = sizeof(char) * _MODBUS_TCP_PI_SERVICE_LENGTH; ret_size = strlcpy(ctx_tcp_pi->service, service, dest_size); } else { - /* Empty service is not allowed, error caught below. */ + /* Empty service is not allowed, error catched below. */ ret_size = 0; } diff --git a/src/libmodbus/modbus.c b/src/libmodbus/modbus.c index 31e17be..acf5b10 100644 --- a/src/libmodbus/modbus.c +++ b/src/libmodbus/modbus.c @@ -1460,7 +1460,7 @@ int modbus_mask_write_register(modbus_t *ctx, int addr, uint16_t and_mask, uint1 int rc; int req_length; /* The request length can not exceed _MIN_REQ_LENGTH - 2 and 4 bytes to - * store the masks. The ugly subtraction is there to remove the 'nb' value + * store the masks. The ugly substraction is there to remove the 'nb' value * (2 bytes) which is not used. */ uint8_t req[_MIN_REQ_LENGTH + 2]; From 1b02c7c1d7426c3a2232aa0ea01f4a1308bbb608 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 30 Aug 2019 11:51:48 +0100 Subject: [PATCH 17/17] Ignore typos in libmodbus as they will be checked and fixed upstream --- .travis-ci.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis-ci.sh b/.travis-ci.sh index 2a59842..4a82c43 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -7,9 +7,11 @@ set -e CPP_LINT_URL="https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py"; +# Libmodbus spelling tested and should be fixed upstream SPELLINGBLACKLIST=$(cat <<-BLACKLIST -wholename "./.codespellignore" -or \ - -wholename "./.git/*" + -wholename "./.git/*" -or \ + -wholename "./src/libmodbus/*" BLACKLIST )