Skip to content

Commit a43ad52

Browse files
committed
Merge branch 'main' of github.com:sparkfun/sfe-iot-node-lorawan
2 parents 7a6f004 + 7f1ab76 commit a43ad52

13 files changed

+422
-105
lines changed

.github/workflows/build-iotnode-lorawan.yml

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
name: IoT Node - LoRaWAN - Firmware build Action
22
on:
33
push:
4-
5-
workflow_dispatch:
64
branches:
7-
- 'main'
8-
- 'develop'
9-
- 'feature/**'
10-
- 'release/**'
11-
- 'hotfix/**'
5+
- main
126

7+
workflow_dispatch:
8+
9+
1310
env:
1411
ARDUINO_RP2040_DIR: .arduino15/packages/rp2040/hardware/rp2040/4.3.1
1512
IOT_NODE_LORAWAN_APP_KEY: ${{ secrets.IOT_NODE_LORAWAN_APP_KEY }}
@@ -27,7 +24,7 @@ jobs:
2724
# checkout flux-sdk
2825
- name: Checkout the flux-sdk
2926
run: |
30-
git clone --branch release/iot-node-lorawan-release-v1.0.0 https://github.com/sparkfun/flux-sdk.git
27+
git clone --branch release/iot-node-lorawan-v1.0.1 https://github.com/sparkfun/flux-sdk.git
3128
echo "FLUX_SDK_PATH=`pwd`/flux-sdk" >> $GITHUB_ENV
3229
3330
# Run cmake - this will build a custom SparkFun_Flux library we can use with
@@ -52,43 +49,49 @@ jobs:
5249

5350
# Install RP2040 - 4.0.3 (Nov, 2024)
5451
- name: Arduino - Install rp2040 platform
55-
run: arduino-cli core install rp2040:rp2040@4.3.1
52+
run: arduino-cli core install rp2040:rp2040@4.4.4
5653

57-
- name: Patch in our IOT Node boards
58-
run: |
59-
cd patch
60-
cp boards.txt $HOME/$ARDUINO_RP2040_DIR/boards.txt
61-
cp -R sparkfun_iotnode_lorawanrp2350 $HOME/$ARDUINO_RP2040_DIR/variants/
62-
cp sparkfun_iotnode_lorawan_rp2350.h $HOME/$ARDUINO_RP2040_DIR//pico-sdk/src/boards/include/boards/
63-
cd ..
54+
# - name: Patch in our IOT Node boards
55+
# run: |
56+
# cd patch
57+
# cp boards.txt $HOME/$ARDUINO_RP2040_DIR/boards.txt
58+
# cp -R sparkfun_iotnode_lorawanrp2350 $HOME/$ARDUINO_RP2040_DIR/variants/
59+
# cp sparkfun_iotnode_lorawan_rp2350.h $HOME/$ARDUINO_RP2040_DIR//pico-sdk/src/boards/include/boards/
60+
# cd ..
6461

6562
# install the libraries Flux uses
6663
- name: Install Flux dependant libraries
6764
run: ./flux-sdk/install-libs.sh
6865

6966
# currently using a local copy of the library that removed some warning messages - source is here:
7067
# arduino-cli lib install --git-url "https://github.com/felixgalindo/XBeeArduino.git"
68+
# arduino-cli lib install --git-url "https://github.com/sparkfun/XBeeArduino.git"
7169
- name: Install The XBee LoRaWAN library
7270
run: |
7371
arduino-cli config set library.enable_unsafe_install true
74-
arduino-cli lib install --git-url "https://github.com/sparkfun/XBeeArduino.git"
72+
arduino-cli lib install --git-url "https://github.com/felixgalindo/XBeeArduino.git"
7573
arduino-cli lib install FastLED
7674
7775
# Compile time - build the Firmware for the data logger.
7876
# Note:
7977
# - The use of a full path to flux - this is needed or the build fails (relative paths get merged).
8078
# - ** Nov 25 - for build testing, using the pro micro board definition until new board added
79+
#
80+
# May 2025 -
81+
# Add filesystem params for the flash layout - 1MB+ for prefs, 4MB for filesystem, the rest (11MB) for firmware
8182

