From bf3306fbc8ec0452b2f41966855df88f7ef4b1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 9 Sep 2022 22:31:30 +0200 Subject: [PATCH 1/6] use the new ESP Framework for our older boards too --- platformio.ini | 35 ++++++++++++++---------- src/FSCommon.h | 11 ++------ src/mesh/http/ContentHandler.cpp | 2 -- src/mesh/http/WiFiAPClient.cpp | 21 +++----------- src/platform/esp32/ESP32CryptoEngine.cpp | 10 +------ 5 files changed, 27 insertions(+), 52 deletions(-) diff --git a/platformio.ini b/platformio.ini index e1dbe47ef..def7901ed 100644 --- a/platformio.ini +++ b/platformio.ini @@ -14,7 +14,7 @@ default_envs = tbeam ;default_envs = tlora-v2 ;default_envs = tlora-v2-1-1.6 ;default_envs = lora-relay-v1 # nrf board -; default_envs = t-echo +;default_envs = t-echo ;default_envs = nrf52840dk-geeksville ;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here ;default_envs = nano-g1 @@ -90,7 +90,7 @@ lib_deps = ; Common settings for ESP targes, mixin with extends = esp32_base [esp32_base] extends = arduino_base -platform = espressif32@3.5.0 +platform = espressif32 build_src_filter = ${arduino_base.build_src_filter} - - - upload_speed = 115200 @@ -100,24 +100,33 @@ debug_init_break = tbreak setup # 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 -lnimble -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 + ${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 + lib_deps = ${arduino_base.lib_deps} ${networking_base.lib_deps} ${environmental_base.lib_deps} - https://github.com/meshtastic/esp32_https_server.git + https://github.com/caveman99/esp32_https_server.git h2zero/NimBLE-Arduino@1.4.0 arduino-libraries/NTPClient@^3.1.0 - lorol/LittleFS_esp32@^1.0.6 - https://github.com/lewisxhe/XPowersLib.git - + https://github.com/lewisxhe/XPowersLib.git + lib_ignore = segger_rtt ESP32 BLE Arduino platform_packages = - framework-arduinoespressif32@https://github.com/meshtastic/arduino-esp32.git#4cde0f5d412d2695184f32e8a47e9bea57b45276 + framework-arduinoespressif32@3.20004.220825 ; leave this commented out to avoid breaking Windows ;upload_port = /dev/ttyUSB0 @@ -205,8 +214,6 @@ lib_deps = lib_ignore = mathertel/OneButton@^2.0.3 - - [esp32s3_base] extends = arduino_base platform = espressif32 @@ -237,9 +244,7 @@ lib_deps = ${arduino_base.lib_deps} ${networking_base.lib_deps} ${environmental_base.lib_deps} - ; https://github.com/meshtastic/esp32_https_server.git - ; PR has been submitted and can be deleted after merging ,https://github.com/meshtastic/esp32_https_server/pull/1 - https://github.com/lewisxhe/esp32_https_server.git + https://github.com/meshtastic/esp32_https_server.git h2zero/NimBLE-Arduino@1.4.0 arduino-libraries/NTPClient@^3.1.0 https://github.com/lewisxhe/XPowersLib.git diff --git a/src/FSCommon.h b/src/FSCommon.h index 4336e88dd..38ca403b1 100644 --- a/src/FSCommon.h +++ b/src/FSCommon.h @@ -23,16 +23,9 @@ #endif #if defined(ARCH_ESP32) -#if CONFIG_IDF_TARGET_ESP32S3 -#include //esp32s3 uses the framework's built-in LittleFS -#define FSCom LittleFS -#else // ESP32 version -#include "LITTLEFS.h" -#define FSCom LITTLEFS -#endif - - +#include "LittleFS.h" +#define FSCom LittleFS #define FSBegin() FSCom.begin(true) #define FILE_O_WRITE "w" #define FILE_O_READ "r" diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index 298fce3c4..6763d70fe 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -48,8 +48,6 @@ using namespace httpsserver; HTTPClient httpClient; #define DEST_FS_USES_LITTLEFS -#define ESP_ARDUINO_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch)) -#define ESP_ARDUINO_VERSION ESP_ARDUINO_VERSION_VAL(1, 0, 4) // We need to specify some content-type mapping, so the resources get delivered with the // right content type and are displayed correctly in the browser diff --git a/src/mesh/http/WiFiAPClient.cpp b/src/mesh/http/WiFiAPClient.cpp index f7868106f..576492a2a 100644 --- a/src/mesh/http/WiFiAPClient.cpp +++ b/src/mesh/http/WiFiAPClient.cpp @@ -238,10 +238,8 @@ bool initWifi(bool forceSoftAP) WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); DEBUG_MSG("MY IP AP ADDRESS: %s\n", WiFi.softAPIP().toString().c_str()); -#if !CONFIG_IDF_TARGET_ESP32S3 // This is needed to improve performance. - esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving -#endif + // esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving dnsServer.start(53, "*", apIP); @@ -254,19 +252,14 @@ bool initWifi(bool forceSoftAP) WiFi.setHostname(ourHost); WiFi.onEvent(WiFiEvent); -#if !CONFIG_IDF_TARGET_ESP32S3 // This is needed to improve performance. - esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving -#endif + // esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving WiFi.onEvent( [](WiFiEvent_t event, WiFiEventInfo_t info) { Serial.print("\nWiFi lost connection. Reason: "); - #if CONFIG_IDF_TARGET_ESP32S3 Serial.println(info.wifi_sta_disconnected.reason); - wifiDisconnectReason = info.wifi_sta_disconnected.reason; - #else - Serial.println(info.disconnected.reason); + /* If we are disconnected from the AP for some reason, save the error code. @@ -274,15 +267,9 @@ bool initWifi(bool forceSoftAP) For a reference to the codes: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html#wi-fi-reason-code */ - wifiDisconnectReason = info.disconnected.reason; - #endif - + wifiDisconnectReason = info.wifi_sta_disconnected.reason; }, -#if CONFIG_IDF_TARGET_ESP32S3 WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED); -#else - WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED); -#endif DEBUG_MSG("JOINING WIFI soon: ssid=%s\n", wifiName); wifiReconnect = new Periodic("WifiConnect", reconnectWiFi); diff --git a/src/platform/esp32/ESP32CryptoEngine.cpp b/src/platform/esp32/ESP32CryptoEngine.cpp index 60026c4db..4bbbc4ad4 100644 --- a/src/platform/esp32/ESP32CryptoEngine.cpp +++ b/src/platform/esp32/ESP32CryptoEngine.cpp @@ -1,16 +1,8 @@ #include "CryptoEngine.h" #include "configuration.h" -#if CONFIG_IDF_TARGET_ESP32S3 #include "mbedtls/aes.h" -#else -#include "crypto/includes.h" -#include "crypto/common.h" -// #include "esp_system.h" -#include "crypto/aes.h" -#include "crypto/aes_wrap.h" -#include "mbedtls/aes.h" -#endif + class ESP32CryptoEngine : public CryptoEngine From 3102777a71b381363c6a060a066c3df8ebcb4cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 10 Sep 2022 20:53:23 +0200 Subject: [PATCH 2/6] Update platformio.ini --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index def7901ed..5a7cb8d9b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -126,7 +126,7 @@ lib_ignore = segger_rtt ESP32 BLE Arduino platform_packages = - framework-arduinoespressif32@3.20004.220825 + framework-arduinoespressif32 ; leave this commented out to avoid breaking Windows ;upload_port = /dev/ttyUSB0 From e376a3a28e01b217a3f560e83513f47c5fcd5134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 12 Sep 2022 13:40:20 +0200 Subject: [PATCH 3/6] just use the general toolkit --- variants/tbeam/platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/tbeam/platformio.ini b/variants/tbeam/platformio.ini index 637a998d0..578a74f7b 100644 --- a/variants/tbeam/platformio.ini +++ b/variants/tbeam/platformio.ini @@ -2,7 +2,6 @@ [env:tbeam] extends = esp32_base board = ttgo-t-beam -platform_packages = framework-arduinoespressif32@https://github.com/meshtastic/arduino-esp32.git#4cde0f5d412d2695184f32e8a47e9bea57b45276 lib_deps = ${esp32_base.lib_deps} build_flags = From eac2613743ca8e0116bbb39112169d0d1fe57d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 12 Sep 2022 14:02:21 +0200 Subject: [PATCH 4/6] make platformio.ini even more modular --- arch/esp32/esp32.ini | 52 +++++++++ arch/esp32/esp32s3.ini | 46 ++++++++ arch/nrf52/nrf52.ini | 20 ++++ arch/nrf52/nrf52840.ini | 14 +++ arch/portduino/portduino.ini | 19 ++++ arch/rp2040/rp2040.ini | 19 ++++ arch/stm32/stm32wl5e.ini | 19 ++++ platformio.ini | 178 +----------------------------- variants/portduino/platformio.ini | 20 ---- 9 files changed, 193 insertions(+), 194 deletions(-) create mode 100644 arch/esp32/esp32.ini create mode 100644 arch/esp32/esp32s3.ini create mode 100644 arch/nrf52/nrf52.ini create mode 100644 arch/nrf52/nrf52840.ini create mode 100644 arch/portduino/portduino.ini create mode 100644 arch/rp2040/rp2040.ini create mode 100644 arch/stm32/stm32wl5e.ini diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini new file mode 100644 index 000000000..2d4d96a18 --- /dev/null +++ b/arch/esp32/esp32.ini @@ -0,0 +1,52 @@ +; Common settings for ESP targes, mixin with extends = esp32_base +[esp32_base] +extends = arduino_base +platform = espressif32 +build_src_filter = + ${arduino_base.build_src_filter} - - - +upload_speed = 115200 +debug_init_break = tbreak setup + +# 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 + +lib_deps = + ${arduino_base.lib_deps} + ${networking_base.lib_deps} + ${environmental_base.lib_deps} + https://github.com/caveman99/esp32_https_server.git + h2zero/NimBLE-Arduino@1.4.0 + arduino-libraries/NTPClient@^3.1.0 + https://github.com/lewisxhe/XPowersLib.git + +lib_ignore = + segger_rtt + ESP32 BLE Arduino +platform_packages = + framework-arduinoespressif32 + +; leave this commented out to avoid breaking Windows +;upload_port = /dev/ttyUSB0 +;monitor_port = /dev/ttyUSB0 + +; Please don't delete these lines. JM uses them. +;upload_port = /dev/cu.SLAB_USBtoUART +;monitor_port = /dev/cu.SLAB_USBtoUART + +; 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/esp32/esp32s3.ini b/arch/esp32/esp32s3.ini new file mode 100644 index 000000000..0497f1c95 --- /dev/null +++ b/arch/esp32/esp32s3.ini @@ -0,0 +1,46 @@ +[esp32s3_base] +extends = arduino_base +platform = espressif32 +build_src_filter = + ${arduino_base.build_src_filter} - - - +upload_speed = 961200 +monitor_speed = 115200 +debug_init_break = tbreak setup + +# 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 + +lib_deps = + ${arduino_base.lib_deps} + ${networking_base.lib_deps} + ${environmental_base.lib_deps} + https://github.com/meshtastic/esp32_https_server.git + h2zero/NimBLE-Arduino@1.4.0 + arduino-libraries/NTPClient@^3.1.0 + https://github.com/lewisxhe/XPowersLib.git + + +lib_ignore = + segger_rtt + ESP32 BLE Arduino +platform_packages = + framework-arduinoespressif32@ 3.20004.220825 + +; 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 new file mode 100644 index 000000000..a79ebda48 --- /dev/null +++ b/arch/nrf52/nrf52.ini @@ -0,0 +1,20 @@ +[nrf52_base] +; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files +; platform = nordicnrf52 ;pending https://github.com/platformio/builder-framework-arduino-nrf5/pull/7 +platform = https://github.com/meshtastic/platform-nordicnrf52.git#merge + +extends = arduino_base +build_type = debug ; I'm debugging with ICE a lot now +; note: liboberon provides the AES256 implementation for NRF52 (though not using the hardware acceleration of the NRF52840 - FIXME) +build_flags = + ${arduino_base.build_flags} -Wno-unused-variable + -Isrc/platform/nrf52 +build_src_filter = + ${arduino_base.build_src_filter} - - - - - - - - +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/nrf52840.ini b/arch/nrf52/nrf52840.ini new file mode 100644 index 000000000..61995378e --- /dev/null +++ b/arch/nrf52/nrf52840.ini @@ -0,0 +1,14 @@ +[nrf52840_base] +extends = nrf52_base +build_flags = ${nrf52_base.build_flags} +lib_deps = + ${arduino_base.lib_deps} + ${environmental_base.lib_deps} + https://github.com/Kongduino/Adafruit_nRFCrypto.git + +; 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 new file mode 100644 index 000000000..b1f793fe6 --- /dev/null +++ b/arch/portduino/portduino.ini @@ -0,0 +1,19 @@ +; The Portduino based sim environment on top of any host OS, all hardware will be simulated +[portduino_base] +build_src_filter = + ${env.build_src_filter} + - + - + - + - + - + - + - + - + +<../variants/portduino> +lib_deps = + ${env.lib_deps} + ${networking_base.lib_deps} + rweather/Crypto + https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74 +build_flags = ${arduino_base.build_flags} -Isrc/platform/portduino diff --git a/arch/rp2040/rp2040.ini b/arch/rp2040/rp2040.ini new file mode 100644 index 000000000..742909e59 --- /dev/null +++ b/arch/rp2040/rp2040.ini @@ -0,0 +1,19 @@ +; Common settings for rp2040 Processor based targets +[rp2040_base] +platform = https://github.com/maxgerhardt/platform-raspberrypi.git +extends = arduino_base +board_build.core = earlephilhower +board_build.filesystem_size = 0.5m +build_flags = + ${arduino_base.build_flags} -Wno-unused-variable + -Isrc/platform/rp2040 + -D__PLAT_RP2040__ +# -D _POSIX_THREADS +build_src_filter = + ${arduino_base.build_src_filter} - - - - - - - - +lib_ignore = + BluetoothOTA +lib_deps = + ${arduino_base.lib_deps} + ${environmental_base.lib_deps} + https://github.com/kokke/tiny-AES-c.git diff --git a/arch/stm32/stm32wl5e.ini b/arch/stm32/stm32wl5e.ini new file mode 100644 index 000000000..862d1c9ce --- /dev/null +++ b/arch/stm32/stm32wl5e.ini @@ -0,0 +1,19 @@ +[stm32wl5e_base] +platform = ststm32 +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} + https://github.com/jgromes/RadioLib.git + https://github.com/kokke/tiny-AES-c.git +lib_ignore = + mathertel/OneButton@^2.0.3 diff --git a/platformio.ini b/platformio.ini index 5a7cb8d9b..c00bec531 100644 --- a/platformio.ini +++ b/platformio.ini @@ -24,7 +24,9 @@ default_envs = tbeam ;default_envs = m5stack-coreink ;default_envs = rak4631 -extra_configs = variants/*/platformio.ini +extra_configs = + arch/*/*.ini + variants/*/platformio.ini [env] extra_scripts = bin/platformio-custom.py @@ -87,176 +89,4 @@ lib_deps = adafruit/Adafruit MCP9808 Library@^2.0.0 adafruit/Adafruit INA260 Library@^1.5.0 adafruit/Adafruit INA219@^1.2.0 -; Common settings for ESP targes, mixin with extends = esp32_base -[esp32_base] -extends = arduino_base -platform = espressif32 -build_src_filter = - ${arduino_base.build_src_filter} - - - -upload_speed = 115200 -debug_init_break = tbreak setup - -# 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 - -lib_deps = - ${arduino_base.lib_deps} - ${networking_base.lib_deps} - ${environmental_base.lib_deps} - https://github.com/caveman99/esp32_https_server.git - h2zero/NimBLE-Arduino@1.4.0 - arduino-libraries/NTPClient@^3.1.0 - https://github.com/lewisxhe/XPowersLib.git - -lib_ignore = - segger_rtt - ESP32 BLE Arduino -platform_packages = - framework-arduinoespressif32 - -; leave this commented out to avoid breaking Windows -;upload_port = /dev/ttyUSB0 -;monitor_port = /dev/ttyUSB0 - -; Please don't delete these lines. JM uses them. -;upload_port = /dev/cu.SLAB_USBtoUART -;monitor_port = /dev/cu.SLAB_USBtoUART - -; customize the partition table -; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables -board_build.partitions = partition-table.csv - -[nrf52_base] -; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files -; platform = nordicnrf52 ;pending https://github.com/platformio/builder-framework-arduino-nrf5/pull/7 -platform = https://github.com/meshtastic/platform-nordicnrf52.git#merge - -extends = arduino_base -build_type = debug ; I'm debugging with ICE a lot now -; note: liboberon provides the AES256 implementation for NRF52 (though not using the hardware acceleration of the NRF52840 - FIXME) -build_flags = - ${arduino_base.build_flags} -Wno-unused-variable - -Isrc/platform/nrf52 -build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - -lib_ignore = - BluetoothOTA - -[nrf52840_base] -extends = nrf52_base -build_flags = ${nrf52_base.build_flags} -lib_deps = - ${arduino_base.lib_deps} - ${environmental_base.lib_deps} - https://github.com/Kongduino/Adafruit_nRFCrypto.git - -; Note: By default no lora device is created for this build - it uses a simulated interface -[env:nrf52840dk] -extends = nrf52840_base -board = nrf52840_dk - -; 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 - -; Common settings for rp2040 Processor based targets -[rp2040_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git -extends = arduino_base -board_build.core = earlephilhower -board_build.filesystem_size = 0.5m -build_flags = - ${arduino_base.build_flags} -Wno-unused-variable - -Isrc/platform/rp2040 - -D__PLAT_RP2040__ -# -D _POSIX_THREADS -build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - -lib_ignore = - BluetoothOTA -lib_deps = - ${arduino_base.lib_deps} - ${environmental_base.lib_deps} - https://github.com/kokke/tiny-AES-c.git - -[stm32wl5e_base] -platform = ststm32 -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} - https://github.com/jgromes/RadioLib.git - https://github.com/kokke/tiny-AES-c.git -lib_ignore = - mathertel/OneButton@^2.0.3 - -[esp32s3_base] -extends = arduino_base -platform = espressif32 -build_src_filter = - ${arduino_base.build_src_filter} - - - -upload_speed = 961200 -monitor_speed = 115200 -debug_init_break = tbreak setup - -# 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 - -lib_deps = - ${arduino_base.lib_deps} - ${networking_base.lib_deps} - ${environmental_base.lib_deps} - https://github.com/meshtastic/esp32_https_server.git - h2zero/NimBLE-Arduino@1.4.0 - arduino-libraries/NTPClient@^3.1.0 - https://github.com/lewisxhe/XPowersLib.git - - -lib_ignore = - segger_rtt - ESP32 BLE Arduino -platform_packages = - framework-arduinoespressif32@ 3.20004.220825 - -; 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/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 6d94cd811..c95ae37fe 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,23 +1,3 @@ -; The Portduino based sim environment on top of any host OS, all hardware will be simulated -[portduino_base] -build_src_filter = - ${env.build_src_filter} - - - - - - - - - - - - - - - - - +<../variants/portduino> -lib_deps = - ${env.lib_deps} - ${networking_base.lib_deps} - rweather/Crypto - https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74 -build_flags = ${arduino_base.build_flags} -Isrc/platform/portduino - [env:native] platform = https://github.com/meshtastic/platform-native.git build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino From 2d81d359b8b5e00a50421d6358fff03a3cff4cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 19 Sep 2022 09:36:13 +0200 Subject: [PATCH 5/6] Update esp32.ini Update arch by hand --- arch/esp32/esp32.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index 2d4d96a18..77b747a1e 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -4,7 +4,7 @@ extends = arduino_base platform = espressif32 build_src_filter = ${arduino_base.build_src_filter} - - - -upload_speed = 115200 +upload_speed = 921600 debug_init_break = tbreak setup # Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging. From 4c6f3ead6047b2438bd54cb7e9d5b0d3c449b02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 19 Sep 2022 12:05:57 +0200 Subject: [PATCH 6/6] fixing I2C requests and Wifi Power Saving Modes. --- src/input/kbI2cBase.cpp | 5 +++++ src/mesh/http/WiFiAPClient.cpp | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index 4d94f31b0..e12b52e5b 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -3,6 +3,7 @@ #include extern uint8_t cardkb_found; +extern uint8_t faceskb_found; KbI2cBase::KbI2cBase(const char *name) : concurrency::OSThread(name) { @@ -11,6 +12,10 @@ KbI2cBase::KbI2cBase(const char *name) : concurrency::OSThread(name) int32_t KbI2cBase::runOnce() { + if ((cardkb_found != CARDKB_ADDR) && (faceskb_found != CARDKB_ADDR)){ + // Input device is not detected. + return INT32_MAX; + } InputEvent e; e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; e.source = this->_originName; diff --git a/src/mesh/http/WiFiAPClient.cpp b/src/mesh/http/WiFiAPClient.cpp index 576492a2a..db72cb760 100644 --- a/src/mesh/http/WiFiAPClient.cpp +++ b/src/mesh/http/WiFiAPClient.cpp @@ -10,6 +10,7 @@ #include "target_specific.h" #include #include +#include #include #include @@ -239,7 +240,7 @@ bool initWifi(bool forceSoftAP) DEBUG_MSG("MY IP AP ADDRESS: %s\n", WiFi.softAPIP().toString().c_str()); // This is needed to improve performance. - // esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving + esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving dnsServer.start(53, "*", apIP); @@ -253,7 +254,7 @@ bool initWifi(bool forceSoftAP) WiFi.onEvent(WiFiEvent); // This is needed to improve performance. - // esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving + esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving WiFi.onEvent( [](WiFiEvent_t event, WiFiEventInfo_t info) {