[wifi] Keep a second fallback AP start from resetting the LN882x (#20168)

This commit is contained in:
J. Nick Koston
2026-10-05 13:58:35 +13:00
committed by GitHub
parent 60e511282a
commit 66eec7af15
2 changed files with 21 additions and 0 deletions
@@ -28,6 +28,11 @@ extern "C" {
}
#endif
#ifdef USE_LN882X
#include <WiFiPrivate.h>
#undef DATA // clashes with setup_priority::DATA
#endif
#include "esphome/core/application.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
@@ -770,6 +775,13 @@ bool WiFiComponent::wifi_start_ap_(const WiFiAP &ap) {
yield();
#ifdef USE_LN882X
// LibreTiny's LN882H softAP() points ap.bssid at a static array and frees it
// on the next call, tripping FreeRTOS's configASSERT until the watchdog
// resets the chip. Clear it so that a second AP start frees nothing.
static_cast<WiFiData *>(WiFi.data)->ap.bssid = nullptr;
#endif
return WiFi.softAP(ap.ssid_.c_str(), ap.password_.empty() ? NULL : ap.password_.c_str(),
ap.has_channel() ? ap.get_channel() : 1, ap.get_hidden());
}
@@ -0,0 +1,9 @@
wifi:
networks:
- ssid: MySSID
password: password1
ap:
ssid: Fallback Hotspot
password: password2
captive_portal: