Add T-Beam WiFi button toggle

This commit is contained in:
mikecarper committed 2026-08-15 18:12:09 -07:00
1 parent 843d309e2b
commit bd2e668961
15 files changed
+263 -45

No files matched your search

+9
View File
@@ -321,6 +321,15 @@ bool WiFiSetupPortal::begin(const char* ap_name, SaveCallback save_callback, voi
return true;
}
void WiFiSetupPortal::stop() {
_active = false;
}
bool WiFiSetupPortal::isStopping() const {
const PortalImpl* impl = static_cast<const PortalImpl*>(_impl);
return impl && impl->task != nullptr;
}
void WiFiSetupPortal::configureRecovery(const char* ssid, const char* password,
uint32_t interval_ms,
uint32_t initial_delay_ms) {
+2
View File
@@ -14,6 +14,7 @@ public:
// Starts an open setup AP and captive HTTP form. The AP remains available
// after a failed association and shuts down shortly after a successful one.
bool begin(const char* ap_name, SaveCallback save_callback, void* context);
void stop();
// Retry interval is the steady-state cadence. initial_delay_ms defaults to
// that interval, but callers that opened the portal partway through an
// outage can preserve the original reconnect schedule with a shorter delay.
@@ -21,6 +22,7 @@ public:
uint32_t interval_ms, uint32_t initial_delay_ms = 0);
bool isActive() const { return _active; }
bool isStopping() const;
IPAddress apIP() const { return IPAddress(192, 168, 4, 1); }
// Companion WiFi builds keep their runtime credentials in NVS.
@@ -7,6 +7,15 @@ void SerialWifiInterface::begin(int port) {
server.begin(port);
}
void SerialWifiInterface::end() {
disable();
if (client) client.stop();
server.end();
deviceConnected = false;
resetReceivedFrameHeader();
clearBuffers();
}
// ---------- public methods
void SerialWifiInterface::enable() {
if (_isEnabled) return;
+1
View File
@@ -45,6 +45,7 @@ public:
}
void begin(int port);
void end();
// BaseSerialInterface methods
void enable() override;