diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml
index a6fb39b29..6194bfe69 100644
--- a/.github/workflows/main_matrix.yml
+++ b/.github/workflows/main_matrix.yml
@@ -23,9 +23,9 @@ jobs:
matrix:
include:
- board: rak11200
- - board: tlora-v2-1-1.6
+ - board: tlora-v2-1-1_6
- board: tbeam
- - board: heltec-v2.1
+ - board: heltec-v2_1
- board: meshtastic-diy-v1
- board: rak4631
- board: t-echo
@@ -57,13 +57,13 @@ jobs:
- board: tlora-v2
- board: tlora-v1
- board: tlora_v1_3
- - board: tlora-v2-1-1.6
- - board: tlora-v2-1-1.8
+ - board: tlora-v2-1-1_6
+ - board: tlora-v2-1-1_8
- board: tbeam
- board: heltec-v1
- - board: heltec-v2.0
- - board: heltec-v2.1
- - board: tbeam0.7
+ - board: heltec-v2_0
+ - board: heltec-v2_1
+ - board: tbeam0_7
- board: meshtastic-diy-v1
- board: meshtastic-dr-dev
- board: nano-g1
diff --git a/.trunk/.gitignore b/.trunk/.gitignore
index cf2f25470..8130ba6d1 100644
--- a/.trunk/.gitignore
+++ b/.trunk/.gitignore
@@ -5,3 +5,4 @@
plugins
user_trunk.yaml
user.yaml
+shims
diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml
index 519a9181e..cdf662e1f 100644
--- a/.trunk/trunk.yaml
+++ b/.trunk/trunk.yaml
@@ -1,36 +1,37 @@
version: 0.1
cli:
- version: 1.7.0
+ version: 1.9.1
plugins:
sources:
- id: trunk
- ref: v0.0.14
+ ref: v0.0.17
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- - ruff@0.0.260
- - yamllint@1.30.0
+ - taplo@0.7.0
+ - ruff@0.0.265
+ - yamllint@1.31.0
- isort@5.12.0
- - markdownlint@0.33.0
+ - markdownlint@0.34.0
- oxipng@8.0.0
- svgo@3.0.2
- - actionlint@1.6.23
+ - actionlint@1.6.24
- flake8@6.0.0
- hadolint@2.12.0
- shfmt@3.5.0
- shellcheck@0.9.0
- black@23.3.0
- git-diff-check
- - gitleaks@8.16.2
+ - gitleaks@8.16.3
- clang-format@14.0.0
- - prettier@2.8.7
+ - prettier@2.8.8
disabled:
- taplo@0.7.0
- shellcheck@0.9.0
- shfmt@3.5.0
- oxipng@8.0.0
- actionlint@1.6.22
- - markdownlint@0.33.0
+ - markdownlint@0.34.0
- hadolint@2.12.0
- svgo@3.0.2
runtimes:
diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini
index fb83ec2d4..45409ad7b 100644
--- a/arch/esp32/esp32.ini
+++ b/arch/esp32/esp32.ini
@@ -2,11 +2,14 @@
[esp32_base]
extends = arduino_base
platform = platformio/espressif32@^6.1.0
+
build_src_filter =
${arduino_base.build_src_filter} - - - -
+
upload_speed = 921600
debug_init_break = tbreak setup
monitor_filters = esp32_exception_decoder
+
board_build.filesystem = littlefs
# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
@@ -34,6 +37,7 @@ lib_deps =
${environmental_base.lib_deps}
https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
h2zero/NimBLE-Arduino@^1.4.0
+ jgromes/RadioLib@^6.0.0
https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
diff --git a/arch/esp32/esp32c3.ini b/arch/esp32/esp32c3.ini
index 5ebb789ad..619fdb28a 100644
--- a/arch/esp32/esp32c3.ini
+++ b/arch/esp32/esp32c3.ini
@@ -1,44 +1,5 @@
[esp32c3_base]
-extends = arduino_base
-platform = platformio/espressif32@^6.1.0
-build_src_filter =
- ${arduino_base.build_src_filter} - - - -
-upload_speed = 961200
+extends = esp32_base
+
monitor_speed = 115200
-debug_init_break = tbreak setup
monitor_filters = esp32_c3_exception_decoder
-board_build.filesystem = littlefs
-
-# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
-# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
-# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
-build_flags =
- ${arduino_base.build_flags}
- -Wall
- -Wextra
- -Isrc/platform/esp32
- -std=c++11
- -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
- -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
- -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL
- -DCONFIG_BT_NIMBLE_ENABLED
- -DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
- -DCONFIG_BT_NIMBLE_MAX_CCCDS=20
- -DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
- ;-DDEBUG_HEAP
-
-lib_deps =
- ${arduino_base.lib_deps}
- ${networking_base.lib_deps}
- ${environmental_base.lib_deps}
- https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
- h2zero/NimBLE-Arduino@^1.4.0
- https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
- https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
-lib_ignore =
- segger_rtt
- ESP32 BLE Arduino
-
-; customize the partition table
-; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
-board_build.partitions = partition-table.csv
\ No newline at end of file
diff --git a/arch/esp32/esp32s2.ini b/arch/esp32/esp32s2.ini
index 6e75c08c9..3bde3465a 100644
--- a/arch/esp32/esp32s2.ini
+++ b/arch/esp32/esp32s2.ini
@@ -1,47 +1,16 @@
[esp32s2_base]
-extends = arduino_base
-platform = platformio/espressif32@^6.1.0
+extends = esp32_base
+
build_src_filter =
- ${arduino_base.build_src_filter} - - - - -
-upload_speed = 961200
+ ${esp32_base.build_src_filter} -
+
monitor_speed = 115200
-debug_init_break = tbreak setup
-monitor_filters = esp32_exception_decoder
-board_build.filesystem = littlefs
-# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
-# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
-# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
build_flags =
- ${arduino_base.build_flags}
- -Wall
- -Wextra
- -Isrc/platform/esp32
- -std=c++11
- -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
- -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
- -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL
- -DAXP_DEBUG_PORT=Serial
- -DCONFIG_BT_NIMBLE_ENABLED
- -DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
- -DCONFIG_BT_NIMBLE_MAX_CCCDS=20
- -DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
+ ${esp32_base.build_flags}
-DHAS_BLUETOOTH=0
- ;-DDEBUG_HEAP
-lib_deps =
- ${arduino_base.lib_deps}
- ${networking_base.lib_deps}
- ${environmental_base.lib_deps}
- https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
- https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
- https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
-
lib_ignore =
- segger_rtt
- ESP32 BLE Arduino
-
-; customize the partition table
-; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
-board_build.partitions = partition-table.csv
+ ${esp32_base.lib_ignore}
+ NimBLE-Arduino
diff --git a/arch/esp32/esp32s3.ini b/arch/esp32/esp32s3.ini
index bb0214f46..6a1bdd3fd 100644
--- a/arch/esp32/esp32s3.ini
+++ b/arch/esp32/esp32s3.ini
@@ -1,47 +1,5 @@
[esp32s3_base]
-extends = arduino_base
-platform = platformio/espressif32@^6.1.0
-build_src_filter =
- ${arduino_base.build_src_filter} - - - -
-upload_speed = 961200
+extends = esp32_base
+
monitor_speed = 115200
-debug_init_break = tbreak setup
-monitor_filters = esp32_exception_decoder
-board_build.filesystem = littlefs
-
-# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
-# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
-# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
-build_flags =
- ${arduino_base.build_flags}
- -Wall
- -Wextra
- -Isrc/platform/esp32
- -std=c++11
- -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
- -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
- -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL
- -DAXP_DEBUG_PORT=Serial
- -DCONFIG_BT_NIMBLE_ENABLED
- -DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
- -DCONFIG_BT_NIMBLE_MAX_CCCDS=20
- -DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
- ;-DDEBUG_HEAP
-
-lib_deps =
- ${arduino_base.lib_deps}
- ${networking_base.lib_deps}
- ${environmental_base.lib_deps}
- https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
- h2zero/NimBLE-Arduino@^1.4.0
- https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
- https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
-
-lib_ignore =
- segger_rtt
- ESP32 BLE Arduino
-
-; customize the partition table
-; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
-board_build.partitions = partition-table.csv
diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini
index c2287d7e5..3f1a77d08 100644
--- a/arch/nrf52/nrf52.ini
+++ b/arch/nrf52/nrf52.ini
@@ -1,18 +1,20 @@
[nrf52_base]
; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files
platform = platformio/nordicnrf52@^9.5.0
-
extends = arduino_base
+
build_type = debug ; I'm debugging with ICE a lot now
build_flags =
${arduino_base.build_flags} -Wno-unused-variable
-Isrc/platform/nrf52
+
build_src_filter =
${arduino_base.build_src_filter} - - - - - - - - -
+
+lib_deps=
+ ${arduino_base.lib_deps}
+ jgromes/RadioLib@^6.0.0
+
lib_ignore =
BluetoothOTA
-
-; Note: By default no lora device is created for this build - it uses a simulated interface
-[env:feather_nrf52832]
-extends = nrf52_base
-board = adafruit_feather_nrf52832
+
diff --git a/arch/nrf52/nrf52832.ini b/arch/nrf52/nrf52832.ini
new file mode 100644
index 000000000..ce94283b1
--- /dev/null
+++ b/arch/nrf52/nrf52832.ini
@@ -0,0 +1,7 @@
+[nrf52832_base]
+extends = nrf52_base
+
+build_flags = ${nrf52_base.build_flags}
+
+lib_deps =
+ ${nrf52_base.lib_deps}
diff --git a/arch/nrf52/nrf52840.ini b/arch/nrf52/nrf52840.ini
index 14cc1d1e1..cf08fd02e 100644
--- a/arch/nrf52/nrf52840.ini
+++ b/arch/nrf52/nrf52840.ini
@@ -1,14 +1,9 @@
[nrf52840_base]
extends = nrf52_base
+
build_flags = ${nrf52_base.build_flags}
+
lib_deps =
- ${arduino_base.lib_deps}
+ ${nrf52_base.lib_deps}
${environmental_base.lib_deps}
https://github.com/Kongduino/Adafruit_nRFCrypto.git#e31a8825ea3300b163a0a3c1ddd5de34e10e1371
-
-; Note: By default no lora device is created for this build - it uses a simulated interface
-[env:nrf52840dk]
-extends = nrf52840_base
-board = nrf52840_dk
-
-
diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini
index 100f3538d..7e3557475 100644
--- a/arch/portduino/portduino.ini
+++ b/arch/portduino/portduino.ini
@@ -2,6 +2,7 @@
[portduino_base]
platform = https://github.com/meshtastic/platform-native.git#096b3c3e9c5c8e19d4c3b6cd803fffef2a9be4c5
framework = arduino
+
build_src_filter =
${env.build_src_filter}
-
@@ -16,8 +17,14 @@ build_src_filter =
-
-
+<../variants/portduino>
+
lib_deps =
${env.lib_deps}
${networking_base.lib_deps}
rweather/Crypto@^0.4.0
-build_flags = ${arduino_base.build_flags} -fPIC -Isrc/platform/portduino
+ jgromes/RadioLib@^6.0.0
+
+build_flags =
+ ${arduino_base.build_flags}
+ -fPIC
+ -Isrc/platform/portduino
diff --git a/arch/rp2040/rp2040.ini b/arch/rp2040/rp2040.ini
index c41f92892..6f5449ae6 100644
--- a/arch/rp2040/rp2040.ini
+++ b/arch/rp2040/rp2040.ini
@@ -2,6 +2,7 @@
[rp2040_base]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#9f8c10e50b5acd18e7bfd32638199c655be73a5b
extends = arduino_base
+
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m
build_flags =
@@ -11,9 +12,12 @@ build_flags =
# -D _POSIX_THREADS
build_src_filter =
${arduino_base.build_src_filter} - - - - - - - - -
+
lib_ignore =
BluetoothOTA
+
lib_deps =
${arduino_base.lib_deps}
${environmental_base.lib_deps}
+ jgromes/RadioLib@^6.0.0
https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b
diff --git a/arch/stm32/stm32wl5e.ini b/arch/stm32/stm32wl5e.ini
index a38fb65e8..4d5cee56d 100644
--- a/arch/stm32/stm32wl5e.ini
+++ b/arch/stm32/stm32wl5e.ini
@@ -2,17 +2,19 @@
platform = platformio/ststm32@^15.4.1
board = generic_wl5e
framework = arduino
+
build_type = debug
build_flags =
${arduino_base.build_flags}
-Isrc/platform/stm32wl -g
- -DHAL_SUBGHZ_MODULE_ENABLED
-# Arduino/PlatformIO framework-arduinoststm32 package does not presently have SUBGHZSPI support
-# -DPIN_SPI_MOSI=PINSUBGHZSPIMOSI -DPIN_SPI_MISO=PINSUBGHZSPIMISO -DPIN_SPI_SCK=PINSUBGHZSPISCK
+
build_src_filter =
${arduino_base.build_src_filter} - - - - - - - - - - - - - -
+
lib_deps =
${env.lib_deps}
+ jgromes/RadioLib@^6.0.0
https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b
+
lib_ignore =
mathertel/OneButton@^2.0.3
diff --git a/bpi_picow_esp32_s3.json b/boards/bpi_picow_esp32_s3.json
similarity index 100%
rename from bpi_picow_esp32_s3.json
rename to boards/bpi_picow_esp32_s3.json
diff --git a/platformio.ini b/platformio.ini
index 508f3615b..2040b75ce 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -66,9 +66,6 @@ lib_deps =
https://github.com/meshtastic/ArduinoThread.git#72921ac222eed6f526ba1682023cee290d9aa1b3
nanopb/Nanopb@^0.4.7
erriez/ErriezCRC32@^1.0.1
- ; temp: do this till > 5.7.0 release to keep (some) SX1262 and SX1280 working - resolves -705 error during init
- https://github.com/jgromes/RadioLib.git#45c5859338590b7eede23cb2f95284c3fb0cf08e
- ; jgromes/RadioLib@^5.7.0
; Used for the code analysis in PIO Home / Inspect
check_tool = cppcheck
@@ -105,7 +102,8 @@ lib_deps =
adafruit/Adafruit Unified Sensor@^1.1.9
adafruit/Adafruit BMP280 Library@^2.6.6
adafruit/Adafruit BME280 Library@^2.2.2
- https://github.com/meshtastic/BSEC-Arduino-library.git#452f9a7ffa8b53e1debe2c454fe375dfad98b507
+ boschsensortec/BSEC2 Software Library@^1.3.2200
+ boschsensortec/BME68x Sensor Library@^1.1.40407
adafruit/Adafruit MCP9808 Library@^2.0.0
adafruit/Adafruit INA260 Library@^1.5.0
adafruit/Adafruit INA219@^1.2.0
diff --git a/src/configuration.h b/src/configuration.h
index 58e41877d..e1420c8db 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -124,6 +124,11 @@ along with this program. If not, see .
#define MPU6050_ADDR 0x68
#define LIS3DH_ADR 0x18
+// -----------------------------------------------------------------------------
+// LED
+// -----------------------------------------------------------------------------
+#define NCP5623_ADDR 0x38
+
// -----------------------------------------------------------------------------
// Security
// -----------------------------------------------------------------------------
diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h
index 01b300c10..a56ce86fe 100644
--- a/src/detect/ScanI2C.h
+++ b/src/detect/ScanI2C.h
@@ -33,6 +33,7 @@ class ScanI2C
PMSA0031,
MPU6050,
LIS3DH,
+ NCP5623,
} DeviceType;
// typedef uint8_t DeviceAddress;
diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp
index fb568b552..b7f16734f 100644
--- a/src/detect/ScanI2CTwoWire.cpp
+++ b/src/detect/ScanI2CTwoWire.cpp
@@ -213,6 +213,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port)
break;
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found\n")
+ SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623 RGB LED found\n");
#ifdef HAS_PMU
SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "axp192/axp2101 PMU found\n")
diff --git a/src/gps/NMEAWPL.cpp b/src/gps/NMEAWPL.cpp
index 6ab2c85bf..ac11d78f8 100644
--- a/src/gps/NMEAWPL.cpp
+++ b/src/gps/NMEAWPL.cpp
@@ -1,5 +1,7 @@
#include "NMEAWPL.h"
#include "GeoCoord.h"
+#include "RTC.h"
+#include
/* -------------------------------------------
* 1 2 3 4 5 6
@@ -56,12 +58,18 @@ uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_Position &pos, const
uint32_t printGGA(char *buf, size_t bufsz, const meshtastic_Position &pos)
{
GeoCoord geoCoord(pos.latitude_i, pos.longitude_i, pos.altitude);
- uint32_t len =
- snprintf(buf, bufsz, "$GNGGA,%06u.%03u,%02d%07.4f,%c,%03d%07.4f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d", pos.time / 1000,
- pos.time % 1000, geoCoord.getDMSLatDeg(), (abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6,
- geoCoord.getDMSLatCP(), geoCoord.getDMSLonDeg(),
- (abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6, geoCoord.getDMSLonCP(), pos.fix_type,
- pos.sats_in_view, pos.HDOP, geoCoord.getAltitude(), 'M', pos.altitude_geoidal_separation, 'M', 0, 0);
+ tm *t = localtime((time_t *)&pos.timestamp);
+ if (getRTCQuality() > 0) { // use the device clock if we got time from somewhere. If not, use the GPS timestamp.
+ uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice);
+ t = localtime((time_t *)&rtc_sec);
+ }
+
+ uint32_t len = snprintf(
+ buf, bufsz, "$GNGGA,%02d%02d%02d.%02d,%02d%07.4f,%c,%03d%07.4f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d", t->tm_hour,
+ t->tm_min, t->tm_sec, pos.timestamp_millis_adjust, geoCoord.getDMSLatDeg(),
+ (abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6, geoCoord.getDMSLatCP(), geoCoord.getDMSLonDeg(),
+ (abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6, geoCoord.getDMSLonCP(), pos.fix_quality,
+ pos.sats_in_view, pos.HDOP, geoCoord.getAltitude(), 'M', pos.altitude_geoidal_separation, 'M', 0, 0);
uint32_t chk = 0;
for (uint32_t i = 1; i < len; i++) {
diff --git a/src/main.cpp b/src/main.cpp
index 7af41116c..324422a69 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -100,6 +100,8 @@ uint8_t kb_model;
ScanI2C::DeviceAddress rtc_found = ScanI2C::ADDRESS_NONE;
// The I2C address of the Accelerometer (if found)
ScanI2C::DeviceAddress accelerometer_found = ScanI2C::ADDRESS_NONE;
+// The I2C address of the RGB LED (if found)
+ScanI2C::FoundDevice rgb_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ScanI2C::ADDRESS_NONE);
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
ATECCX08A atecc;
@@ -159,6 +161,7 @@ static OSThread *buttonThread;
uint32_t ButtonThread::longPressTime = 0;
#endif
static OSThread *accelerometerThread;
+SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
RadioInterface *rIf = NULL;
@@ -234,8 +237,6 @@ void setup()
fsInit();
- router = new ReliableRouter();
-
#ifdef I2C_SDA1
Wire1.begin(I2C_SDA1, I2C_SCL1);
#endif
@@ -346,6 +347,8 @@ void setup()
* nodeTelemetrySensorsMap singleton. This wraps that logic in a temporary scope to declare the temporary field
* "found".
*/
+ // Only one supported RGB LED currently
+ rgb_found = i2cScanner->find(ScanI2C::DeviceType::NCP5623);
#if !defined(ARCH_PORTDUINO)
auto acc_info = i2cScanner->firstAccelerometer();
@@ -413,6 +416,8 @@ void setup()
// If we're taking on the repeater role, use flood router
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER)
router = new FloodingRouter();
+ else
+ router = new ReliableRouter();
#if HAS_BUTTON
// Buttons. Moved here cause we need NodeDB to be initialized
@@ -503,6 +508,10 @@ void setup()
digitalWrite(SX126X_ANT_SW, 1);
#endif
+ // Init LockingHAL first, to use it for radio init
+
+ LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
+
// radio init MUST BE AFTER service.init, so we have our radio config settings (from nodedb init)
#if !HAS_RADIO && defined(ARCH_PORTDUINO)
@@ -520,7 +529,7 @@ void setup()
#if defined(RF95_IRQ)
if (!rIf) {
- rIf = new RF95Interface(RF95_NSS, RF95_IRQ, RF95_RESET, RF95_DIO1, SPI);
+ rIf = new RF95Interface(RadioLibHAL, RF95_NSS, RF95_IRQ, RF95_RESET, RF95_DIO1);
if (!rIf->init()) {
LOG_WARN("Failed to find RF95 radio\n");
delete rIf;
@@ -533,7 +542,7 @@ void setup()
#if defined(USE_SX1262)
if (!rIf) {
- rIf = new SX1262Interface(SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY, SPI);
+ rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
if (!rIf->init()) {
LOG_WARN("Failed to find SX1262 radio\n");
delete rIf;
@@ -546,7 +555,7 @@ void setup()
#if defined(USE_SX1268)
if (!rIf) {
- rIf = new SX1268Interface(SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY, SPI);
+ rIf = new SX1268Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
if (!rIf->init()) {
LOG_WARN("Failed to find SX1268 radio\n");
delete rIf;
@@ -559,7 +568,7 @@ void setup()
#if defined(USE_LLCC68)
if (!rIf) {
- rIf = new LLCC68Interface(SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY, SPI);
+ rIf = new LLCC68Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
if (!rIf->init()) {
LOG_WARN("Failed to find LLCC68 radio\n");
delete rIf;
@@ -572,7 +581,7 @@ void setup()
#if defined(USE_SX1280)
if (!rIf) {
- rIf = new SX1280Interface(SX128X_CS, SX128X_DIO1, SX128X_RESET, SX128X_BUSY, SPI);
+ rIf = new SX1280Interface(RadioLibHAL, SX128X_CS, SX128X_DIO1, SX128X_RESET, SX128X_BUSY);
if (!rIf->init()) {
LOG_WARN("Failed to find SX1280 radio\n");
delete rIf;
diff --git a/src/main.h b/src/main.h
index 645ba2ee2..0d23dd10c 100644
--- a/src/main.h
+++ b/src/main.h
@@ -8,6 +8,7 @@
#include "memGet.h"
#include "mesh/generated/meshtastic/config.pb.h"
#include "mesh/generated/meshtastic/telemetry.pb.h"
+#include
#include