diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index a6fb39b2..6194bfe6 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 cf2f2547..8130ba6d 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 519a9181..cdf662e1 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 fb83ec2d..45409ad7 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 5ebb789a..619fdb28 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 6e75c08c..3bde3465 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 bb0214f4..6a1bdd3f 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 c2287d7e..3f1a77d0 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 00000000..ce94283b --- /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 14cc1d1e..cf08fd02 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 100f3538..7e355747 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 c41f9289..6f5449ae 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 24cc7903..0682dcc4 100644 --- a/arch/stm32/stm32wl5e.ini +++ b/arch/stm32/stm32wl5e.ini @@ -3,6 +3,7 @@ platform_packages = platformio/framework-arduinoststm32 @ https://github.com/stm platform = ststm32 board = generic_wl5e framework = arduino + build_type = debug build_flags = @@ -10,14 +11,19 @@ build_flags = -Isrc/platform/stm32wl -g -DconfigUSE_CMSIS_RTOS_V2=1 -DVECT_TAB_OFFSET=0x08000000 + build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - - - - - - + board_upload.offset_address = 0x08000000 upload_protocol = stlink + lib_deps = ${env.lib_deps} + jgromes/RadioLib@^6.0.0 https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b https://github.com/littlefs-project/littlefs.git#v2.5.1 https://github.com/stm32duino/STM32FreeRTOS.git#10.3.1 + lib_ignore = mathertel/OneButton@^2.0.3 diff --git a/platformio.ini b/platformio.ini index db81f36b..fdc1a367 100644 --- a/platformio.ini +++ b/platformio.ini @@ -67,9 +67,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#cb385f59468cd8bafe4fb8df5651295d605d7e2a - ;jgromes/RadioLib@^5.7.0 ; Used for the code analysis in PIO Home / Inspect check_tool = cppcheck @@ -106,7 +103,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/main.cpp b/src/main.cpp index 261f12ab..736b39b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -164,6 +164,7 @@ static OSThread *buttonThread; uint32_t ButtonThread::longPressTime = 0; #endif static OSThread *accelerometerThread; +SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0); RadioInterface *rIf = NULL; @@ -511,6 +512,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 defined(USE_STM32WLx) if (!rIf) { @@ -540,7 +545,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; @@ -553,7 +558,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; @@ -566,7 +571,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; @@ -579,7 +584,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; @@ -592,7 +597,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 5707e3bc..0d23dd10 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 #if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) #include @@ -66,3 +67,6 @@ extern bool runASAP; void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), clearBonds(); meshtastic_DeviceMetadata getDeviceMetadata(); + +// FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that +extern SPISettings spiSettings; diff --git a/src/mesh/LLCC68Interface.cpp b/src/mesh/LLCC68Interface.cpp index 05c3c241..8109765a 100644 --- a/src/mesh/LLCC68Interface.cpp +++ b/src/mesh/LLCC68Interface.cpp @@ -2,8 +2,8 @@ #include "configuration.h" #include "error.h" -LLCC68Interface::LLCC68Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, - SPIClass &spi) - : SX126xInterface(cs, irq, rst, busy, spi) +LLCC68Interface::LLCC68Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy) + : SX126xInterface(hal, cs, irq, rst, busy) { } \ No newline at end of file diff --git a/src/mesh/LLCC68Interface.h b/src/mesh/LLCC68Interface.h index 7de5e97f..7e0fa143 100644 --- a/src/mesh/LLCC68Interface.h +++ b/src/mesh/LLCC68Interface.h @@ -6,12 +6,13 @@ * Our adapter for LLCC68 radios * https://www.semtech.com/products/wireless-rf/lora-core/llcc68 * ⚠️⚠️⚠️ - * Be aware that LLCC68 does not support Spreading Factor 12 (SF12) and will not work on the default "Long Slow" channel. + * Be aware that LLCC68 does not support Spreading Factor 12 (SF12) and will not work on the "LongSlow" and "VLongSlow" channels. * You must change the channel if you get `Critical Error #3` with this module. * ⚠️⚠️⚠️ */ class LLCC68Interface : public SX126xInterface { public: - LLCC68Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); + LLCC68Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy); }; \ No newline at end of file diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index f57aaa05..cf9cd947 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -11,9 +11,9 @@ #define POWER_DEFAULT 17 // How much power to use if the user hasn't set a power level -RF95Interface::RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, - SPIClass &spi) - : RadioLibInterface(cs, irq, rst, busy, spi) +RF95Interface::RF95Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy) + : RadioLibInterface(hal, cs, irq, rst, busy) { LOG_WARN("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); } diff --git a/src/mesh/RF95Interface.h b/src/mesh/RF95Interface.h index 96c3f247..a50cf93a 100644 --- a/src/mesh/RF95Interface.h +++ b/src/mesh/RF95Interface.h @@ -12,7 +12,8 @@ class RF95Interface : public RadioLibInterface RadioLibRF95 *lora = NULL; // Either a RFM95 or RFM96 depending on what was stuffed on this board public: - RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); + RF95Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy); // TODO: Verify that this irq flag works with RFM95 / SX1276 radios the way it used to bool isIRQPending() override { return lora->getIRQFlags() & RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER; } @@ -39,7 +40,7 @@ class RF95Interface : public RadioLibInterface /** * Enable a particular ISR callback glue function */ - virtual void enableInterrupt(void (*callback)()) { lora->setDio0Action(callback); } + virtual void enableInterrupt(void (*callback)()) { lora->setDio0Action(callback, RISING); } /** can we detect a LoRa preamble on the current channel? */ virtual bool isChannelActive() override; diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index c624bc16..8fd71571 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -9,26 +9,23 @@ #include #include -// FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that -static SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0); - -void LockingModule::SPIbeginTransaction() +void LockingArduinoHal::spiBeginTransaction() { spiLock->lock(); - Module::SPIbeginTransaction(); + ArduinoHal::spiBeginTransaction(); } -void LockingModule::SPIendTransaction() +void LockingArduinoHal::spiEndTransaction() { spiLock->unlock(); - Module::SPIendTransaction(); + ArduinoHal::spiEndTransaction(); } -RadioLibInterface::RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, - SPIClass &spi, PhysicalLayer *_iface) - : NotifiedWorkerThread("RadioIf"), module(cs, irq, rst, busy, spi, spiSettings), iface(_iface) +RadioLibInterface::RadioLibInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy, PhysicalLayer *_iface) + : NotifiedWorkerThread("RadioIf"), module(hal, cs, irq, rst, busy), iface(_iface) { instance = this; #if defined(ARCH_STM32WL) && defined(USE_SX1262) diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index 6fdf46f2..6ea787ee 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -13,36 +13,19 @@ #define INTERRUPT_ATTR #endif +#define RADIOLIB_PIN_TYPE uint32_t + #if !defined(USE_STM32WLx) /** - * A wrapper for the RadioLib Module class, that adds mutex for SPI bus access + * We need to override the RadioLib ArduinoHal class to add mutex protection for SPI bus access */ -class LockingModule : public Module +class LockingArduinoHal : public ArduinoHal { public: - /*! - \brief Extended SPI-based module constructor. + LockingArduinoHal(SPIClass &spi, SPISettings spiSettings) : ArduinoHal(spi, spiSettings){}; - \param cs Arduino pin to be used as chip select. - - \param irq Arduino pin to be used as interrupt/GPIO. - - \param rst Arduino pin to be used as hardware reset for the module. - - \param gpio Arduino pin to be used as additional interrupt/GPIO. - - \param spi SPI interface to be used, can also use software SPI implementations. - - \param spiSettings SPI interface settings. - */ - LockingModule(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio, SPIClass &spi, - SPISettings spiSettings) - : Module(cs, irq, rst, gpio, spi, spiSettings) - { - } - - void SPIbeginTransaction() override; - void SPIendTransaction() override; + void spiBeginTransaction() override; + void spiEndTransaction() override; }; #else /** @@ -92,7 +75,7 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified float currentLimit = 100; // 100mA OCP - Should be acceptable for RFM95/SX127x chipset. - LockingModule module; // The HW interface to the radio + Module module; // The HW interface to the radio /** * provides lowest common denominator RadioLib API @@ -118,8 +101,8 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified virtual void enableInterrupt(void (*)()) = 0; public: - RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi, - PhysicalLayer *iface = NULL); + RadioLibInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy, PhysicalLayer *iface = NULL); virtual ErrorCode send(meshtastic_MeshPacket *p) override; diff --git a/src/mesh/RadioLibRF95.cpp b/src/mesh/RadioLibRF95.cpp index ad4b75a1..0fa6c7fe 100644 --- a/src/mesh/RadioLibRF95.cpp +++ b/src/mesh/RadioLibRF95.cpp @@ -79,5 +79,5 @@ bool RadioLibRF95::isReceiving() uint8_t RadioLibRF95::readReg(uint8_t addr) { - return _mod->SPIreadRegister(addr); + return mod->SPIreadRegister(addr); } \ No newline at end of file diff --git a/src/mesh/SX1262Interface.cpp b/src/mesh/SX1262Interface.cpp index 3bd402ed..e96e72b7 100644 --- a/src/mesh/SX1262Interface.cpp +++ b/src/mesh/SX1262Interface.cpp @@ -2,8 +2,8 @@ #include "configuration.h" #include "error.h" -SX1262Interface::SX1262Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, - SPIClass &spi) - : SX126xInterface(cs, irq, rst, busy, spi) +SX1262Interface::SX1262Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy) + : SX126xInterface(hal, cs, irq, rst, busy) { } \ No newline at end of file diff --git a/src/mesh/SX1262Interface.h b/src/mesh/SX1262Interface.h index 0f029ada..31a12ae9 100644 --- a/src/mesh/SX1262Interface.h +++ b/src/mesh/SX1262Interface.h @@ -8,5 +8,6 @@ class SX1262Interface : public SX126xInterface { public: - SX1262Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); + SX1262Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy); }; \ No newline at end of file diff --git a/src/mesh/SX1268Interface.cpp b/src/mesh/SX1268Interface.cpp index 62cdfefe..ea299fce 100644 --- a/src/mesh/SX1268Interface.cpp +++ b/src/mesh/SX1268Interface.cpp @@ -2,9 +2,9 @@ #include "configuration.h" #include "error.h" -SX1268Interface::SX1268Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, - SPIClass &spi) - : SX126xInterface(cs, irq, rst, busy, spi) +SX1268Interface::SX1268Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy) + : SX126xInterface(hal, cs, irq, rst, busy) { } diff --git a/src/mesh/SX1268Interface.h b/src/mesh/SX1268Interface.h index f40fcf37..c8bcf20a 100644 --- a/src/mesh/SX1268Interface.h +++ b/src/mesh/SX1268Interface.h @@ -10,5 +10,6 @@ class SX1268Interface : public SX126xInterface public: virtual float getFreq() override; - SX1268Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); + SX1268Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy); }; diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index acf84d1b..c26b773f 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -9,9 +9,9 @@ #endif template -SX126xInterface::SX126xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, - SPIClass &spi) - : RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module) +SX126xInterface::SX126xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy) + : RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module) { LOG_WARN("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); } diff --git a/src/mesh/SX126xInterface.h b/src/mesh/SX126xInterface.h index f7ed270d..f2c86174 100644 --- a/src/mesh/SX126xInterface.h +++ b/src/mesh/SX126xInterface.h @@ -9,7 +9,8 @@ template class SX126xInterface : public RadioLibInterface { public: - SX126xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); + SX126xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy); /// Initialise the Driver transport hardware and software. /// Make sure the Driver is properly configured before calling init(). diff --git a/src/mesh/SX1280Interface.cpp b/src/mesh/SX1280Interface.cpp index e19e3e57..3287f141 100644 --- a/src/mesh/SX1280Interface.cpp +++ b/src/mesh/SX1280Interface.cpp @@ -2,8 +2,8 @@ #include "configuration.h" #include "error.h" -SX1280Interface::SX1280Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, - SPIClass &spi) - : SX128xInterface(cs, irq, rst, busy, spi) +SX1280Interface::SX1280Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy) + : SX128xInterface(hal, cs, irq, rst, busy) { } diff --git a/src/mesh/SX1280Interface.h b/src/mesh/SX1280Interface.h index 0c905cd1..8f2c4ec2 100644 --- a/src/mesh/SX1280Interface.h +++ b/src/mesh/SX1280Interface.h @@ -9,5 +9,6 @@ class SX1280Interface : public SX128xInterface { public: - SX1280Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); + SX1280Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy); }; diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index e271cb71..691d5dff 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -9,9 +9,9 @@ #endif template -SX128xInterface::SX128xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, - SPIClass &spi) - : RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module) +SX128xInterface::SX128xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy) + : RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module) { LOG_WARN("SX128xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); } diff --git a/src/mesh/SX128xInterface.h b/src/mesh/SX128xInterface.h index 434d4b1d..3aaf31b1 100644 --- a/src/mesh/SX128xInterface.h +++ b/src/mesh/SX128xInterface.h @@ -9,7 +9,8 @@ template class SX128xInterface : public RadioLibInterface { public: - SX128xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); + SX128xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, + RADIOLIB_PIN_TYPE busy); /// Initialise the Driver transport hardware and software. /// Make sure the Driver is properly configured before calling init(). diff --git a/src/modules/Telemetry/Sensor/BME680Sensor.cpp b/src/modules/Telemetry/Sensor/BME680Sensor.cpp index df86da1b..43e4c038 100644 --- a/src/modules/Telemetry/Sensor/BME680Sensor.cpp +++ b/src/modules/Telemetry/Sensor/BME680Sensor.cpp @@ -13,8 +13,8 @@ int32_t BME680Sensor::runOnce() return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; } bme680.begin(nodeTelemetrySensorsMap[sensorType], Wire); - if (bme680.bsecStatus == BSEC_OK) { - bme680.setConfig(bsec_config_iaq); + if (bme680.status == BSEC_OK) { + bme680.setConfig(Default_H2S_NonH2S_config); loadState(); bme680.updateSubscription(sensorList, 13, BSEC_SAMPLE_RATE_LP); status = 1; @@ -30,10 +30,12 @@ void BME680Sensor::setup() {} bool BME680Sensor::getMetrics(meshtastic_Telemetry *measurement) { bme680.run(); - measurement->variant.environment_metrics.temperature = bme680.temperature; - measurement->variant.environment_metrics.relative_humidity = bme680.humidity; - measurement->variant.environment_metrics.barometric_pressure = bme680.pressure / 100.0F; - measurement->variant.environment_metrics.gas_resistance = bme680.gasResistance / 1000.0; + + measurement->variant.environment_metrics.temperature = bme680.getData(BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE).signal; + measurement->variant.environment_metrics.relative_humidity = + bme680.getData(BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY).signal; + measurement->variant.environment_metrics.barometric_pressure = bme680.getData(BSEC_OUTPUT_RAW_PRESSURE).signal / 100.0F; + measurement->variant.environment_metrics.gas_resistance = bme680.getData(BSEC_OUTPUT_RAW_GAS).signal / 1000.0; // Check if we need to save state to filesystem (every STATE_SAVE_PERIOD ms) updateState(); return true; @@ -62,12 +64,13 @@ void BME680Sensor::updateState() bool update = false; if (stateUpdateCounter == 0) { /* First state update when IAQ accuracy is >= 3 */ - if (bme680.iaqAccuracy >= 3) { - LOG_DEBUG("%s state update IAQ accuracy %u >= 3\n", sensorName, bme680.iaqAccuracy); + accuracy = bme680.getData(BSEC_OUTPUT_IAQ).accuracy; + if (accuracy >= 3) { + LOG_DEBUG("%s state update IAQ accuracy %u >= 3\n", sensorName, accuracy); update = true; stateUpdateCounter++; } else { - LOG_DEBUG("%s not updated, IAQ accuracy is %u >= 3\n", sensorName, bme680.iaqAccuracy); + LOG_DEBUG("%s not updated, IAQ accuracy is %u >= 3\n", sensorName, accuracy); } } else { /* Update every STATE_SAVE_PERIOD minutes */ diff --git a/src/modules/Telemetry/Sensor/BME680Sensor.h b/src/modules/Telemetry/Sensor/BME680Sensor.h index 74aff835..6b45a76f 100644 --- a/src/modules/Telemetry/Sensor/BME680Sensor.h +++ b/src/modules/Telemetry/Sensor/BME680Sensor.h @@ -1,22 +1,21 @@ #include "../mesh/generated/meshtastic/telemetry.pb.h" #include "TelemetrySensor.h" -#include +#include #define STATE_SAVE_PERIOD UINT32_C(360 * 60 * 1000) // That's 6 hours worth of millis() -const uint8_t bsec_config_iaq[] = { -#include -}; +#include "config/Default_H2S_NonH2S/Default_H2S_NonH2S.h" class BME680Sensor : virtual public TelemetrySensor { private: - Bsec bme680; + Bsec2 bme680; protected: virtual void setup() override; const char *bsecConfigFileName = "/prefs/bsec.dat"; uint8_t bsecState[BSEC_MAX_STATE_BLOB_SIZE] = {0}; + uint8_t accuracy = 0; uint16_t stateUpdateCounter = 0; bsec_virtual_sensor_t sensorList[13] = {BSEC_OUTPUT_IAQ, BSEC_OUTPUT_STATIC_IAQ, diff --git a/variants/Dongle_nRF52840-pca10059-v1/platformio.ini b/variants/Dongle_nRF52840-pca10059-v1/platformio.ini index ea14d1a2..a937bfa9 100644 --- a/variants/Dongle_nRF52840-pca10059-v1/platformio.ini +++ b/variants/Dongle_nRF52840-pca10059-v1/platformio.ini @@ -3,6 +3,7 @@ extends = nrf52840_base board = nordic_pca10059 board_level = extra build_flags = ${nrf52840_base.build_flags} -Ivariants/Dongle_nRF52840-pca10059-v1 -D NORDIC_PCA10059 + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/Dongle_nRF52840-pca10059-v1> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/MakePython_nRF52840_eink/platformio.ini b/variants/MakePython_nRF52840_eink/platformio.ini index 9ed5a859..2b08ec9a 100644 --- a/variants/MakePython_nRF52840_eink/platformio.ini +++ b/variants/MakePython_nRF52840_eink/platformio.ini @@ -3,6 +3,7 @@ board_level = extra extends = nrf52840_base board = nordic_pca10059 build_flags = ${nrf52840_base.build_flags} -Ivariants/MakePython_nRF52840_eink -D PRIVATE_HW + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" -D PIN_EINK_EN build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MakePython_nRF52840_eink> lib_deps = diff --git a/variants/MakePython_nRF52840_oled/platformio.ini b/variants/MakePython_nRF52840_oled/platformio.ini index 9332bd78..e0ddb137 100644 --- a/variants/MakePython_nRF52840_oled/platformio.ini +++ b/variants/MakePython_nRF52840_oled/platformio.ini @@ -3,6 +3,7 @@ board_level = extra extends = nrf52840_base board = nordic_pca10059 build_flags = ${nrf52840_base.build_flags} -Ivariants/MakePython_nRF52840_oled -D PRIVATE_HW + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MakePython_nRF52840_oled> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/ai-c3/platformio.ini b/variants/ai-c3/platformio.ini index fbc6b51f..2869ca58 100644 --- a/variants/ai-c3/platformio.ini +++ b/variants/ai-c3/platformio.ini @@ -5,10 +5,4 @@ board_level = extra build_flags = ${esp32c3_base.build_flags} -D PRIVATE_HW -I variants/ai-c3 -; as long as BSEC2 Software Library is not supported remove Sensors from build -build_src_filter = ${esp32c3_base.build_src_filter} - - - - - - -lib_ignore = ${esp32c3_base.lib_ignore} - BSEC Software Library + diff --git a/variants/ai-c3/variant.h b/variants/ai-c3/variant.h index 2db91cca..352d189f 100644 --- a/variants/ai-c3/variant.h +++ b/variants/ai-c3/variant.h @@ -1,6 +1,3 @@ -#define HAS_TELEMETRY 0 // as long as BSEC2 is not supported -#define HAS_SENSOR 0 // as long as BSEC2 is not supported - #define SDA 0 #define SCL 1 #define I2C_SDA SDA diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index d50d0c4f..61203571 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -11,7 +11,7 @@ build_flags = -I variants/diy/v1 ; Meshtastic DIY v1.1 new schematic based on ESP32-WROOM-32 & SX1262/SX1268 modules -[env:meshtastic-diy-v1.1] +[env:meshtastic-diy-v1_1] extends = esp32_base board = esp32doit-devkit-v1 board_level = extra diff --git a/variants/feather_diy/platformio.ini b/variants/feather_diy/platformio.ini index 9b480634..924f9098 100644 --- a/variants/feather_diy/platformio.ini +++ b/variants/feather_diy/platformio.ini @@ -4,6 +4,7 @@ extends = nrf52840_base board = adafruit_feather_nrf52840 board_level = extra build_flags = ${nrf52840_base.build_flags} -Ivariants/feather_diy -Dfeather_diy + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/feather_diy> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/heltec_v2.1/platformio.ini b/variants/heltec_v2.1/platformio.ini index 792a1bb9..29f544f7 100644 --- a/variants/heltec_v2.1/platformio.ini +++ b/variants/heltec_v2.1/platformio.ini @@ -1,4 +1,4 @@ -[env:heltec-v2.1] +[env:heltec-v2_1] ;build_type = debug ; to make it possible to step through our jtag debugger extends = esp32_base board = heltec_wifi_lora_32_V2 diff --git a/variants/heltec_v2/platformio.ini b/variants/heltec_v2/platformio.ini index 8a60942a..3289f4e6 100644 --- a/variants/heltec_v2/platformio.ini +++ b/variants/heltec_v2/platformio.ini @@ -1,4 +1,4 @@ -[env:heltec-v2.0] +[env:heltec-v2_0] ;build_type = debug ; to make it possible to step through our jtag debugger extends = esp32_base board = heltec_wifi_lora_32_V2 diff --git a/variants/heltec_wsl_v3/variant.h b/variants/heltec_wsl_v3/variant.h index bd7a03a9..66415741 100644 --- a/variants/heltec_wsl_v3/variant.h +++ b/variants/heltec_wsl_v3/variant.h @@ -1,3 +1,6 @@ +#define I2C_SCL 47 +#define I2C_SDA 48 + #define LED_PIN LED #define HAS_SCREEN 0 diff --git a/variants/lora_relay_v1/platformio.ini b/variants/lora_relay_v1/platformio.ini index 8df7bd1d..77402aad 100644 --- a/variants/lora_relay_v1/platformio.ini +++ b/variants/lora_relay_v1/platformio.ini @@ -15,6 +15,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/lora_relay_v1 -DTFT_DC=ST7735_RS -DTFT_RST=ST7735_RESET -DSPI_FREQUENCY=27000000 + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/lora_relay_v1> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/lora_relay_v2/platformio.ini b/variants/lora_relay_v2/platformio.ini index 1be8ced1..4439d8a4 100644 --- a/variants/lora_relay_v2/platformio.ini +++ b/variants/lora_relay_v2/platformio.ini @@ -17,6 +17,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/lora_relay_v2 -DSPI_FREQUENCY=27000000 -DTFT_WR=ST7735_SDA -DTFT_SCLK=ST7735_SCK + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/lora_relay_v2> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/pca10056-rc-clock/platformio.ini b/variants/pca10056-rc-clock/platformio.ini index d965753d..0467b141 100644 --- a/variants/pca10056-rc-clock/platformio.ini +++ b/variants/pca10056-rc-clock/platformio.ini @@ -5,4 +5,5 @@ extends = nrf52840_base board = nrf52840_dk_modified # add our variants files to the include and src paths build_flags = ${nrf52_base.build_flags} -Ivariants/pca10056-rc-clock + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/pca10056-rc-clock> \ No newline at end of file diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index 0d1f17d9..34eed88d 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -3,6 +3,7 @@ extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631 -D RAK_4631 + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631> + + + lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/rak4631_epaper/platformio.ini b/variants/rak4631_epaper/platformio.ini index e9c3e872..0871eee4 100644 --- a/variants/rak4631_epaper/platformio.ini +++ b/variants/rak4631_epaper/platformio.ini @@ -3,6 +3,7 @@ extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_epaper -D RAK_4631 + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631_epaper> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/rak4631_epaper_onrxtx/platformio.ini b/variants/rak4631_epaper_onrxtx/platformio.ini index 6e922b84..08c55d12 100644 --- a/variants/rak4631_epaper_onrxtx/platformio.ini +++ b/variants/rak4631_epaper_onrxtx/platformio.ini @@ -4,6 +4,7 @@ board_level = extra extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_epaper -D RAK_4631 + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" -D PIN_EINK_EN=34 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631_epaper_onrxtx> lib_deps = diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index 201c1465..2f043108 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -8,7 +8,8 @@ debug_tool = jlink # define build flags for the TFT_eSPI library - NOTE: WE NOT LONGER USE TFT_eSPI, it was for an earlier version of the TTGO eink screens # -DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30 # add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. -build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo +build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo + -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/t-echo> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/tbeam_v07/platformio.ini b/variants/tbeam_v07/platformio.ini index 22258b64..5428b0e2 100644 --- a/variants/tbeam_v07/platformio.ini +++ b/variants/tbeam_v07/platformio.ini @@ -1,5 +1,5 @@ ; The original TBEAM board without the AXP power chip and a few other changes -[env:tbeam0.7] +[env:tbeam0_7] extends = esp32_base board = ttgo-t-beam board_level = extra diff --git a/variants/tlora_v2_1_16/platformio.ini b/variants/tlora_v2_1_16/platformio.ini index 84ffc1ea..da2a32ce 100644 --- a/variants/tlora_v2_1_16/platformio.ini +++ b/variants/tlora_v2_1_16/platformio.ini @@ -1,4 +1,4 @@ -[env:tlora-v2-1-1.6] +[env:tlora-v2-1-1_6] extends = esp32_base board = ttgo-lora32-v21 build_flags = diff --git a/variants/tlora_v2_1_18/platformio.ini b/variants/tlora_v2_1_18/platformio.ini index 01741ca1..36d6a315 100644 --- a/variants/tlora_v2_1_18/platformio.ini +++ b/variants/tlora_v2_1_18/platformio.ini @@ -1,4 +1,4 @@ -[env:tlora-v2-1-1.8] +[env:tlora-v2-1-1_8] extends = esp32_base board = ttgo-lora32-v21