debug: force AP-only WiFi for LilyGO S3 bringup
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user