From a5a2ae3009eb6e339ed1dee451d8b6311063201d Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 29 Jun 2026 23:31:05 -0600 Subject: [PATCH] debug: force AP-only WiFi for LilyGO S3 bringup --- firmware/esp32/overland-controller/config.h | 5 +++ .../overland-controller.ino | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/firmware/esp32/overland-controller/config.h b/firmware/esp32/overland-controller/config.h index 8bd7398..6ebcc91 100644 --- a/firmware/esp32/overland-controller/config.h +++ b/firmware/esp32/overland-controller/config.h @@ -30,3 +30,8 @@ // Bring-up safety: serve a tiny root page to avoid AP client/browser heap crashes. #define LILYGO_BRINGUP_MINIMAL_WEB 1 + +// LilyGO ESP32-S3 bring-up: force AP-only WiFi until AP association is stable. +#define LILYGO_AP_ONLY_BRINGUP 1 +#define LILYGO_AP_CHANNEL 6 +#define LILYGO_AP_MAX_CLIENTS 2 diff --git a/firmware/esp32/overland-controller/overland-controller.ino b/firmware/esp32/overland-controller/overland-controller.ino index fcf188d..aa2f987 100644 --- a/firmware/esp32/overland-controller/overland-controller.ino +++ b/firmware/esp32/overland-controller/overland-controller.ino @@ -1611,7 +1611,32 @@ void resetApConfigToDefaults() { bool startAccessPoint() { +#if LILYGO_AP_ONLY_BRINGUP + WiFi.persistent(false); + WiFi.setSleep(false); + WiFi.disconnect(true, true); + WiFi.softAPdisconnect(true); + delay(250); + WiFi.mode(WIFI_OFF); + delay(250); + WiFi.mode(WIFI_AP); + delay(250); + + IPAddress apIp(192, 168, 4, 1); + IPAddress gateway(192, 168, 4, 1); + IPAddress subnet(255, 255, 255, 0); + WiFi.softAPConfig(apIp, gateway, subnet); + + bool ok = WiFi.softAP( + apSsid.c_str(), + apPassword.c_str(), + LILYGO_AP_CHANNEL, + false, + LILYGO_AP_MAX_CLIENTS + ); +#else bool ok = WiFi.softAP(apSsid.c_str(), apPassword.c_str()); +#endif if (ok) { Serial.println("AP Started"); @@ -2085,8 +2110,10 @@ void connectStaWifi() { WiFi.disconnect(false, false); delay(500); +#if !LILYGO_AP_ONLY_BRINGUP WiFi.mode(WIFI_AP_STA); delay(250); +#endif WiFi.begin(staSsids[i].c_str(), staPasswords[i].c_str()); @@ -4102,7 +4129,11 @@ void setup() { loadWifiConfig(); loadApConfig(); +#if LILYGO_AP_ONLY_BRINGUP + WiFi.mode(WIFI_AP); +#else WiFi.mode(WIFI_AP_STA); +#endif startAccessPoint(); oledShowSetupPage();