Fix WiFi file transfer crash by adding initialization delay
Fixed a critical bug where WiFi file transfer would crash and lock the device when accessed directly. The issue was caused by missing initialization time after WiFi.mode(WIFI_STA) call. Root cause: - Hotspot mode includes delay(100) after WiFi.mode(WIFI_AP) to allow hardware initialization - Join Network mode was missing this delay after WiFi.mode(WIFI_STA) - Without the delay, ESP32 WiFi hardware wasn't properly initialized - This caused crashes when starting the web server in STA mode Fix: - Added delay(100) after WiFi.mode(WIFI_STA) in onNetworkModeSelected() - Matches the proven initialization pattern used in hotspot mode - Comment added to explain the purpose of the delay This explains why going to hotspot first and exiting worked - hotspot mode properly initialized the WiFi hardware, which remained stable for subsequent file transfer operations.
This commit is contained in:
parent
d4ae108d9b
commit
0a44e58d4e
@ -138,6 +138,7 @@ void CrossPointWebServerActivity::onNetworkModeSelected(const NetworkMode mode)
|
||||
// STA mode - launch WiFi selection
|
||||
Serial.printf("[%lu] [WEBACT] Turning on WiFi (STA mode)...\n", millis());
|
||||
WiFi.mode(WIFI_STA);
|
||||
delay(100); // Allow WiFi hardware to initialize before proceeding
|
||||
|
||||
state = WebServerActivityState::WIFI_SELECTION;
|
||||
Serial.printf("[%lu] [WEBACT] Launching WifiSelectionActivity...\n", millis());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user