8283
- name: Compile DataLogger firmware binary
8384
run:
8485
arduino-cli compile --fqbn rp2040:rp2040:sparkfun_iotnode_lorawanrp2350 ./sfeIoTNodeLoRaWAN/sfeIoTNodeLoRaWAN.ino
8586
--build-property "compiler.cpp.extra_flags=\"-DIOT_NODE_LORAWAN_APP_KEY=$IOT_NODE_LORAWAN_APP_KEY\" \"-DFLX_SPARKFUN_LORAWAN_APP_EUI=$FLX_SPARKFUN_LORAWAN_APP_EUI\" \"-DBUILD_NUMBER=$GITHUB_RUN_NUMBER\""
87+
--build-property build.flash_length=11526144 --build-property upload.maximum_size=11526144 --build-property build.eeprom_start=284155904 --build-property build.fs_end=284155904 --build-property build.fs_start=279961600 --build-property build.flash_total=16777216
8688
--export-binaries --clean --library `pwd`/SparkFun_IoTNodeLoRaWAN
8789

88-
# Upload the build files - bootloader, paritions, firmware
89-
- uses: actions/upload-artifact@v4
90+
# Upload the build files - bootloader, partitions, firmware
91+
- name: Upload Build Artifacts
92+
uses: actions/upload-artifact@v4
9093
with:
91-
name: Upload Build
92-
path: sfeIoTNodeLoRaWAN/build/rp2040.rp2040.sparkfun_iotnode_lorawanrp2350/sfeIoTNodeLoRaWAN.ino.uf2
94+
name: Upload Builds
95+
path: sfeIoTNodeLoRaWAN/build/rp2040.rp2040.sparkfun_iotnode_lorawanrp2350/
9396

9497

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
build/
3+
4+
SparkFun_IoTNodeLoRaWAN/

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ flux_sdk_add_module(
2828
flux_logging
2929
flux_system
3030
flux_prefs
31+
flux_prefs_json
3132
flux_prefs_serial
3233
flux_network
34+
flux_sdcard
35+
flux_file
36+
flux_firmware
3337
device_bme280
3438
device_bme68x
3539
device_bmp384
@@ -57,7 +61,8 @@ flux_sdk_add_module(
5761
device_vcnl4040
5862
device_veml6075
5963
device_veml7700
60-
device_vl53l1x)
64+
device_vl53l1x
65+
device_soilmoisture)
6166

