[wifi] Disconnect LN882x in on_powerdown, after the API has said goodbye

This commit is contained in:
J. Nick Koston
2026-10-04 21:03:05 -05:00
parent f34847a92c
commit 671a165dcd
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -507,7 +507,7 @@ class WiFiComponent final : public Component {
/// Setup WiFi interface.
void setup() override;
#ifdef USE_LN882X
void on_shutdown() override;
void on_powerdown() override;
#endif
void start();
void dump_config() override;
@@ -790,9 +790,10 @@ network::IPAddress WiFiComponent::wifi_soft_ap_ip() { return {WiFi.softAPIP()};
#endif // USE_WIFI_AP
#ifdef USE_LN882X
void WiFiComponent::on_shutdown() {
// Leave the AP before a reboot: otherwise it still holds the association
// when the chip comes back and the first connects can stall or fail.
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
// chip comes back and the first connects can stall or fail.
if (!this->is_connected())
return;
ESP_LOGD(TAG, "Disconnecting before reboot");