From f01a3e211ddebf23d55f916a80f5d8bb2cc7e4ce Mon Sep 17 00:00:00 2001 From: Christoph Kottke Date: Thu, 13 May 2021 13:17:41 +0200 Subject: [PATCH 01/20] fix 2f772b028a9deb4e55efdbbb98558b61d3f7be18 --- src/Task.h | 4 ++-- src/TaskModem.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Task.h b/src/Task.h index 4c881a4..bc74fee 100644 --- a/src/Task.h +++ b/src/Task.h @@ -6,7 +6,7 @@ enum TaskNames TaskAprsIs = 1, TaskEth, TaskFtp, - TaskLora, + TaskModem, TaskNtp, TaskOta, TaskWifi, @@ -18,7 +18,7 @@ enum TaskNames #define TASK_APRS_IS "AprsIsTask" #define TASK_ETH "EthTask" #define TASK_FTP "FTPTask" -#define TASK_LORA "LoraTask" +#define TASK_MODEM "ModemTask" #define TASK_NTP "NTPTask" #define TASK_OTA "OTATask" #define TASK_WIFI "WifiTask" diff --git a/src/TaskModem.cpp b/src/TaskModem.cpp index 6f9a8ba..c02a568 100644 --- a/src/TaskModem.cpp +++ b/src/TaskModem.cpp @@ -6,7 +6,7 @@ #include "TaskModem.h" #include "project_configuration.h" -ModemTask::ModemTask() : Task(TASK_LORA, TaskLora) { +ModemTask::ModemTask() : Task(TASK_MODEM, TaskModem) { } ModemTask::~ModemTask() { From b6f7db49f61878387c622c69c512895e8e10bb31 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 15 May 2021 16:49:51 +0200 Subject: [PATCH 02/20] lets try this cppcheck --- .github/workflows/cppcheck.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/cppcheck.yml diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml new file mode 100644 index 0000000..1e2d257 --- /dev/null +++ b/.github/workflows/cppcheck.yml @@ -0,0 +1,21 @@ +name: cppcheck-action-test +on: [push] + +jobs: + build: + name: cppcheck-test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: cppcheck + uses: deep5050/cppcheck-action@main + with: + github_token: ${{ secrets.GITHUB_TOKEN}} + + + - name: publish report + uses: mikeal/publish-to-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH_NAME: 'develop' # your branch name goes here From 1b5fabfc72fd07408164191979363788e341f3dd Mon Sep 17 00:00:00 2001 From: Automated Publisher Date: Sat, 15 May 2021 14:52:24 +0000 Subject: [PATCH 03/20] Automated publish: Sat May 15 14:52:24 UTC 2021 b6f7db49f61878387c622c69c512895e8e10bb31 --- cppcheck_report.txt | 287 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 287 insertions(+) create mode 100644 cppcheck_report.txt diff --git a/cppcheck_report.txt b/cppcheck_report.txt new file mode 100644 index 0000000..e3d4679 --- /dev/null +++ b/cppcheck_report.txt @@ -0,0 +1,287 @@ +lib/BoardFinder/BoardFinder.h:57:8: performance:inconclusive: Technically the member function 'BoardFinder::checkOledConfig' can be static (but you may consider moving to unnamed namespace). [functionStatic] + bool checkOledConfig(std::shared_ptr boardConfig); + ^ +lib/BoardFinder/BoardFinder.cpp:63:19: note: Technically the member function 'BoardFinder::checkOledConfig' can be static (but you may consider moving to unnamed namespace). +bool BoardFinder::checkOledConfig(std::shared_ptr boardConfig) { + ^ +lib/BoardFinder/BoardFinder.h:57:8: note: Technically the member function 'BoardFinder::checkOledConfig' can be static (but you may consider moving to unnamed namespace). + bool checkOledConfig(std::shared_ptr boardConfig); + ^ +lib/BoardFinder/BoardFinder.h:58:8: performance:inconclusive: Technically the member function 'BoardFinder::checkModemConfig' can be static (but you may consider moving to unnamed namespace). [functionStatic] + bool checkModemConfig(std::shared_ptr boardConfig); + ^ +lib/BoardFinder/BoardFinder.cpp:83:19: note: Technically the member function 'BoardFinder::checkModemConfig' can be static (but you may consider moving to unnamed namespace). +bool BoardFinder::checkModemConfig(std::shared_ptr boardConfig) { + ^ +lib/BoardFinder/BoardFinder.h:58:8: note: Technically the member function 'BoardFinder::checkModemConfig' can be static (but you may consider moving to unnamed namespace). + bool checkModemConfig(std::shared_ptr boardConfig); + ^ +lib/BoardFinder/BoardFinder.h:59:8: performance:inconclusive: Technically the member function 'BoardFinder::checkPowerConfig' can be static (but you may consider moving to unnamed namespace). [functionStatic] + bool checkPowerConfig(std::shared_ptr boardConfig); + ^ +lib/BoardFinder/BoardFinder.cpp:110:19: note: Technically the member function 'BoardFinder::checkPowerConfig' can be static (but you may consider moving to unnamed namespace). +bool BoardFinder::checkPowerConfig(std::shared_ptr boardConfig) { + ^ +lib/BoardFinder/BoardFinder.h:59:8: note: Technically the member function 'BoardFinder::checkPowerConfig' can be static (but you may consider moving to unnamed namespace). + bool checkPowerConfig(std::shared_ptr boardConfig); + ^ +lib/Display/OLEDDisplay.h:119:8: performance:inconclusive: Technically the member function 'OLEDDisplay::clear' can be static (but you may consider moving to unnamed namespace). [functionStatic] + void clear(); + ^ +lib/Display/OLEDDisplay.cpp:127:19: note: Technically the member function 'OLEDDisplay::clear' can be static (but you may consider moving to unnamed namespace). +void OLEDDisplay::clear() { + ^ +lib/Display/OLEDDisplay.h:119:8: note: Technically the member function 'OLEDDisplay::clear' can be static (but you may consider moving to unnamed namespace). + void clear(); + ^ +lib/Display/OLEDDisplay.h:122:8: style:inconclusive: Technically the member function 'OLEDDisplay::getWidth' can be const. [functionConst] + uint getWidth(); + ^ +lib/Display/OLEDDisplay.cpp:131:19: note: Technically the member function 'OLEDDisplay::getWidth' can be const. +uint OLEDDisplay::getWidth() { + ^ +lib/Display/OLEDDisplay.h:122:8: note: Technically the member function 'OLEDDisplay::getWidth' can be const. + uint getWidth(); + ^ +lib/Display/OLEDDisplay.h:123:8: style:inconclusive: Technically the member function 'OLEDDisplay::getHeight' can be const. [functionConst] + uint getHeight(); + ^ +lib/Display/OLEDDisplay.cpp:144:19: note: Technically the member function 'OLEDDisplay::getHeight' can be const. +uint OLEDDisplay::getHeight() { + ^ +lib/Display/OLEDDisplay.h:123:8: note: Technically the member function 'OLEDDisplay::getHeight' can be const. + uint getHeight(); + ^ +lib/System/TaskManager.h:67:36: style:inconclusive: Technically the member function 'TaskManager::getTasks' can be const. [functionConst] + std::list> getTasks(); + ^ +lib/System/TaskManager.cpp:26:47: note: Technically the member function 'TaskManager::getTasks' can be const. +std::list> TaskManager::getTasks() { + ^ +lib/System/TaskManager.h:67:36: note: Technically the member function 'TaskManager::getTasks' can be const. + std::list> getTasks(); + ^ +lib/System/Timer.h:17:8: style:inconclusive: Technically the member function 'Timer::check' can be const. [functionConst] + bool check(); + ^ +lib/System/Timer.cpp:22:13: note: Technically the member function 'Timer::check' can be const. +bool Timer::check() { + ^ +lib/System/Timer.h:17:8: note: Technically the member function 'Timer::check' can be const. + bool check(); + ^ +lib/TimeLib/TimeLib.cpp:159:23: style:inconclusive: Function 'breakTime' argument 1 names different: declaration 'time' definition 'timeInput'. [funcArgNamesDifferent] +void breakTime(time_t timeInput, tmElements_t &tm){ + ^ +lib/TimeLib/TimeLib.h:123:23: note: Function 'breakTime' argument 1 names different: declaration 'time' definition 'timeInput'. +void breakTime(time_t time, tmElements_t &tm); // break time_t into elements + ^ +lib/TimeLib/TimeLib.cpp:159:23: note: Function 'breakTime' argument 1 names different: declaration 'time' definition 'timeInput'. +void breakTime(time_t timeInput, tmElements_t &tm){ + ^ +lib/TimeLib/TimeLib.cpp:294:41: style:inconclusive: Function 'setTime' argument 4 names different: declaration 'day' definition 'dy'. [funcArgNamesDifferent] +void setTime(int hr,int min,int sec,int dy, int mnth, int yr){ + ^ +lib/TimeLib/TimeLib.h:107:44: note: Function 'setTime' argument 4 names different: declaration 'day' definition 'dy'. +void setTime(int hr,int min,int sec,int day, int month, int yr); + ^ +lib/TimeLib/TimeLib.cpp:294:41: note: Function 'setTime' argument 4 names different: declaration 'day' definition 'dy'. +void setTime(int hr,int min,int sec,int dy, int mnth, int yr){ + ^ +lib/TimeLib/TimeLib.cpp:294:49: style:inconclusive: Function 'setTime' argument 5 names different: declaration 'month' definition 'mnth'. [funcArgNamesDifferent] +void setTime(int hr,int min,int sec,int dy, int mnth, int yr){ + ^ +lib/TimeLib/TimeLib.h:107:53: note: Function 'setTime' argument 5 names different: declaration 'month' definition 'mnth'. +void setTime(int hr,int min,int sec,int day, int month, int yr); + ^ +lib/TimeLib/TimeLib.cpp:294:49: note: Function 'setTime' argument 5 names different: declaration 'month' definition 'mnth'. +void setTime(int hr,int min,int sec,int dy, int mnth, int yr){ + ^ +lib/TimeLib/TimeLib.cpp:164:10: style: Local variable 'year' shadows outer function [shadowFunction] + uint8_t year; + ^ +lib/TimeLib/TimeLib.h:99:9: note: Shadowed declaration +int year(); // the full four digit year: (2009, 2010 etc) + ^ +lib/TimeLib/TimeLib.cpp:164:10: note: Shadow variable + uint8_t year; + ^ +lib/TimeLib/TimeLib.cpp:165:10: style: Local variable 'month' shadows outer function [shadowFunction] + uint8_t month, monthLength; + ^ +lib/TimeLib/TimeLib.h:97:9: note: Shadowed declaration +int month(); // the month now (Jan is month 1) + ^ +lib/TimeLib/TimeLib.cpp:165:10: note: Shadow variable + uint8_t month, monthLength; + ^ +lib/TimeLib/TimeLib.cpp:188:6: style: Variable 'days' is assigned a value that is never used. [unreadVariable] + days=0; + ^ +lib/TimeLib/TimeLib.cpp:190:13: style: Variable 'monthLength' is assigned a value that is never used. [unreadVariable] + monthLength=0; + ^ +src/LoRa_APRS_iGate.cpp:59:25: warning: Either the condition 'boardConfig==0' is redundant or there is possible null pointer dereference: boardConfig. [nullPointerRedundantCheck] + userConfig->board = boardConfig->Name; + ^ +src/LoRa_APRS_iGate.cpp:54:21: note: Assuming that condition 'boardConfig==0' is not redundant + if (boardConfig == 0) { + ^ +src/LoRa_APRS_iGate.cpp:59:25: note: Null pointer dereference + userConfig->board = boardConfig->Name; + ^ +src/LoRa_APRS_iGate.cpp:65:13: warning: Either the condition 'boardConfig==0' is redundant or there is possible null pointer dereference: boardConfig. [nullPointerRedundantCheck] + logPrintI(boardConfig->Name); + ^ +src/LoRa_APRS_iGate.cpp:54:21: note: Assuming that condition 'boardConfig==0' is not redundant + if (boardConfig == 0) { + ^ +src/LoRa_APRS_iGate.cpp:65:13: note: Null pointer dereference + logPrintI(boardConfig->Name); + ^ +src/project_configuration.cpp:36:61: style:inconclusive: Boolean expression 'true' is used in bitwise operation. Did you mean '||'? [bitwiseOnBoolean] + conf->display.alwaysOn = data["display"]["always_on"] | true; + ^ +src/project_configuration.cpp:39:59: style:inconclusive: Boolean expression 'true' is used in bitwise operation. Did you mean '||'? [bitwiseOnBoolean] + conf->display.turn180 = data["display"]["turn180"] | true; + ^ +src/project_configuration.cpp:41:44: style:inconclusive: Boolean expression 'false' is used in bitwise operation. Did you mean '||'? [bitwiseOnBoolean] + conf->ftp.active = data["ftp"]["active"] | false; + ^ +lib/PowerManagement/power_management.cpp:28:0: style: The function 'activateGPS' is never used. [unusedFunction] + +^ +lib/TimeLib/TimeLib.cpp:310:0: style: The function 'adjustTime' is never used. [unusedFunction] + +^ +lib/TimeLib/TimeLibString.cpp:53:0: style: The function 'dayShortStr' is never used. [unusedFunction] + +^ +lib/TimeLib/TimeLibString.cpp:42:0: style: The function 'dayStr' is never used. [unusedFunction] + +^ +lib/PowerManagement/power_management.cpp:23:0: style: The function 'deactivateLoRa' is never used. [unusedFunction] + +^ +lib/PowerManagement/power_management.cpp:43:0: style: The function 'decativateOLED' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:558:0: style: The function 'disableInvertIQ' is never used. [unusedFunction] + +^ +lib/Display/Bitmap.cpp:123:0: style: The function 'drawCircle' is never used. [unusedFunction] + +^ +lib/Display/Bitmap.cpp:61:0: style: The function 'drawLine' is never used. [unusedFunction] + +^ +lib/Display/Bitmap.cpp:218:0: style: The function 'drawProgressBar' is never used. [unusedFunction] + +^ +lib/Display/Bitmap.cpp:108:0: style: The function 'drawRect' is never used. [unusedFunction] + +^ +lib/Display/Bitmap.cpp:313:0: style: The function 'drawStringLFf' is never used. [unusedFunction] + +^ +lib/Display/Bitmap.cpp:290:0: style: The function 'drawStringf' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:625:0: style: The function 'dumpRegisters' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:552:0: style: The function 'enableInvertIQ' is never used. [unusedFunction] + +^ +lib/NTPClient/NTPClient.cpp:127:0: style: The function 'getDay' is never used. [unusedFunction] + +^ +lib/NTPClient/NTPClient.cpp:130:0: style: The function 'getHours' is never used. [unusedFunction] + +^ +lib/NTPClient/NTPClient.cpp:133:0: style: The function 'getMinutes' is never used. [unusedFunction] + +^ +lib/Display/Bitmap.cpp:48:0: style: The function 'getPixel' is never used. [unusedFunction] + +^ +lib/NTPClient/NTPClient.cpp:136:0: style: The function 'getSeconds' is never used. [unusedFunction] + +^ +lib/LoRa_APRS/LoRa_APRS.cpp:65:0: style: The function 'getTxFrequency' is never used. [unusedFunction] + +^ +lib/Display/OLEDDisplay.cpp:63:0: style: The function 'invertDisplay' is never used. [unusedFunction] + +^ +lib/TimeLib/TimeLib.cpp:68:0: style: The function 'isAM' is never used. [unusedFunction] + +^ +lib/Display/OLEDDisplay.cpp:114:0: style: The function 'mirrorScreen' is never used. [unusedFunction] + +^ +lib/TimeLib/TimeLibString.cpp:31:0: style: The function 'monthShortStr' is never used. [unusedFunction] + +^ +lib/TimeLib/TimeLibString.cpp:20:0: style: The function 'monthStr' is never used. [unusedFunction] + +^ +lib/Display/OLEDDisplay.cpp:68:0: style: The function 'normalDisplay' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:269:0: style: The function 'packetFrequencyError' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:334:0: style: The function 'peek' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:356:0: style: The function 'receive' is never used. [unusedFunction] + +^ +lib/Display/OLEDDisplay.cpp:102:0: style: The function 'resetOrientation' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:288:0: style: The function 'rssi' is never used. [unusedFunction] + +^ +lib/Display/OLEDDisplay.cpp:86:0: style: The function 'setBrightness' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:577:0: style: The function 'setGain' is never used. [unusedFunction] + +^ +lib/NTPClient/NTPClient.cpp:168:0: style: The function 'setPoolServerName' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:531:0: style: The function 'setPreambleLength' is never used. [unusedFunction] + +^ +lib/NTPClient/NTPClient.cpp:199:0: style: The function 'setRandomPort' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:615:0: style: The function 'setSPI' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:620:0: style: The function 'setSPIFrequency' is never used. [unusedFunction] + +^ +lib/TimeLib/TimeLib.cpp:326:0: style: The function 'setSyncInterval' is never used. [unusedFunction] + +^ +lib/TimeLib/TimeLib.cpp:320:0: style: The function 'setSyncProvider' is never used. [unusedFunction] + +^ +lib/LoRa/LoRa.cpp:537:0: style: The function 'setSyncWord' is never used. [unusedFunction] + +^ +lib/NTPClient/NTPClient.cpp:160:0: style: The function 'setTimeOffset' is never used. [unusedFunction] + +^ +lib/NTPClient/NTPClient.cpp:164:0: style: The function 'setUpdateInterval' is never used. [unusedFunction] + +^ +lib/TimeLib/TimeLib.cpp:315:0: style: The function 'timeStatus' is never used. [unusedFunction] + +^ +nofile:0:0: information: Cppcheck cannot find all the include files (use --check-config for details) [missingIncludeSystem] + From 74f4c3872cb44d86d9ba3c97406c4bf847966888 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 15 May 2021 17:16:58 +0200 Subject: [PATCH 04/20] cppcheck --- .github/workflows/build_check.yml | 17 +++++++++++++++++ .github/workflows/cppcheck.yml | 21 --------------------- 2 files changed, 17 insertions(+), 21 deletions(-) delete mode 100644 .github/workflows/cppcheck.yml diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 0cbe379..894609f 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -79,3 +79,20 @@ jobs: clang-format-version: '11' check-path: ${{ matrix.path }} + cppcheck: + name: Run Cppcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run Cppcheck + uses: Bedzior/cppcheck-action@v1.0 + with: + enabled checks: all + enable inconclusive: true + generate report: true + - name: Upload report + uses: actions/upload-artifact@v1 + with: + name: report + path: output + diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml deleted file mode 100644 index 1e2d257..0000000 --- a/.github/workflows/cppcheck.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: cppcheck-action-test -on: [push] - -jobs: - build: - name: cppcheck-test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: cppcheck - uses: deep5050/cppcheck-action@main - with: - github_token: ${{ secrets.GITHUB_TOKEN}} - - - - name: publish report - uses: mikeal/publish-to-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH_NAME: 'develop' # your branch name goes here From 0f44b859ef24d37fe3d68c5bcc6785f372aa1c97 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 15 May 2021 17:17:48 +0200 Subject: [PATCH 05/20] remove report --- cppcheck_report.txt | 287 -------------------------------------------- 1 file changed, 287 deletions(-) delete mode 100644 cppcheck_report.txt diff --git a/cppcheck_report.txt b/cppcheck_report.txt deleted file mode 100644 index e3d4679..0000000 --- a/cppcheck_report.txt +++ /dev/null @@ -1,287 +0,0 @@ -lib/BoardFinder/BoardFinder.h:57:8: performance:inconclusive: Technically the member function 'BoardFinder::checkOledConfig' can be static (but you may consider moving to unnamed namespace). [functionStatic] - bool checkOledConfig(std::shared_ptr boardConfig); - ^ -lib/BoardFinder/BoardFinder.cpp:63:19: note: Technically the member function 'BoardFinder::checkOledConfig' can be static (but you may consider moving to unnamed namespace). -bool BoardFinder::checkOledConfig(std::shared_ptr boardConfig) { - ^ -lib/BoardFinder/BoardFinder.h:57:8: note: Technically the member function 'BoardFinder::checkOledConfig' can be static (but you may consider moving to unnamed namespace). - bool checkOledConfig(std::shared_ptr boardConfig); - ^ -lib/BoardFinder/BoardFinder.h:58:8: performance:inconclusive: Technically the member function 'BoardFinder::checkModemConfig' can be static (but you may consider moving to unnamed namespace). [functionStatic] - bool checkModemConfig(std::shared_ptr boardConfig); - ^ -lib/BoardFinder/BoardFinder.cpp:83:19: note: Technically the member function 'BoardFinder::checkModemConfig' can be static (but you may consider moving to unnamed namespace). -bool BoardFinder::checkModemConfig(std::shared_ptr boardConfig) { - ^ -lib/BoardFinder/BoardFinder.h:58:8: note: Technically the member function 'BoardFinder::checkModemConfig' can be static (but you may consider moving to unnamed namespace). - bool checkModemConfig(std::shared_ptr boardConfig); - ^ -lib/BoardFinder/BoardFinder.h:59:8: performance:inconclusive: Technically the member function 'BoardFinder::checkPowerConfig' can be static (but you may consider moving to unnamed namespace). [functionStatic] - bool checkPowerConfig(std::shared_ptr boardConfig); - ^ -lib/BoardFinder/BoardFinder.cpp:110:19: note: Technically the member function 'BoardFinder::checkPowerConfig' can be static (but you may consider moving to unnamed namespace). -bool BoardFinder::checkPowerConfig(std::shared_ptr boardConfig) { - ^ -lib/BoardFinder/BoardFinder.h:59:8: note: Technically the member function 'BoardFinder::checkPowerConfig' can be static (but you may consider moving to unnamed namespace). - bool checkPowerConfig(std::shared_ptr boardConfig); - ^ -lib/Display/OLEDDisplay.h:119:8: performance:inconclusive: Technically the member function 'OLEDDisplay::clear' can be static (but you may consider moving to unnamed namespace). [functionStatic] - void clear(); - ^ -lib/Display/OLEDDisplay.cpp:127:19: note: Technically the member function 'OLEDDisplay::clear' can be static (but you may consider moving to unnamed namespace). -void OLEDDisplay::clear() { - ^ -lib/Display/OLEDDisplay.h:119:8: note: Technically the member function 'OLEDDisplay::clear' can be static (but you may consider moving to unnamed namespace). - void clear(); - ^ -lib/Display/OLEDDisplay.h:122:8: style:inconclusive: Technically the member function 'OLEDDisplay::getWidth' can be const. [functionConst] - uint getWidth(); - ^ -lib/Display/OLEDDisplay.cpp:131:19: note: Technically the member function 'OLEDDisplay::getWidth' can be const. -uint OLEDDisplay::getWidth() { - ^ -lib/Display/OLEDDisplay.h:122:8: note: Technically the member function 'OLEDDisplay::getWidth' can be const. - uint getWidth(); - ^ -lib/Display/OLEDDisplay.h:123:8: style:inconclusive: Technically the member function 'OLEDDisplay::getHeight' can be const. [functionConst] - uint getHeight(); - ^ -lib/Display/OLEDDisplay.cpp:144:19: note: Technically the member function 'OLEDDisplay::getHeight' can be const. -uint OLEDDisplay::getHeight() { - ^ -lib/Display/OLEDDisplay.h:123:8: note: Technically the member function 'OLEDDisplay::getHeight' can be const. - uint getHeight(); - ^ -lib/System/TaskManager.h:67:36: style:inconclusive: Technically the member function 'TaskManager::getTasks' can be const. [functionConst] - std::list> getTasks(); - ^ -lib/System/TaskManager.cpp:26:47: note: Technically the member function 'TaskManager::getTasks' can be const. -std::list> TaskManager::getTasks() { - ^ -lib/System/TaskManager.h:67:36: note: Technically the member function 'TaskManager::getTasks' can be const. - std::list> getTasks(); - ^ -lib/System/Timer.h:17:8: style:inconclusive: Technically the member function 'Timer::check' can be const. [functionConst] - bool check(); - ^ -lib/System/Timer.cpp:22:13: note: Technically the member function 'Timer::check' can be const. -bool Timer::check() { - ^ -lib/System/Timer.h:17:8: note: Technically the member function 'Timer::check' can be const. - bool check(); - ^ -lib/TimeLib/TimeLib.cpp:159:23: style:inconclusive: Function 'breakTime' argument 1 names different: declaration 'time' definition 'timeInput'. [funcArgNamesDifferent] -void breakTime(time_t timeInput, tmElements_t &tm){ - ^ -lib/TimeLib/TimeLib.h:123:23: note: Function 'breakTime' argument 1 names different: declaration 'time' definition 'timeInput'. -void breakTime(time_t time, tmElements_t &tm); // break time_t into elements - ^ -lib/TimeLib/TimeLib.cpp:159:23: note: Function 'breakTime' argument 1 names different: declaration 'time' definition 'timeInput'. -void breakTime(time_t timeInput, tmElements_t &tm){ - ^ -lib/TimeLib/TimeLib.cpp:294:41: style:inconclusive: Function 'setTime' argument 4 names different: declaration 'day' definition 'dy'. [funcArgNamesDifferent] -void setTime(int hr,int min,int sec,int dy, int mnth, int yr){ - ^ -lib/TimeLib/TimeLib.h:107:44: note: Function 'setTime' argument 4 names different: declaration 'day' definition 'dy'. -void setTime(int hr,int min,int sec,int day, int month, int yr); - ^ -lib/TimeLib/TimeLib.cpp:294:41: note: Function 'setTime' argument 4 names different: declaration 'day' definition 'dy'. -void setTime(int hr,int min,int sec,int dy, int mnth, int yr){ - ^ -lib/TimeLib/TimeLib.cpp:294:49: style:inconclusive: Function 'setTime' argument 5 names different: declaration 'month' definition 'mnth'. [funcArgNamesDifferent] -void setTime(int hr,int min,int sec,int dy, int mnth, int yr){ - ^ -lib/TimeLib/TimeLib.h:107:53: note: Function 'setTime' argument 5 names different: declaration 'month' definition 'mnth'. -void setTime(int hr,int min,int sec,int day, int month, int yr); - ^ -lib/TimeLib/TimeLib.cpp:294:49: note: Function 'setTime' argument 5 names different: declaration 'month' definition 'mnth'. -void setTime(int hr,int min,int sec,int dy, int mnth, int yr){ - ^ -lib/TimeLib/TimeLib.cpp:164:10: style: Local variable 'year' shadows outer function [shadowFunction] - uint8_t year; - ^ -lib/TimeLib/TimeLib.h:99:9: note: Shadowed declaration -int year(); // the full four digit year: (2009, 2010 etc) - ^ -lib/TimeLib/TimeLib.cpp:164:10: note: Shadow variable - uint8_t year; - ^ -lib/TimeLib/TimeLib.cpp:165:10: style: Local variable 'month' shadows outer function [shadowFunction] - uint8_t month, monthLength; - ^ -lib/TimeLib/TimeLib.h:97:9: note: Shadowed declaration -int month(); // the month now (Jan is month 1) - ^ -lib/TimeLib/TimeLib.cpp:165:10: note: Shadow variable - uint8_t month, monthLength; - ^ -lib/TimeLib/TimeLib.cpp:188:6: style: Variable 'days' is assigned a value that is never used. [unreadVariable] - days=0; - ^ -lib/TimeLib/TimeLib.cpp:190:13: style: Variable 'monthLength' is assigned a value that is never used. [unreadVariable] - monthLength=0; - ^ -src/LoRa_APRS_iGate.cpp:59:25: warning: Either the condition 'boardConfig==0' is redundant or there is possible null pointer dereference: boardConfig. [nullPointerRedundantCheck] - userConfig->board = boardConfig->Name; - ^ -src/LoRa_APRS_iGate.cpp:54:21: note: Assuming that condition 'boardConfig==0' is not redundant - if (boardConfig == 0) { - ^ -src/LoRa_APRS_iGate.cpp:59:25: note: Null pointer dereference - userConfig->board = boardConfig->Name; - ^ -src/LoRa_APRS_iGate.cpp:65:13: warning: Either the condition 'boardConfig==0' is redundant or there is possible null pointer dereference: boardConfig. [nullPointerRedundantCheck] - logPrintI(boardConfig->Name); - ^ -src/LoRa_APRS_iGate.cpp:54:21: note: Assuming that condition 'boardConfig==0' is not redundant - if (boardConfig == 0) { - ^ -src/LoRa_APRS_iGate.cpp:65:13: note: Null pointer dereference - logPrintI(boardConfig->Name); - ^ -src/project_configuration.cpp:36:61: style:inconclusive: Boolean expression 'true' is used in bitwise operation. Did you mean '||'? [bitwiseOnBoolean] - conf->display.alwaysOn = data["display"]["always_on"] | true; - ^ -src/project_configuration.cpp:39:59: style:inconclusive: Boolean expression 'true' is used in bitwise operation. Did you mean '||'? [bitwiseOnBoolean] - conf->display.turn180 = data["display"]["turn180"] | true; - ^ -src/project_configuration.cpp:41:44: style:inconclusive: Boolean expression 'false' is used in bitwise operation. Did you mean '||'? [bitwiseOnBoolean] - conf->ftp.active = data["ftp"]["active"] | false; - ^ -lib/PowerManagement/power_management.cpp:28:0: style: The function 'activateGPS' is never used. [unusedFunction] - -^ -lib/TimeLib/TimeLib.cpp:310:0: style: The function 'adjustTime' is never used. [unusedFunction] - -^ -lib/TimeLib/TimeLibString.cpp:53:0: style: The function 'dayShortStr' is never used. [unusedFunction] - -^ -lib/TimeLib/TimeLibString.cpp:42:0: style: The function 'dayStr' is never used. [unusedFunction] - -^ -lib/PowerManagement/power_management.cpp:23:0: style: The function 'deactivateLoRa' is never used. [unusedFunction] - -^ -lib/PowerManagement/power_management.cpp:43:0: style: The function 'decativateOLED' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:558:0: style: The function 'disableInvertIQ' is never used. [unusedFunction] - -^ -lib/Display/Bitmap.cpp:123:0: style: The function 'drawCircle' is never used. [unusedFunction] - -^ -lib/Display/Bitmap.cpp:61:0: style: The function 'drawLine' is never used. [unusedFunction] - -^ -lib/Display/Bitmap.cpp:218:0: style: The function 'drawProgressBar' is never used. [unusedFunction] - -^ -lib/Display/Bitmap.cpp:108:0: style: The function 'drawRect' is never used. [unusedFunction] - -^ -lib/Display/Bitmap.cpp:313:0: style: The function 'drawStringLFf' is never used. [unusedFunction] - -^ -lib/Display/Bitmap.cpp:290:0: style: The function 'drawStringf' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:625:0: style: The function 'dumpRegisters' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:552:0: style: The function 'enableInvertIQ' is never used. [unusedFunction] - -^ -lib/NTPClient/NTPClient.cpp:127:0: style: The function 'getDay' is never used. [unusedFunction] - -^ -lib/NTPClient/NTPClient.cpp:130:0: style: The function 'getHours' is never used. [unusedFunction] - -^ -lib/NTPClient/NTPClient.cpp:133:0: style: The function 'getMinutes' is never used. [unusedFunction] - -^ -lib/Display/Bitmap.cpp:48:0: style: The function 'getPixel' is never used. [unusedFunction] - -^ -lib/NTPClient/NTPClient.cpp:136:0: style: The function 'getSeconds' is never used. [unusedFunction] - -^ -lib/LoRa_APRS/LoRa_APRS.cpp:65:0: style: The function 'getTxFrequency' is never used. [unusedFunction] - -^ -lib/Display/OLEDDisplay.cpp:63:0: style: The function 'invertDisplay' is never used. [unusedFunction] - -^ -lib/TimeLib/TimeLib.cpp:68:0: style: The function 'isAM' is never used. [unusedFunction] - -^ -lib/Display/OLEDDisplay.cpp:114:0: style: The function 'mirrorScreen' is never used. [unusedFunction] - -^ -lib/TimeLib/TimeLibString.cpp:31:0: style: The function 'monthShortStr' is never used. [unusedFunction] - -^ -lib/TimeLib/TimeLibString.cpp:20:0: style: The function 'monthStr' is never used. [unusedFunction] - -^ -lib/Display/OLEDDisplay.cpp:68:0: style: The function 'normalDisplay' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:269:0: style: The function 'packetFrequencyError' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:334:0: style: The function 'peek' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:356:0: style: The function 'receive' is never used. [unusedFunction] - -^ -lib/Display/OLEDDisplay.cpp:102:0: style: The function 'resetOrientation' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:288:0: style: The function 'rssi' is never used. [unusedFunction] - -^ -lib/Display/OLEDDisplay.cpp:86:0: style: The function 'setBrightness' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:577:0: style: The function 'setGain' is never used. [unusedFunction] - -^ -lib/NTPClient/NTPClient.cpp:168:0: style: The function 'setPoolServerName' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:531:0: style: The function 'setPreambleLength' is never used. [unusedFunction] - -^ -lib/NTPClient/NTPClient.cpp:199:0: style: The function 'setRandomPort' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:615:0: style: The function 'setSPI' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:620:0: style: The function 'setSPIFrequency' is never used. [unusedFunction] - -^ -lib/TimeLib/TimeLib.cpp:326:0: style: The function 'setSyncInterval' is never used. [unusedFunction] - -^ -lib/TimeLib/TimeLib.cpp:320:0: style: The function 'setSyncProvider' is never used. [unusedFunction] - -^ -lib/LoRa/LoRa.cpp:537:0: style: The function 'setSyncWord' is never used. [unusedFunction] - -^ -lib/NTPClient/NTPClient.cpp:160:0: style: The function 'setTimeOffset' is never used. [unusedFunction] - -^ -lib/NTPClient/NTPClient.cpp:164:0: style: The function 'setUpdateInterval' is never used. [unusedFunction] - -^ -lib/TimeLib/TimeLib.cpp:315:0: style: The function 'timeStatus' is never used. [unusedFunction] - -^ -nofile:0:0: information: Cppcheck cannot find all the include files (use --check-config for details) [missingIncludeSystem] - From 76ff65e0ef36214fce4ff70fc238beaf9c37f771 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 15 May 2021 17:20:59 +0200 Subject: [PATCH 06/20] Update build_check.yml --- .github/workflows/build_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 894609f..b1f3609 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -85,7 +85,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run Cppcheck - uses: Bedzior/cppcheck-action@v1.0 + uses: Bedzior/cppcheck-action with: enabled checks: all enable inconclusive: true From 7baefa51bb36aff3ff63252a26552c28c30dd00f Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 15 May 2021 17:27:25 +0200 Subject: [PATCH 07/20] Update build_check.yml --- .github/workflows/build_check.yml | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index b1f3609..5bd16a3 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -79,20 +79,20 @@ jobs: clang-format-version: '11' check-path: ${{ matrix.path }} - cppcheck: - name: Run Cppcheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Run Cppcheck - uses: Bedzior/cppcheck-action - with: - enabled checks: all - enable inconclusive: true - generate report: true - - name: Upload report - uses: actions/upload-artifact@v1 - with: - name: report - path: output +# cppcheck: +# name: Run Cppcheck +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - name: Run Cppcheck +# uses: Bedzior/cppcheck-action +# with: +# enabled checks: all +# enable inconclusive: true +# generate report: true +# - name: Upload report +# uses: actions/upload-artifact@v1 +# with: +# name: report +# path: output From 9ef9aff52a2c00bf0ea0883fb7a8d147e86bdfd8 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 15 May 2021 22:19:17 +0200 Subject: [PATCH 08/20] add cppcheck --- .github/workflows/build_check.yml | 42 ++++++++++++++++--------------- .gitignore | 2 ++ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 5bd16a3..69e1efa 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -30,7 +30,8 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v2 - name: Cache pip uses: actions/cache@v2 with: @@ -50,7 +51,8 @@ jobs: pip install --upgrade platformio - name: Run PlatformIO CI run: platformio run - - uses: actions/upload-artifact@v2 + - name: Upload artifacts + uses: actions/upload-artifact@v2 with: name: firmware path: .pio/build/lora_board/firmware.bin @@ -72,27 +74,27 @@ jobs: - 'lib/System' #- 'lib/TimeLib' steps: - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v2 - name: Run clang-format style check for C/C++ programs. uses: jidicula/clang-format-action@v3.2.0 with: clang-format-version: '11' check-path: ${{ matrix.path }} -# cppcheck: -# name: Run Cppcheck -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v2 -# - name: Run Cppcheck -# uses: Bedzior/cppcheck-action -# with: -# enabled checks: all -# enable inconclusive: true -# generate report: true -# - name: Upload report -# uses: actions/upload-artifact@v1 -# with: -# name: report -# path: output - + cppcheck: + name: Run Cppcheck + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v2 + - run: docker pull facthunder/cppcheck:latest + - name: Run Cppcheck + run: docker run --rm -v ${PWD}:/src facthunder/cppcheck:latest cppcheck -v --xml --enable=all . 2> report.xml + - name: Generate HTML report + run: docker run --rm -v ${PWD}:/src facthunder/cppcheck:latest cppcheck-htmlreport --file=report.xml --report-dir=output + - name: Upload report + uses: actions/upload-artifact@v1 + with: + name: Cppcheck Report + path: output diff --git a/.gitignore b/.gitignore index 89cc49c..9f19284 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch +report.xml +output From 0cbf0a560c78a6c3eac4544b1f25a187e921ce15 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 15 May 2021 22:58:15 +0200 Subject: [PATCH 09/20] add message router --- src/LoRa_APRS_iGate.cpp | 9 ++++++-- src/Task.h | 2 ++ src/TaskAprsIs.cpp | 27 +++-------------------- src/TaskAprsIs.h | 8 +++---- src/TaskModem.cpp | 10 ++------- src/TaskModem.h | 5 ++--- src/TaskRouter.cpp | 48 +++++++++++++++++++++++++++++++++++++++++ src/TaskRouter.h | 23 ++++++++++++++++++++ 8 files changed, 90 insertions(+), 42 deletions(-) create mode 100644 src/TaskRouter.cpp create mode 100644 src/TaskRouter.h diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index cc1ff8e..b12443a 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -16,6 +16,7 @@ #include "TaskNTP.h" #include "TaskOTA.h" #include "TaskWifi.h" +#include "TaskRouter.h" #include "project_configuration.h" #define VERSION "21.14.0-dev" @@ -25,6 +26,9 @@ String create_long_aprs(double lng); std::shared_ptr LoRaSystem; +TaskQueue> toAprsIs; +TaskQueue> fromModem; + // cppcheck-suppress unusedFunction void setup() { Serial.begin(115200); @@ -80,7 +84,7 @@ void setup() { LoRaSystem = std::shared_ptr(new System(boardConfig, userConfig)); LoRaSystem->getTaskManager().addTask(std::shared_ptr(new DisplayTask())); - LoRaSystem->getTaskManager().addTask(std::shared_ptr(new ModemTask())); + LoRaSystem->getTaskManager().addTask(std::shared_ptr(new ModemTask(&fromModem))); if (boardConfig->Type == eETH_BOARD) { LoRaSystem->getTaskManager().addAlwaysRunTask(std::shared_ptr(new EthTask())); } else { @@ -91,7 +95,8 @@ void setup() { if (userConfig->ftp.active) { LoRaSystem->getTaskManager().addTask(std::shared_ptr(new FTPTask())); } - LoRaSystem->getTaskManager().addTask(std::shared_ptr(new AprsIsTask())); + LoRaSystem->getTaskManager().addTask(std::shared_ptr(new AprsIsTask(&toAprsIs))); + LoRaSystem->getTaskManager().addTask(std::shared_ptr(new RouterTask(&fromModem, &toAprsIs))); LoRaSystem->getTaskManager().setup(LoRaSystem); diff --git a/src/Task.h b/src/Task.h index bc74fee..b9a1f12 100644 --- a/src/Task.h +++ b/src/Task.h @@ -10,6 +10,7 @@ enum TaskNames TaskNtp, TaskOta, TaskWifi, + TaskRouter, TaskSize, }; @@ -22,5 +23,6 @@ enum TaskNames #define TASK_NTP "NTPTask" #define TASK_OTA "OTATask" #define TASK_WIFI "WifiTask" +#define TASK_ROUTER "RouterTask" #endif diff --git a/src/TaskAprsIs.cpp b/src/TaskAprsIs.cpp index d060043..cb79802 100644 --- a/src/TaskAprsIs.cpp +++ b/src/TaskAprsIs.cpp @@ -5,26 +5,15 @@ #include "TaskAprsIs.h" #include "project_configuration.h" -String create_lat_aprs(double lat); -String create_long_aprs(double lng); - -AprsIsTask::AprsIsTask() : Task(TASK_APRS_IS, TaskAprsIs) { +AprsIsTask::AprsIsTask(TaskQueue> * const toAprsIs) : Task(TASK_APRS_IS, TaskAprsIs), _toAprsIs(toAprsIs) { } AprsIsTask::~AprsIsTask() { } bool AprsIsTask::setup(std::shared_ptr system) { - _beacon_timer.setTimeout(system->getUserConfig()->beacon.timeout * 60 * 1000); _aprs_is = std::shared_ptr(new APRS_IS(system->getUserConfig()->callsign, system->getUserConfig()->aprs_is.passcode, "ESP32-APRS-IS", "0.2")); - _beaconMsg = std::shared_ptr(new APRSMessage()); - _beaconMsg->setSource(system->getUserConfig()->callsign); - _beaconMsg->setDestination("APLG01"); - String lat = create_lat_aprs(system->getUserConfig()->beacon.positionLatitude); - String lng = create_long_aprs(system->getUserConfig()->beacon.positionLongitude); - _beaconMsg->getBody()->setData(String("=") + lat + "L" + lng + "&" + system->getUserConfig()->beacon.message); - return true; } @@ -45,21 +34,11 @@ bool AprsIsTask::loop(std::shared_ptr system) { _aprs_is->getAPRSMessage(); - if (!inputQueue.empty()) { - std::shared_ptr msg = inputQueue.getElement(); + if (!_toAprsIs->empty()) { + std::shared_ptr msg = _toAprsIs->getElement(); _aprs_is->sendMessage(msg); } - if (_beacon_timer.check()) { - logPrintD("[" + timeString() + "] "); - logPrintlnD(_beaconMsg->encode()); - _aprs_is->sendMessage(_beaconMsg); - system->getDisplay().addFrame(std::shared_ptr(new TextFrame("BEACON", _beaconMsg->toString()))); - _beacon_timer.start(); - } - time_t diff = _beacon_timer.getTriggerTimeInSec(); - _stateInfo = "beacon " + String(diff / 60) + ":" + String(diff % 60); - _state = Okay; return true; } diff --git a/src/TaskAprsIs.h b/src/TaskAprsIs.h index 67b1d31..4e38615 100644 --- a/src/TaskAprsIs.h +++ b/src/TaskAprsIs.h @@ -8,18 +8,16 @@ class AprsIsTask : public Task { public: - AprsIsTask(); + AprsIsTask(TaskQueue> * const toAprsIs); virtual ~AprsIsTask(); virtual bool setup(std::shared_ptr system) override; virtual bool loop(std::shared_ptr system) override; - TaskQueue> inputQueue; - private: std::shared_ptr _aprs_is; - std::shared_ptr _beaconMsg; - Timer _beacon_timer; + + TaskQueue> * const _toAprsIs; bool connect(std::shared_ptr system); }; diff --git a/src/TaskModem.cpp b/src/TaskModem.cpp index c02a568..6b78738 100644 --- a/src/TaskModem.cpp +++ b/src/TaskModem.cpp @@ -6,7 +6,7 @@ #include "TaskModem.h" #include "project_configuration.h" -ModemTask::ModemTask() : Task(TASK_MODEM, TaskModem) { +ModemTask::ModemTask(TaskQueue> * const fromModem) : Task(TASK_MODEM, TaskModem), _fromModem(fromModem) { } ModemTask::~ModemTask() { @@ -55,15 +55,9 @@ bool ModemTask::loop(std::shared_ptr system) { } msg->setPath(path + "qAR," + system->getUserConfig()->callsign); - std::shared_ptr is_thread = std::static_pointer_cast(system->getTaskManager().getTask(TASK_APRS_IS)); - is_thread->inputQueue.addElement(msg); + _fromModem->addElement(msg); system->getDisplay().addFrame(std::shared_ptr(new TextFrame("LoRa", msg->toString()))); } - if (!inputQueue.empty()) { - std::shared_ptr msg = inputQueue.getElement(); - _lora_aprs->sendMessage(msg); - } - return true; } diff --git a/src/TaskModem.h b/src/TaskModem.h index 84e125c..8be2403 100644 --- a/src/TaskModem.h +++ b/src/TaskModem.h @@ -7,16 +7,15 @@ class ModemTask : public Task { public: - ModemTask(); + ModemTask(TaskQueue> * const fromModem); virtual ~ModemTask(); virtual bool setup(std::shared_ptr system) override; virtual bool loop(std::shared_ptr system) override; - TaskQueue> inputQueue; - private: std::shared_ptr _lora_aprs; + TaskQueue> * const _fromModem; }; #endif diff --git a/src/TaskRouter.cpp b/src/TaskRouter.cpp new file mode 100644 index 0000000..4b983d9 --- /dev/null +++ b/src/TaskRouter.cpp @@ -0,0 +1,48 @@ +#include + +#include "Task.h" +#include "TaskRouter.h" +#include "project_configuration.h" + +String create_lat_aprs(double lat); +String create_long_aprs(double lng); + +RouterTask::RouterTask(TaskQueue> * const fromModem, TaskQueue> * const toAprsIs) +: Task(TASK_ROUTER, TaskRouter), _fromModem(fromModem), _toAprsIs(toAprsIs) { +} + +RouterTask::~RouterTask() { +} + +bool RouterTask::setup(std::shared_ptr system) { + // setup beacon + _beacon_timer.setTimeout(system->getUserConfig()->beacon.timeout * 60 * 1000); + _beaconMsg = std::shared_ptr(new APRSMessage()); + _beaconMsg->setSource(system->getUserConfig()->callsign); + _beaconMsg->setDestination("APLG01"); + String lat = create_lat_aprs(system->getUserConfig()->beacon.positionLatitude); + String lng = create_long_aprs(system->getUserConfig()->beacon.positionLongitude); + _beaconMsg->getBody()->setData(String("=") + lat + "L" + lng + "&" + system->getUserConfig()->beacon.message); + + return true; +} + +bool RouterTask::loop(std::shared_ptr system) { + // do routing + if(!_fromModem->empty()) + { + _toAprsIs->addElement(_fromModem->getElement()); + } + + // check for beacon + if (_beacon_timer.check()) { + logPrintD("[" + timeString() + "] "); + logPrintlnD(_beaconMsg->encode()); + _toAprsIs->addElement(_beaconMsg); + system->getDisplay().addFrame(std::shared_ptr(new TextFrame("BEACON", _beaconMsg->toString()))); + _beacon_timer.start(); + } + time_t diff = _beacon_timer.getTriggerTimeInSec(); + _stateInfo = "beacon " + String(diff / 60) + ":" + String(diff % 60); + return true; +} diff --git a/src/TaskRouter.h b/src/TaskRouter.h new file mode 100644 index 0000000..1888ea3 --- /dev/null +++ b/src/TaskRouter.h @@ -0,0 +1,23 @@ +#ifndef TASK_ROUTER_H_ +#define TASK_ROUTER_H_ + +#include +#include + +class RouterTask : public Task { +public: + RouterTask(TaskQueue> * const fromModem, TaskQueue> * const toAprsIs); + virtual ~RouterTask(); + + virtual bool setup(std::shared_ptr system) override; + virtual bool loop(std::shared_ptr system) override; + +private: + TaskQueue> * const _fromModem; + TaskQueue> * const _toAprsIs; + + std::shared_ptr _beaconMsg; + Timer _beacon_timer; +}; + +#endif From a5dbb9fd778893f06afaba4427f31f47fe18861d Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 15 May 2021 23:10:24 +0200 Subject: [PATCH 10/20] clang-format --- src/LoRa_APRS_iGate.cpp | 2 +- src/TaskAprsIs.cpp | 2 +- src/TaskAprsIs.h | 6 +++--- src/TaskModem.cpp | 2 +- src/TaskModem.h | 6 +++--- src/TaskRouter.cpp | 6 ++---- src/TaskRouter.h | 10 +++++----- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index b12443a..18e9d48 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -15,8 +15,8 @@ #include "TaskModem.h" #include "TaskNTP.h" #include "TaskOTA.h" -#include "TaskWifi.h" #include "TaskRouter.h" +#include "TaskWifi.h" #include "project_configuration.h" #define VERSION "21.14.0-dev" diff --git a/src/TaskAprsIs.cpp b/src/TaskAprsIs.cpp index cb79802..c7c0ca3 100644 --- a/src/TaskAprsIs.cpp +++ b/src/TaskAprsIs.cpp @@ -5,7 +5,7 @@ #include "TaskAprsIs.h" #include "project_configuration.h" -AprsIsTask::AprsIsTask(TaskQueue> * const toAprsIs) : Task(TASK_APRS_IS, TaskAprsIs), _toAprsIs(toAprsIs) { +AprsIsTask::AprsIsTask(TaskQueue> *const toAprsIs) : Task(TASK_APRS_IS, TaskAprsIs), _toAprsIs(toAprsIs) { } AprsIsTask::~AprsIsTask() { diff --git a/src/TaskAprsIs.h b/src/TaskAprsIs.h index 4e38615..229e113 100644 --- a/src/TaskAprsIs.h +++ b/src/TaskAprsIs.h @@ -8,16 +8,16 @@ class AprsIsTask : public Task { public: - AprsIsTask(TaskQueue> * const toAprsIs); + AprsIsTask(TaskQueue> *const toAprsIs); virtual ~AprsIsTask(); virtual bool setup(std::shared_ptr system) override; virtual bool loop(std::shared_ptr system) override; private: - std::shared_ptr _aprs_is; + std::shared_ptr _aprs_is; - TaskQueue> * const _toAprsIs; + TaskQueue> *const _toAprsIs; bool connect(std::shared_ptr system); }; diff --git a/src/TaskModem.cpp b/src/TaskModem.cpp index 6b78738..17dafe9 100644 --- a/src/TaskModem.cpp +++ b/src/TaskModem.cpp @@ -6,7 +6,7 @@ #include "TaskModem.h" #include "project_configuration.h" -ModemTask::ModemTask(TaskQueue> * const fromModem) : Task(TASK_MODEM, TaskModem), _fromModem(fromModem) { +ModemTask::ModemTask(TaskQueue> *const fromModem) : Task(TASK_MODEM, TaskModem), _fromModem(fromModem) { } ModemTask::~ModemTask() { diff --git a/src/TaskModem.h b/src/TaskModem.h index 8be2403..ebedcbb 100644 --- a/src/TaskModem.h +++ b/src/TaskModem.h @@ -7,15 +7,15 @@ class ModemTask : public Task { public: - ModemTask(TaskQueue> * const fromModem); + ModemTask(TaskQueue> *const fromModem); virtual ~ModemTask(); virtual bool setup(std::shared_ptr system) override; virtual bool loop(std::shared_ptr system) override; private: - std::shared_ptr _lora_aprs; - TaskQueue> * const _fromModem; + std::shared_ptr _lora_aprs; + TaskQueue> *const _fromModem; }; #endif diff --git a/src/TaskRouter.cpp b/src/TaskRouter.cpp index 4b983d9..59fcb63 100644 --- a/src/TaskRouter.cpp +++ b/src/TaskRouter.cpp @@ -7,8 +7,7 @@ String create_lat_aprs(double lat); String create_long_aprs(double lng); -RouterTask::RouterTask(TaskQueue> * const fromModem, TaskQueue> * const toAprsIs) -: Task(TASK_ROUTER, TaskRouter), _fromModem(fromModem), _toAprsIs(toAprsIs) { +RouterTask::RouterTask(TaskQueue> *const fromModem, TaskQueue> *const toAprsIs) : Task(TASK_ROUTER, TaskRouter), _fromModem(fromModem), _toAprsIs(toAprsIs) { } RouterTask::~RouterTask() { @@ -29,8 +28,7 @@ bool RouterTask::setup(std::shared_ptr system) { bool RouterTask::loop(std::shared_ptr system) { // do routing - if(!_fromModem->empty()) - { + if (!_fromModem->empty()) { _toAprsIs->addElement(_fromModem->getElement()); } diff --git a/src/TaskRouter.h b/src/TaskRouter.h index 1888ea3..e673be6 100644 --- a/src/TaskRouter.h +++ b/src/TaskRouter.h @@ -1,21 +1,21 @@ #ifndef TASK_ROUTER_H_ #define TASK_ROUTER_H_ -#include #include +#include class RouterTask : public Task { public: - RouterTask(TaskQueue> * const fromModem, TaskQueue> * const toAprsIs); + RouterTask(TaskQueue> *const fromModem, TaskQueue> *const toAprsIs); virtual ~RouterTask(); virtual bool setup(std::shared_ptr system) override; virtual bool loop(std::shared_ptr system) override; private: - TaskQueue> * const _fromModem; - TaskQueue> * const _toAprsIs; - + TaskQueue> *const _fromModem; + TaskQueue> *const _toAprsIs; + std::shared_ptr _beaconMsg; Timer _beacon_timer; }; From 0396db7d951b2d300178de536e8ac93ee1af8901 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sun, 16 May 2021 03:52:28 +0200 Subject: [PATCH 11/20] change pointers to references --- src/LoRa_APRS_iGate.cpp | 6 +++--- src/TaskAprsIs.cpp | 6 +++--- src/TaskAprsIs.h | 4 ++-- src/TaskModem.cpp | 4 ++-- src/TaskModem.h | 4 ++-- src/TaskRouter.cpp | 9 +++++---- src/TaskRouter.h | 6 +++--- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 18e9d48..354dab9 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -84,7 +84,7 @@ void setup() { LoRaSystem = std::shared_ptr(new System(boardConfig, userConfig)); LoRaSystem->getTaskManager().addTask(std::shared_ptr(new DisplayTask())); - LoRaSystem->getTaskManager().addTask(std::shared_ptr(new ModemTask(&fromModem))); + LoRaSystem->getTaskManager().addTask(std::shared_ptr(new ModemTask(fromModem))); if (boardConfig->Type == eETH_BOARD) { LoRaSystem->getTaskManager().addAlwaysRunTask(std::shared_ptr(new EthTask())); } else { @@ -95,8 +95,8 @@ void setup() { if (userConfig->ftp.active) { LoRaSystem->getTaskManager().addTask(std::shared_ptr(new FTPTask())); } - LoRaSystem->getTaskManager().addTask(std::shared_ptr(new AprsIsTask(&toAprsIs))); - LoRaSystem->getTaskManager().addTask(std::shared_ptr(new RouterTask(&fromModem, &toAprsIs))); + LoRaSystem->getTaskManager().addTask(std::shared_ptr(new AprsIsTask(toAprsIs))); + LoRaSystem->getTaskManager().addTask(std::shared_ptr(new RouterTask(fromModem, toAprsIs))); LoRaSystem->getTaskManager().setup(LoRaSystem); diff --git a/src/TaskAprsIs.cpp b/src/TaskAprsIs.cpp index c7c0ca3..67051f8 100644 --- a/src/TaskAprsIs.cpp +++ b/src/TaskAprsIs.cpp @@ -5,7 +5,7 @@ #include "TaskAprsIs.h" #include "project_configuration.h" -AprsIsTask::AprsIsTask(TaskQueue> *const toAprsIs) : Task(TASK_APRS_IS, TaskAprsIs), _toAprsIs(toAprsIs) { +AprsIsTask::AprsIsTask(TaskQueue> & toAprsIs) : Task(TASK_APRS_IS, TaskAprsIs), _toAprsIs(toAprsIs) { } AprsIsTask::~AprsIsTask() { @@ -34,8 +34,8 @@ bool AprsIsTask::loop(std::shared_ptr system) { _aprs_is->getAPRSMessage(); - if (!_toAprsIs->empty()) { - std::shared_ptr msg = _toAprsIs->getElement(); + if (!_toAprsIs.empty()) { + std::shared_ptr msg = _toAprsIs.getElement(); _aprs_is->sendMessage(msg); } diff --git a/src/TaskAprsIs.h b/src/TaskAprsIs.h index 229e113..43dcc07 100644 --- a/src/TaskAprsIs.h +++ b/src/TaskAprsIs.h @@ -8,7 +8,7 @@ class AprsIsTask : public Task { public: - AprsIsTask(TaskQueue> *const toAprsIs); + AprsIsTask(TaskQueue> & toAprsIs); virtual ~AprsIsTask(); virtual bool setup(std::shared_ptr system) override; @@ -17,7 +17,7 @@ public: private: std::shared_ptr _aprs_is; - TaskQueue> *const _toAprsIs; + TaskQueue> & _toAprsIs; bool connect(std::shared_ptr system); }; diff --git a/src/TaskModem.cpp b/src/TaskModem.cpp index 17dafe9..4504e53 100644 --- a/src/TaskModem.cpp +++ b/src/TaskModem.cpp @@ -6,7 +6,7 @@ #include "TaskModem.h" #include "project_configuration.h" -ModemTask::ModemTask(TaskQueue> *const fromModem) : Task(TASK_MODEM, TaskModem), _fromModem(fromModem) { +ModemTask::ModemTask(TaskQueue> & fromModem) : Task(TASK_MODEM, TaskModem), _fromModem(fromModem) { } ModemTask::~ModemTask() { @@ -55,7 +55,7 @@ bool ModemTask::loop(std::shared_ptr system) { } msg->setPath(path + "qAR," + system->getUserConfig()->callsign); - _fromModem->addElement(msg); + _fromModem.addElement(msg); system->getDisplay().addFrame(std::shared_ptr(new TextFrame("LoRa", msg->toString()))); } diff --git a/src/TaskModem.h b/src/TaskModem.h index ebedcbb..6e6e97b 100644 --- a/src/TaskModem.h +++ b/src/TaskModem.h @@ -7,7 +7,7 @@ class ModemTask : public Task { public: - ModemTask(TaskQueue> *const fromModem); + ModemTask(TaskQueue> & fromModem); virtual ~ModemTask(); virtual bool setup(std::shared_ptr system) override; @@ -15,7 +15,7 @@ public: private: std::shared_ptr _lora_aprs; - TaskQueue> *const _fromModem; + TaskQueue> & _fromModem; }; #endif diff --git a/src/TaskRouter.cpp b/src/TaskRouter.cpp index 59fcb63..0703aa1 100644 --- a/src/TaskRouter.cpp +++ b/src/TaskRouter.cpp @@ -7,7 +7,8 @@ String create_lat_aprs(double lat); String create_long_aprs(double lng); -RouterTask::RouterTask(TaskQueue> *const fromModem, TaskQueue> *const toAprsIs) : Task(TASK_ROUTER, TaskRouter), _fromModem(fromModem), _toAprsIs(toAprsIs) { +RouterTask::RouterTask(TaskQueue> & fromModem, TaskQueue> * +& toAprsIs) : Task(TASK_ROUTER, TaskRouter), _fromModem(fromModem), _toAprsIs(toAprsIs) { } RouterTask::~RouterTask() { @@ -28,15 +29,15 @@ bool RouterTask::setup(std::shared_ptr system) { bool RouterTask::loop(std::shared_ptr system) { // do routing - if (!_fromModem->empty()) { - _toAprsIs->addElement(_fromModem->getElement()); + if (!_fromModem.empty()) { + _toAprsIs.addElement(_fromModem->getElement()); } // check for beacon if (_beacon_timer.check()) { logPrintD("[" + timeString() + "] "); logPrintlnD(_beaconMsg->encode()); - _toAprsIs->addElement(_beaconMsg); + _toAprsIs.addElement(_beaconMsg); system->getDisplay().addFrame(std::shared_ptr(new TextFrame("BEACON", _beaconMsg->toString()))); _beacon_timer.start(); } diff --git a/src/TaskRouter.h b/src/TaskRouter.h index e673be6..e42d8f0 100644 --- a/src/TaskRouter.h +++ b/src/TaskRouter.h @@ -6,15 +6,15 @@ class RouterTask : public Task { public: - RouterTask(TaskQueue> *const fromModem, TaskQueue> *const toAprsIs); + RouterTask(TaskQueue> & fromModem, TaskQueue> & toAprsIs); virtual ~RouterTask(); virtual bool setup(std::shared_ptr system) override; virtual bool loop(std::shared_ptr system) override; private: - TaskQueue> *const _fromModem; - TaskQueue> *const _toAprsIs; + TaskQueue> & _fromModem; + TaskQueue> & _toAprsIs; std::shared_ptr _beaconMsg; Timer _beacon_timer; From 2c326337557a909105aef344eccddf6a23a5e927 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sun, 16 May 2021 03:56:53 +0200 Subject: [PATCH 12/20] fix --- src/TaskRouter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/TaskRouter.cpp b/src/TaskRouter.cpp index 0703aa1..c232c9d 100644 --- a/src/TaskRouter.cpp +++ b/src/TaskRouter.cpp @@ -7,8 +7,7 @@ String create_lat_aprs(double lat); String create_long_aprs(double lng); -RouterTask::RouterTask(TaskQueue> & fromModem, TaskQueue> * -& toAprsIs) : Task(TASK_ROUTER, TaskRouter), _fromModem(fromModem), _toAprsIs(toAprsIs) { +RouterTask::RouterTask(TaskQueue> & fromModem, TaskQueue> & toAprsIs) : Task(TASK_ROUTER, TaskRouter), _fromModem(fromModem), _toAprsIs(toAprsIs) { } RouterTask::~RouterTask() { From f745e5f710509ea2070f64b0965e1672e654e2c6 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sun, 16 May 2021 03:59:28 +0200 Subject: [PATCH 13/20] fix --- src/TaskRouter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TaskRouter.cpp b/src/TaskRouter.cpp index c232c9d..7bf5207 100644 --- a/src/TaskRouter.cpp +++ b/src/TaskRouter.cpp @@ -29,7 +29,7 @@ bool RouterTask::setup(std::shared_ptr system) { bool RouterTask::loop(std::shared_ptr system) { // do routing if (!_fromModem.empty()) { - _toAprsIs.addElement(_fromModem->getElement()); + _toAprsIs.addElement(_fromModem.getElement()); } // check for beacon From 4c0200c05e89fe12425a0a12fd53792d7c347b0f Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sun, 16 May 2021 08:40:44 +0200 Subject: [PATCH 14/20] fixing the linter --- src/TaskAprsIs.cpp | 2 +- src/TaskAprsIs.h | 4 ++-- src/TaskModem.cpp | 2 +- src/TaskModem.h | 6 +++--- src/TaskRouter.cpp | 2 +- src/TaskRouter.h | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/TaskAprsIs.cpp b/src/TaskAprsIs.cpp index 67051f8..b03c2e0 100644 --- a/src/TaskAprsIs.cpp +++ b/src/TaskAprsIs.cpp @@ -5,7 +5,7 @@ #include "TaskAprsIs.h" #include "project_configuration.h" -AprsIsTask::AprsIsTask(TaskQueue> & toAprsIs) : Task(TASK_APRS_IS, TaskAprsIs), _toAprsIs(toAprsIs) { +AprsIsTask::AprsIsTask(TaskQueue> &toAprsIs) : Task(TASK_APRS_IS, TaskAprsIs), _toAprsIs(toAprsIs) { } AprsIsTask::~AprsIsTask() { diff --git a/src/TaskAprsIs.h b/src/TaskAprsIs.h index 43dcc07..2466996 100644 --- a/src/TaskAprsIs.h +++ b/src/TaskAprsIs.h @@ -8,7 +8,7 @@ class AprsIsTask : public Task { public: - AprsIsTask(TaskQueue> & toAprsIs); + AprsIsTask(TaskQueue> &toAprsIs); virtual ~AprsIsTask(); virtual bool setup(std::shared_ptr system) override; @@ -17,7 +17,7 @@ public: private: std::shared_ptr _aprs_is; - TaskQueue> & _toAprsIs; + TaskQueue> &_toAprsIs; bool connect(std::shared_ptr system); }; diff --git a/src/TaskModem.cpp b/src/TaskModem.cpp index 4504e53..a7590a2 100644 --- a/src/TaskModem.cpp +++ b/src/TaskModem.cpp @@ -6,7 +6,7 @@ #include "TaskModem.h" #include "project_configuration.h" -ModemTask::ModemTask(TaskQueue> & fromModem) : Task(TASK_MODEM, TaskModem), _fromModem(fromModem) { +ModemTask::ModemTask(TaskQueue> &fromModem) : Task(TASK_MODEM, TaskModem), _fromModem(fromModem) { } ModemTask::~ModemTask() { diff --git a/src/TaskModem.h b/src/TaskModem.h index 6e6e97b..95010b0 100644 --- a/src/TaskModem.h +++ b/src/TaskModem.h @@ -7,15 +7,15 @@ class ModemTask : public Task { public: - ModemTask(TaskQueue> & fromModem); + ModemTask(TaskQueue> &fromModem); virtual ~ModemTask(); virtual bool setup(std::shared_ptr system) override; virtual bool loop(std::shared_ptr system) override; private: - std::shared_ptr _lora_aprs; - TaskQueue> & _fromModem; + std::shared_ptr _lora_aprs; + TaskQueue> &_fromModem; }; #endif diff --git a/src/TaskRouter.cpp b/src/TaskRouter.cpp index 7bf5207..1bcf7b8 100644 --- a/src/TaskRouter.cpp +++ b/src/TaskRouter.cpp @@ -7,7 +7,7 @@ String create_lat_aprs(double lat); String create_long_aprs(double lng); -RouterTask::RouterTask(TaskQueue> & fromModem, TaskQueue> & toAprsIs) : Task(TASK_ROUTER, TaskRouter), _fromModem(fromModem), _toAprsIs(toAprsIs) { +RouterTask::RouterTask(TaskQueue> &fromModem, TaskQueue> &toAprsIs) : Task(TASK_ROUTER, TaskRouter), _fromModem(fromModem), _toAprsIs(toAprsIs) { } RouterTask::~RouterTask() { diff --git a/src/TaskRouter.h b/src/TaskRouter.h index e42d8f0..0ed8092 100644 --- a/src/TaskRouter.h +++ b/src/TaskRouter.h @@ -6,15 +6,15 @@ class RouterTask : public Task { public: - RouterTask(TaskQueue> & fromModem, TaskQueue> & toAprsIs); + RouterTask(TaskQueue> &fromModem, TaskQueue> &toAprsIs); virtual ~RouterTask(); virtual bool setup(std::shared_ptr system) override; virtual bool loop(std::shared_ptr system) override; private: - TaskQueue> & _fromModem; - TaskQueue> & _toAprsIs; + TaskQueue> &_fromModem; + TaskQueue> &_toAprsIs; std::shared_ptr _beaconMsg; Timer _beacon_timer; From b88bc534a7614dd24e605bc6506f96397769b402 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 17 May 2021 10:02:22 +0200 Subject: [PATCH 15/20] remove cache --- .github/workflows/build_check.yml | 35 ------------------------------- 1 file changed, 35 deletions(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 69e1efa..0785dee 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -3,46 +3,11 @@ name: push pull checks on: [push, pull_request] jobs: - #check: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Cache pip - # uses: actions/cache@v2 - # with: - # path: ~/.cache/pip - # key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - # restore-keys: ${{ runner.os }}-pip- - # - name: Cache PlatformIO - # uses: actions/cache@v2 - # with: - # path: ~/.platformio - # key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - # - name: Set up Python - # uses: actions/setup-python@v2 - # - name: Install PlatformIO - # run: | - # python -m pip install --upgrade pip - # pip install --upgrade platformio - # - name: Run PlatformIO Check - # run: platformio check --fail-on-defect low --fail-on-defect medium --fail-on-defect high - build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - - name: Cache pip - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: ${{ runner.os }}-pip- - - name: Cache PlatformIO - uses: actions/cache@v2 - with: - path: ~/.platformio - key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python uses: actions/setup-python@v2 - name: Install PlatformIO From 445f7cc9d95f4f2636b98d301a0c3598f306c8d1 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 17 May 2021 10:02:36 +0200 Subject: [PATCH 16/20] simplify platformio install --- .github/workflows/build_check.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 0785dee..06a6057 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -11,9 +11,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 - name: Install PlatformIO - run: | - python -m pip install --upgrade pip - pip install --upgrade platformio + run: python -m pip install --upgrade pip platformio - name: Run PlatformIO CI run: platformio run - name: Upload artifacts From 55d13549c623f2f4c13287c034c2c7411ac3054e Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 17 May 2021 10:04:05 +0200 Subject: [PATCH 17/20] rename tests --- .github/workflows/build_check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 06a6057..2938001 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -1,9 +1,10 @@ -name: push pull checks +name: Integreation Tests on: [push, pull_request] jobs: build: + name: Compile Firmware runs-on: ubuntu-latest steps: - name: Checkout code From f8038eb4f34a6d1192daac1f33b6abaea7f6cf01 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 17 May 2021 10:28:27 +0200 Subject: [PATCH 18/20] cppcheck update --- .github/workflows/build_check.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 2938001..6bd8d93 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -47,16 +47,18 @@ jobs: check-path: ${{ matrix.path }} cppcheck: - name: Run Cppcheck + name: Run cppcheck runs-on: ubuntu-latest + env: + CPPCHECK_ARGS: -v --enable=all . steps: - name: checkout code uses: actions/checkout@v2 - run: docker pull facthunder/cppcheck:latest - - name: Run Cppcheck - run: docker run --rm -v ${PWD}:/src facthunder/cppcheck:latest cppcheck -v --xml --enable=all . 2> report.xml - - name: Generate HTML report - run: docker run --rm -v ${PWD}:/src facthunder/cppcheck:latest cppcheck-htmlreport --file=report.xml --report-dir=output + - name: Run cppcheck and print result + run: docker run --rm -v ${PWD}:/src facthunder/cppcheck:latest /bin/bash -c "cppcheck $CPPCHECK_ARGS" + - name: Run cppcheck and create html + run: docker run --rm -v ${PWD}:/src facthunder/cppcheck:latest /bin/bash -c "cppcheck --xml $CPPCHECK_ARGS 2> report.xml && cppcheck-htmlreport --file=report.xml --report-dir=output" - name: Upload report uses: actions/upload-artifact@v1 with: From 9c21cda3c556569908072006d7e18efefaa400f9 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Wed, 19 May 2021 00:12:34 +0200 Subject: [PATCH 19/20] update cppcheck arguments --- .github/workflows/build_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 6bd8d93..98b7038 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -50,7 +50,7 @@ jobs: name: Run cppcheck runs-on: ubuntu-latest env: - CPPCHECK_ARGS: -v --enable=all . + CPPCHECK_ARGS: --enable=all --std=c++14 -I lib/BoardFinder -I lib/ConfigurationManagement -I lib/Display -I lib/LoRa -I lib/LoRa_APRS -I lib/NTPClient -I lib/PowerManagement -I lib/System -I lib/TimeLib -i lib/Display -i lib/LoRa -i lib/NTPClient -i lib/TimeLib src lib steps: - name: checkout code uses: actions/checkout@v2 From c6d73c33b271676fecad05247781944ca34fa43c Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Wed, 19 May 2021 00:27:27 +0200 Subject: [PATCH 20/20] cppcheck fix --- .github/workflows/build_check.yml | 2 +- src/TaskAprsIs.h | 2 +- src/TaskModem.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 98b7038..542fe65 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -50,7 +50,7 @@ jobs: name: Run cppcheck runs-on: ubuntu-latest env: - CPPCHECK_ARGS: --enable=all --std=c++14 -I lib/BoardFinder -I lib/ConfigurationManagement -I lib/Display -I lib/LoRa -I lib/LoRa_APRS -I lib/NTPClient -I lib/PowerManagement -I lib/System -I lib/TimeLib -i lib/Display -i lib/LoRa -i lib/NTPClient -i lib/TimeLib src lib + CPPCHECK_ARGS: --enable=all --std=c++14 --inline-suppr -I lib/BoardFinder -I lib/ConfigurationManagement -I lib/Display -I lib/LoRa -I lib/LoRa_APRS -I lib/NTPClient -I lib/PowerManagement -I lib/System -I lib/TimeLib -i lib/Display -i lib/LoRa -i lib/NTPClient -i lib/TimeLib src lib steps: - name: checkout code uses: actions/checkout@v2 diff --git a/src/TaskAprsIs.h b/src/TaskAprsIs.h index 2466996..69fd66d 100644 --- a/src/TaskAprsIs.h +++ b/src/TaskAprsIs.h @@ -8,7 +8,7 @@ class AprsIsTask : public Task { public: - AprsIsTask(TaskQueue> &toAprsIs); + explicit AprsIsTask(TaskQueue> &toAprsIs); virtual ~AprsIsTask(); virtual bool setup(std::shared_ptr system) override; diff --git a/src/TaskModem.h b/src/TaskModem.h index 95010b0..7d324fd 100644 --- a/src/TaskModem.h +++ b/src/TaskModem.h @@ -7,7 +7,7 @@ class ModemTask : public Task { public: - ModemTask(TaskQueue> &fromModem); + explicit ModemTask(TaskQueue> &fromModem); virtual ~ModemTask(); virtual bool setup(std::shared_ptr system) override;