Merge ln882x-shutdown-disconnect; shorten the powerdown comments and allow its delay

This commit is contained in:
J. Nick Koston
2026-10-04 21:55:49 -05:00
2 changed files with 3 additions and 7 deletions
+2 -4
View File
@@ -767,9 +767,7 @@ void WiFiComponent::restart_adapter() {
}
void WiFiComponent::on_powerdown() {
// Leave the AP before a reboot or deep sleep, after teardown has let the
// API say goodbye: otherwise the AP still holds the association when the
// device comes back and the first connects can stall or fail.
// Leave the AP so it no longer holds the association when we come back.
if (!this->is_connected())
return;
ESP_LOGD(TAG, "Disconnecting before powerdown");
@@ -778,7 +776,7 @@ void WiFiComponent::on_powerdown() {
#else
this->wifi_disconnect_();
#endif
delay(100); // let the deauth go out before the reset
delay(100); // NOLINT: once per reboot or deep sleep, lets the deauth go out
}
void WiFiComponent::loop() {
@@ -791,9 +791,7 @@ network::IPAddress WiFiComponent::wifi_soft_ap_ip() { return {WiFi.softAPIP()};
#ifdef USE_LN882X
void WiFiComponent::wifi_powerdown_disconnect_() {
// The SDK call directly: LibreTiny's WiFi.disconnect() also frees the SSID
// its event handlers read, which once hung a reboot until the watchdog.
wifi_sta_disconnect();
wifi_sta_disconnect(); // not WiFi.disconnect(): it frees the SSID its event handlers read
}
#endif