6267
# now call the init function/macro - this will build the Arduino Library SparkFun_Flux under this
6368
# main directory

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ Details are outlined in [IoT Node - LoRaWAN Documentation](https://docs.sparkfun
2424

2525
## Latest Firmware
2626

27-
* Version 01.00.00 - [Release](https://github.com/sparkfun/sfe-iot-node-lorawan/releases/tag/v01.00.00)
27+
* Version 01.01.00 - [Release](https://github.com/sparkfun/sfe-iot-node-lorawan/releases/tag/v01.01.00)
28+
29+
> [!NOTE]
30+
> With firmware version v1.1.0 and above, the XBee LR module on the IoT Node - LoRaWAN board must be running firmware version A5013 - (May 1, 2025) or later. Details on the firmware and how to update are located [here](https://hub.digi.com/support/products/xbee-studio/?_gl=1*1dnbbi0*_gcl_au*MTY5MDM3NjY5LjE3NDYwNDk1Nzg.*_ga*MjY3MjAwOTM1LjE3NDYwNDk1Nzg.*_ga_RZXDK3PM3B*MTc0NjIyNTE0NC42LjAuMTc0NjIyNTE0NC42MC4wLjE4MzUzMzYzNjg.)
2831
2932
## Documentation
3033

sfeIoTNodeLoRaWAN/flxLoRaWANDigi.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ bool flxLoRaWANDigi::setupModule(void)
391391
for (int i = 0; i < 3; i++)
392392
{
393393
flxLog_N_(F("."));
394-
if (_pXBeeLR->getLoRaWANDevEUI((uint8_t *)_devEUI, sizeof(_devEUI)))
394+
if (_pXBeeLR->getLoRaWANDevEUI(_devEUI, sizeof(_devEUI)))
395395
{
396396
status = true;
397397
break;
@@ -408,13 +408,13 @@ bool flxLoRaWANDigi::setupModule(void)
408408

409409
// note:
410410
// TODO: this wasn't working in 12/2024 -- need to revisit in the future as the XBee LR library is updated
411-
// // Set the region
412-
// if (!_pXBeeLR->setLoRaWANRegion(_lora_region))
413-
// flxLog_W(F("%s: Error setting the LoRaWAN Region to `%s`"), name(), getRegionName());
414-
// else
415-
// flxLog_V(F("%s: Set the LoRaWAN Region to `%s`"), name(), getRegionName());
411+
// Set the region
412+
if (!_pXBeeLR->setLoRaWANRegion(_lora_region))
413+
flxLog_W(F("%s: Error setting the LoRaWAN Region to `%s`"), name(), getRegionName());
414+
else
415+
flxLog_V_(F("%s: Set the LoRaWAN Region to `%s`"), name(), getRegionName());
416416

417-
// flxLog_N_(F("."));
417+
flxLog_N_(F("."));
418418

419419
// Do we need to configure the module?
420420
if (_moduleConfigured() == false)

sfeIoTNodeLoRaWAN/flxLoRaWANLogger.cpp

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
#include "flxLoRaWANLogger.h"
12+
#include <Flux/flxDeviceValueTypes.h>
1213

1314
//---------------------------------------------------------------------------
1415
// flxLoRaWANLogger Class - outputs data to the lorawan during a log event
@@ -52,7 +53,46 @@ void flxLoRaWANLogger::logObservation(void)
5253
// we don't process arrays. We only process scalar values
5354
if ((param->flags() & kParameterOutFlagArray) == kParameterOutFlagArray)
5455
{
55-
flxLog_V("Array parameters not supported by LoRaWAN driver. Parameter: %s", param->name());
56+
flxParameterOutArray *pArray = (flxParameterOutArray *)param->accessor();
57+
// look for known values - if not, skip
58+
switch (pArray->valueType())
59+
{
60+
case kParamValueLocation: {
61+
62+
flxDataArrayFloat *parrData = (flxDataArrayFloat *)pArray->get();
63+
64+
// is the data array sane?
65+
if (parrData->size() != 2)
66+
{
67+
flxLog_W("Location array size is not 2. Size: %d", parrData->size());
68+
continue;
69+
}
70+
71+
// location is a two element float array, that we want to send in the same packet.
72+
// So first, flush the buffer, then send the data
73+
_pLoRaWAN->flushBuffer();
74+
75+
// trick the system into thinking we have a float array, which the LoRaWAN driver
76+
// can handle. We need to do this because the LoRaWAN driver is expecting a float array[2]
77+
float *pfData = parrData->get();
78+
float tmparr[2] = {pfData[0], pfData[1]};
79+
80+
if (flxIsLoggingVerbose())
81+
{
82+
// dump out details for the parameter. Note - for packed value, this depends on
83+
// verbose output from the packer.
84+
flxLog_V_("LoRa Packing [%s::%s] Type: Location Value ID: 0x%02X Value: (%f,%f)",
85+
pDevice->name(), param->name(), pArray->valueType(), tmparr[0], tmparr[1]);
86+
}
87+
88+
// send the data
89+
status = _pLoRaWAN->sendData(pArray->valueType(), tmparr);
90+
break;
91+
}
92+
default:
93+
flxLog_V("Array parameters not supported by LoRaWAN driver. Parameter: %s", param->name());
94+
break;
95+
}
5696
continue;
5797
}
5898
flxParameterOutScalar *pScalar = (flxParameterOutScalar *)param->accessor();

0 commit comments

Comments
 (0)