From 3920d3390912b35109501e00fdbcbbddcbc10ad3 Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 25 Mar 2024 18:35:21 +0100 Subject: [PATCH 1/7] Update CI for new LoRaWAN examples --- .github/workflows/main.yml | 14 +++++++++++++- examples/LoRaWAN/LoRaWAN_ABP/configABP.h | 2 +- examples/LoRaWAN/LoRaWAN_Reference/config.h | 2 +- examples/LoRaWAN/LoRaWAN_Starter/config.h | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 12c45391c..c926cc46a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -104,6 +104,8 @@ jobs: run: echo "index-url=--additional-urls https://resource.heltec.cn/download/package_CubeCell_index.json" >> $GITHUB_OUTPUT - id: MegaCore:avr:1281 run: echo "index-url=--additional-urls https://mcudude.github.io/MegaCore/package_MCUdude_MegaCore_index.json" >> $GITHUB_OUTPUT + - id: teensy:avr:teensy41 + run: echo "index-url=--additional-urls https://www.pjrc.com/teensy/td_156/package_teensy_index.json" >> $GITHUB_OUTPUT - id: arduino:renesas_uno:minima runs-on: ubuntu-latest @@ -162,9 +164,19 @@ jobs: # skip sketch echo -e "\n\033[1;33mSkipped ${example##*/} (matched with ${{ steps.prep.outputs.skip-pattern }})\033[0m"; else + # apply special flags for LoRaWAN + if [[ ${example} =~ "LoRaWAN" ]]; then + flags=\ + '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_DEV_ADDR=0\" '\ + '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_NWKS_KEY=0\" '\ + '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_SNWKSINT_KEY=0\" '\ + '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_NWKSENC_KEY=0\" '\ + '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_APPS_KEY=0\" ' + fi + # build sketch echo -e "\n\033[1;33mBuilding ${example##*/} ... \033[0m"; - arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn ${{ matrix.id }}${{ steps.prep.outputs.options }} $example --warnings=${{ steps.prep.outputs.warnings }} + arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn ${{ matrix.id }}${{ steps.prep.outputs.options }} $flags $example --warnings=${{ steps.prep.outputs.warnings }} if [ $? -ne 0 ]; then echo -e "\033[1;31m${example##*/} build FAILED\033[0m\n"; exit 1; diff --git a/examples/LoRaWAN/LoRaWAN_ABP/configABP.h b/examples/LoRaWAN/LoRaWAN_ABP/configABP.h index 33fd9fa0d..649136788 100644 --- a/examples/LoRaWAN/LoRaWAN_ABP/configABP.h +++ b/examples/LoRaWAN/LoRaWAN_ABP/configABP.h @@ -95,7 +95,7 @@ const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0 // SX1262 radio = new Module(8, 14, 12, 13); // SX1278 pin order: Module(NSS/CS, DIO0, RESET, DIO1); - // SX1278 radio = new Module(10, 2, 9, 3); + SX1278 radio = new Module(10, 2, 9, 3); #endif diff --git a/examples/LoRaWAN/LoRaWAN_Reference/config.h b/examples/LoRaWAN/LoRaWAN_Reference/config.h index bba38e4fe..08322a339 100644 --- a/examples/LoRaWAN/LoRaWAN_Reference/config.h +++ b/examples/LoRaWAN/LoRaWAN_Reference/config.h @@ -92,7 +92,7 @@ const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0 // SX1262 radio = new Module(8, 14, 12, 13); // SX1278 pin order: Module(NSS/CS, DIO0, RESET, DIO1); - // SX1278 radio = new Module(10, 2, 9, 3); + SX1278 radio = new Module(10, 2, 9, 3); #endif diff --git a/examples/LoRaWAN/LoRaWAN_Starter/config.h b/examples/LoRaWAN/LoRaWAN_Starter/config.h index bba38e4fe..08322a339 100644 --- a/examples/LoRaWAN/LoRaWAN_Starter/config.h +++ b/examples/LoRaWAN/LoRaWAN_Starter/config.h @@ -92,7 +92,7 @@ const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0 // SX1262 radio = new Module(8, 14, 12, 13); // SX1278 pin order: Module(NSS/CS, DIO0, RESET, DIO1); - // SX1278 radio = new Module(10, 2, 9, 3); + SX1278 radio = new Module(10, 2, 9, 3); #endif From 1f913a6f74c16ce32d0c3f12cab1daf864d7092a Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 25 Mar 2024 18:50:22 +0100 Subject: [PATCH 2/7] Use single line for flags --- .github/workflows/main.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c926cc46a..f8617d3aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -166,12 +166,7 @@ jobs: else # apply special flags for LoRaWAN if [[ ${example} =~ "LoRaWAN" ]]; then - flags=\ - '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_DEV_ADDR=0\" '\ - '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_NWKS_KEY=0\" '\ - '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_SNWKSINT_KEY=0\" '\ - '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_NWKSENC_KEY=0\" '\ - '--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_APPS_KEY=0\" ' + flags="--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_DEV_ADDR=0\" --build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_NWKS_KEY=0\" --build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_SNWKSINT_KEY=0\" --build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_NWKSENC_KEY=0\" --build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_APPS_KEY=0\"" fi # build sketch From 2210b61ef5a95d276a2392b30afaa0063ff39ef9 Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 25 Mar 2024 19:13:09 +0100 Subject: [PATCH 3/7] Fixup flag strings --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f8617d3aa..b8a629344 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -166,12 +166,12 @@ jobs: else # apply special flags for LoRaWAN if [[ ${example} =~ "LoRaWAN" ]]; then - flags="--build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_DEV_ADDR=0\" --build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_NWKS_KEY=0\" --build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_SNWKSINT_KEY=0\" --build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_NWKSENC_KEY=0\" --build-property compiler.cpp.extra_flags=\"-DRADIOLIB_LORAWAN_APPS_KEY=0\"" + flags="-DRADIOLIB_LORAWAN_DEV_ADDR=0 -DRADIOLIB_LORAWAN_NWKS_KEY=0 -DRADIOLIB_LORAWAN_SNWKSINT_KEY=0 -DRADIOLIB_LORAWAN_NWKSENC_KEY=0 -DRADIOLIB_LORAWAN_APPS_KEY=0" fi # build sketch echo -e "\n\033[1;33mBuilding ${example##*/} ... \033[0m"; - arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn ${{ matrix.id }}${{ steps.prep.outputs.options }} $flags $example --warnings=${{ steps.prep.outputs.warnings }} + arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn ${{ matrix.id }}${{ steps.prep.outputs.options }} --build-property compiler.cpp.extra_flags="$flags" $example --warnings=${{ steps.prep.outputs.warnings }} if [ $? -ne 0 ]; then echo -e "\033[1;31m${example##*/} build FAILED\033[0m\n"; exit 1; From df3bf5441dec502c1fc882d9d71dc5ef7e3d4f49 Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 25 Mar 2024 19:28:37 +0100 Subject: [PATCH 4/7] Fixup array dump helper --- examples/LoRaWAN/LoRaWAN_ABP/configABP.h | 6 ++++-- examples/LoRaWAN/LoRaWAN_Reference/config.h | 6 ++++-- examples/LoRaWAN/LoRaWAN_Starter/config.h | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/LoRaWAN/LoRaWAN_ABP/configABP.h b/examples/LoRaWAN/LoRaWAN_ABP/configABP.h index 649136788..2a0f89f3e 100644 --- a/examples/LoRaWAN/LoRaWAN_ABP/configABP.h +++ b/examples/LoRaWAN/LoRaWAN_ABP/configABP.h @@ -125,8 +125,10 @@ void debug(bool isFail, const __FlashStringHelper* message, int state, bool Free // Helper function to display a byte array void arrayDump(uint8_t *buffer, uint16_t len) { - for (uint16_t c; c < len; c++) { - Serial.printf("%02X", buffer[c]); + for(uint16_t c = 0; c < len; c++) { + char b = buffer[c]; + if(b < 0x10) { Serial.print('0'); } + Serial.print(b, HEX); } Serial.println(); } diff --git a/examples/LoRaWAN/LoRaWAN_Reference/config.h b/examples/LoRaWAN/LoRaWAN_Reference/config.h index 08322a339..cfd6604f2 100644 --- a/examples/LoRaWAN/LoRaWAN_Reference/config.h +++ b/examples/LoRaWAN/LoRaWAN_Reference/config.h @@ -120,8 +120,10 @@ void debug(bool isFail, const __FlashStringHelper* message, int state, bool Free // Helper function to display a byte array void arrayDump(uint8_t *buffer, uint16_t len) { - for (uint16_t c; c < len; c++) { - Serial.printf("%02X", buffer[c]); + for(uint16_t c = 0; c < len; c++) { + char b = buffer[c]; + if(b < 0x10) { Serial.print('0'); } + Serial.print(b, HEX); } Serial.println(); } diff --git a/examples/LoRaWAN/LoRaWAN_Starter/config.h b/examples/LoRaWAN/LoRaWAN_Starter/config.h index 08322a339..cfd6604f2 100644 --- a/examples/LoRaWAN/LoRaWAN_Starter/config.h +++ b/examples/LoRaWAN/LoRaWAN_Starter/config.h @@ -120,8 +120,10 @@ void debug(bool isFail, const __FlashStringHelper* message, int state, bool Free // Helper function to display a byte array void arrayDump(uint8_t *buffer, uint16_t len) { - for (uint16_t c; c < len; c++) { - Serial.printf("%02X", buffer[c]); + for(uint16_t c = 0; c < len; c++) { + char b = buffer[c]; + if(b < 0x10) { Serial.print('0'); } + Serial.print(b, HEX); } Serial.println(); } From fe08103581ab4460d27b03b1b1059b5258073886 Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 25 Mar 2024 19:55:34 +0100 Subject: [PATCH 5/7] Added missing LoRaWAN defines --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b8a629344..7063e5f5a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -166,7 +166,7 @@ jobs: else # apply special flags for LoRaWAN if [[ ${example} =~ "LoRaWAN" ]]; then - flags="-DRADIOLIB_LORAWAN_DEV_ADDR=0 -DRADIOLIB_LORAWAN_NWKS_KEY=0 -DRADIOLIB_LORAWAN_SNWKSINT_KEY=0 -DRADIOLIB_LORAWAN_NWKSENC_KEY=0 -DRADIOLIB_LORAWAN_APPS_KEY=0" + flags="-DRADIOLIB_LORAWAN_DEV_ADDR=0 -DRADIOLIB_LORAWAN_NWKS_KEY=0 -DRADIOLIB_LORAWAN_SNWKSINT_KEY=0 -DRADIOLIB_LORAWAN_NWKSENC_KEY=0 -DRADIOLIB_LORAWAN_APPS_KEY=0 -DRADIOLIB_LORAWAN_APP_KEY=0 -DRADIOLIB_LORAWAN_NWK_KEY=0 -DRADIOLIB_LORAWAN_DEV_EUI=0" fi # build sketch From 36139444bc9c2cb7268aac9c8b14a4a8085da5f0 Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 25 Mar 2024 20:28:47 +0100 Subject: [PATCH 6/7] Drop Teensy from CI (still broken) --- .github/workflows/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7063e5f5a..595f68a66 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -104,8 +104,6 @@ jobs: run: echo "index-url=--additional-urls https://resource.heltec.cn/download/package_CubeCell_index.json" >> $GITHUB_OUTPUT - id: MegaCore:avr:1281 run: echo "index-url=--additional-urls https://mcudude.github.io/MegaCore/package_MCUdude_MegaCore_index.json" >> $GITHUB_OUTPUT - - id: teensy:avr:teensy41 - run: echo "index-url=--additional-urls https://www.pjrc.com/teensy/td_156/package_teensy_index.json" >> $GITHUB_OUTPUT - id: arduino:renesas_uno:minima runs-on: ubuntu-latest From 2f126ed6f5adee10a272a428f5455c8c991f548f Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 25 Mar 2024 20:57:07 +0100 Subject: [PATCH 7/7] Define a board for CI runs --- .github/workflows/main.yml | 2 +- examples/LoRaWAN/LoRaWAN_ABP/configABP.h | 2 +- examples/LoRaWAN/LoRaWAN_Reference/config.h | 2 +- examples/LoRaWAN/LoRaWAN_Starter/config.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 595f68a66..31dcf040e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -164,7 +164,7 @@ jobs: else # apply special flags for LoRaWAN if [[ ${example} =~ "LoRaWAN" ]]; then - flags="-DRADIOLIB_LORAWAN_DEV_ADDR=0 -DRADIOLIB_LORAWAN_NWKS_KEY=0 -DRADIOLIB_LORAWAN_SNWKSINT_KEY=0 -DRADIOLIB_LORAWAN_NWKSENC_KEY=0 -DRADIOLIB_LORAWAN_APPS_KEY=0 -DRADIOLIB_LORAWAN_APP_KEY=0 -DRADIOLIB_LORAWAN_NWK_KEY=0 -DRADIOLIB_LORAWAN_DEV_EUI=0" + flags="-DRADIOLIB_LORAWAN_DEV_ADDR=0 -DRADIOLIB_LORAWAN_NWKS_KEY=0 -DRADIOLIB_LORAWAN_SNWKSINT_KEY=0 -DRADIOLIB_LORAWAN_NWKSENC_KEY=0 -DRADIOLIB_LORAWAN_APPS_KEY=0 -DRADIOLIB_LORAWAN_APP_KEY=0 -DRADIOLIB_LORAWAN_NWK_KEY=0 -DRADIOLIB_LORAWAN_DEV_EUI=0 -DARDUINO_TTGO_LORA32_V1" fi # build sketch diff --git a/examples/LoRaWAN/LoRaWAN_ABP/configABP.h b/examples/LoRaWAN/LoRaWAN_ABP/configABP.h index 2a0f89f3e..5d8d29e18 100644 --- a/examples/LoRaWAN/LoRaWAN_ABP/configABP.h +++ b/examples/LoRaWAN/LoRaWAN_ABP/configABP.h @@ -95,7 +95,7 @@ const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0 // SX1262 radio = new Module(8, 14, 12, 13); // SX1278 pin order: Module(NSS/CS, DIO0, RESET, DIO1); - SX1278 radio = new Module(10, 2, 9, 3); + // SX1278 radio = new Module(10, 2, 9, 3); #endif diff --git a/examples/LoRaWAN/LoRaWAN_Reference/config.h b/examples/LoRaWAN/LoRaWAN_Reference/config.h index cfd6604f2..b9c1bf71d 100644 --- a/examples/LoRaWAN/LoRaWAN_Reference/config.h +++ b/examples/LoRaWAN/LoRaWAN_Reference/config.h @@ -92,7 +92,7 @@ const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0 // SX1262 radio = new Module(8, 14, 12, 13); // SX1278 pin order: Module(NSS/CS, DIO0, RESET, DIO1); - SX1278 radio = new Module(10, 2, 9, 3); + // SX1278 radio = new Module(10, 2, 9, 3); #endif diff --git a/examples/LoRaWAN/LoRaWAN_Starter/config.h b/examples/LoRaWAN/LoRaWAN_Starter/config.h index cfd6604f2..b9c1bf71d 100644 --- a/examples/LoRaWAN/LoRaWAN_Starter/config.h +++ b/examples/LoRaWAN/LoRaWAN_Starter/config.h @@ -92,7 +92,7 @@ const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0 // SX1262 radio = new Module(8, 14, 12, 13); // SX1278 pin order: Module(NSS/CS, DIO0, RESET, DIO1); - SX1278 radio = new Module(10, 2, 9, 3); + // SX1278 radio = new Module(10, 2, 9, 3); #endif