Skip to content

Commit

Permalink
Fix ESP32 WiFi.h missing + macAddress for arduino-esp32 v3.0.0-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Apr 14, 2024
1 parent 18ff2d1 commit 656f32d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
13 changes: 12 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -202,13 +208,18 @@ 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
[env:adafruit_qtpy_esp32c3]
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]
Expand Down
18 changes: 6 additions & 12 deletions src/Wippersnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1673,9 +1673,7 @@ void cbErrorTopic(char *errorData, uint16_t len) {
#endif

// WDT reset
for (;;) {
delay(100);
}
WS.haltError("IO MQTT Ban Error");
}

/**************************************************************************/
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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!");
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/network_interfaces/Wippersnapper_ESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
#include "Arduino.h"
#include "WiFi.h"

#include <WiFiClientSecure.h>
extern Wippersnapper WS;

Expand Down Expand Up @@ -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));
}

Expand Down

0 comments on commit 656f32d

Please sign in to comment.