diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini new file mode 100644 index 000000000..77b747a1e --- /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 = 921600 +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 d565ec7b5..ac5be3701 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 @@ -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,171 +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@3.5.0 -build_src_filter = - ${arduino_base.build_src_filter} - - - -upload_speed = 921600 -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 -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 -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 - lorol/LittleFS_esp32@^1.0.6 - 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 - -; 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 - ; 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 - 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/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/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/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..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 @@ -238,10 +239,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 dnsServer.start(53, "*", apIP); @@ -254,19 +253,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 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 +268,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 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 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 =