From 656f32d06b22f3f31646978101d15086223ad1d0 Mon Sep 17 00:00:00 2001 From: tyeth Date: Thu, 11 Apr 2024 13:36:01 +0100 Subject: [PATCH] Fix ESP32 WiFi.h missing + macAddress for arduino-esp32 v3.0.0-rc1 --- platformio.ini | 13 ++++++++++++- src/Wippersnapper.cpp | 18 ++++++------------ src/network_interfaces/Wippersnapper_ESP32.h | 4 +++- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/platformio.ini b/platformio.ini index 8ed0b5ced..85f7f4f73 100644 --- a/platformio.ini +++ b/platformio.ini @@ -76,7 +76,10 @@ lib_deps = ; Common build environment for ESP32 platform [common:esp32] -platform = espressif32 @ ^6.3.2 +platform = espressif32 @ ^6.6.0 +platform_packages = + platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.0-rc1 + platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1 lib_ignore = WiFiNINA monitor_filters = esp32_exception_decoder, time @@ -113,6 +116,7 @@ extends = common:esp32 board = featheresp32 build_flags = -DARDUINO_FEATHER_ESP32 board_build.filesystem = littlefs +board_build.partitions = min_spiffs.csv ; Adafruit ESP32 Feather V2 @@ -169,6 +173,8 @@ extra_scripts = pre:rename_usb_config.py ; Adafruit Feather ESP32-S3 TFT [env:adafruit_feather_esp32s3_tft] extends = common:esp32 +build_type = debug +debug_tool = esp-builtin board = adafruit_feather_esp32s3_tft build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S3_TFT ;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1 @@ -202,6 +208,9 @@ extra_scripts = pre:rename_usb_config.py [env:adafruit_qtpy_esp32] extends = common:esp32 board = adafruit_qtpy_esp32 +board_build.partitions = default_8MB.csv +board_build.filesystem = littlefs +build_type = debug build_flags = -DARDUINO_ADAFRUIT_QTPY_ESP32 ; Adafruit QT Py ESP32-C3 @@ -209,6 +218,8 @@ build_flags = -DARDUINO_ADAFRUIT_QTPY_ESP32 extends = common:esp32 board = adafruit_qtpy_esp32c3 build_flags = -DARDUINO_ADAFRUIT_QTPY_ESP32C3 +board_build.filesystem = littlefs +board_build.partitions = min_spiffs.csv ; Adafruit QT Py ESP32-S2 [env:adafruit_qtpy_esp32s2] diff --git a/src/Wippersnapper.cpp b/src/Wippersnapper.cpp index fd6ff3292..86d1a8d47 100644 --- a/src/Wippersnapper.cpp +++ b/src/Wippersnapper.cpp @@ -1673,9 +1673,7 @@ void cbErrorTopic(char *errorData, uint16_t len) { #endif // WDT reset - for (;;) { - delay(100); - } + WS.haltError("IO MQTT Ban Error"); } /**************************************************************************/ @@ -2468,17 +2466,17 @@ void Wippersnapper::runNetFSM() { */ /**************************************************************************/ void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor) { - WS_DEBUG_PRINT("ERROR [WDT RESET]: "); - WS_DEBUG_PRINTLN(error); for (;;) { + WS_DEBUG_PRINT("ERROR [WDT RESET]: "); + WS_DEBUG_PRINTLN(error); // let the WDT fail out and reset! statusLEDSolid(ledStatusColor); #ifndef ARDUINO_ARCH_ESP8266 - delay(100); + delay(1000); #else // Calls to delay() and yield() feed the ESP8266's // hardware and software watchdog timers, delayMicroseconds does not. - delayMicroseconds(100); + delayMicroseconds(1000); #endif } } @@ -2562,11 +2560,7 @@ void Wippersnapper::enableWDT(int timeoutMS) { Watchdog.disable(); #endif if (Watchdog.enable(timeoutMS) == 0) { - WS_DEBUG_PRINTLN("ERROR: WDT initialization failure!"); - setStatusLEDColor(LED_ERROR); - for (;;) { - delay(100); - } + WS.haltError("WDT initialization failure!"); } } diff --git a/src/network_interfaces/Wippersnapper_ESP32.h b/src/network_interfaces/Wippersnapper_ESP32.h index 623b95979..e9742ae64 100644 --- a/src/network_interfaces/Wippersnapper_ESP32.h +++ b/src/network_interfaces/Wippersnapper_ESP32.h @@ -23,6 +23,8 @@ #include "Adafruit_MQTT.h" #include "Adafruit_MQTT_Client.h" #include "Arduino.h" +#include "WiFi.h" + #include extern Wippersnapper WS; @@ -133,7 +135,7 @@ class Wippersnapper_ESP32 : public Wippersnapper { /********************************************************/ void getMacAddr() { uint8_t mac[6] = {0}; - WiFi.macAddress(mac); + Network.macAddress(mac); memcpy(WS._macAddr, mac, sizeof(mac)); }