Attempt to fix WiFi file transfer crash by adding initialization delay

Fixed a simple 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, WiFi 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 commit is contained in:
swwilshub 2026-01-09 13:05:35 +00:00 committed by GitHub
parent d4ae108d9b
commit f1ee16779d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -138,7 +138,8 @@ void CrossPointWebServerActivity::onNetworkModeSelected(const NetworkMode mode)
// STA mode - launch WiFi selection // STA mode - launch WiFi selection
Serial.printf("[%lu] [WEBACT] Turning on WiFi (STA mode)...\n", millis()); Serial.printf("[%lu] [WEBACT] Turning on WiFi (STA mode)...\n", millis());
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
delay(100); // Allow WiFi hardware to initialize before proceeding
state = WebServerActivityState::WIFI_SELECTION; state = WebServerActivityState::WIFI_SELECTION;
Serial.printf("[%lu] [WEBACT] Launching WifiSelectionActivity...\n", millis()); Serial.printf("[%lu] [WEBACT] Launching WifiSelectionActivity...\n", millis());
enterNewActivity(new WifiSelectionActivity(renderer, mappedInput, enterNewActivity(new WifiSelectionActivity(renderer, mappedInput,