1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 16:25:50 +00:00

anotehr thread safety issue

This commit is contained in:
J. Nick Koston
2025-11-17 23:17:36 -06:00
parent 8d7090fcd6
commit 2ee5cc6f22

View File

@@ -50,9 +50,8 @@ void CaptivePortal::handle_wifisave(AsyncWebServerRequest *request) {
ESP_LOGI(TAG, "Requested WiFi Settings Change:"); ESP_LOGI(TAG, "Requested WiFi Settings Change:");
ESP_LOGI(TAG, " SSID='%s'", ssid.c_str()); ESP_LOGI(TAG, " SSID='%s'", ssid.c_str());
ESP_LOGI(TAG, " Password=" LOG_SECRET("'%s'"), psk.c_str()); ESP_LOGI(TAG, " Password=" LOG_SECRET("'%s'"), psk.c_str());
wifi::global_wifi_component->save_wifi_sta(ssid, psk); // Defer save to main loop thread to avoid NVS operations from HTTP thread
// Don't call start_scanning() from HTTP thread - WiFi operations must happen on main loop this->defer([ssid, psk]() { wifi::global_wifi_component->save_wifi_sta(ssid, psk); });
// The force_scan_after_provision_ flag will trigger scan on next retry cycle
request->redirect(ESPHOME_F("/?save")); request->redirect(ESPHOME_F("/?save"));
} }