Keep the console responsive during MQTT shutdown

This commit is contained in:
mikecarper committed 2026-10-05 19:05:58 -07:00
1 parent d17519fe7f
commit f05524a4a2
15 files changed
+634 -63

No files matched your search

+2 -1
View File
@@ -2604,7 +2604,8 @@ void MyMesh::loop() {
sampleTelemetryHistory();
#endif
#ifdef WITH_MQTT_BRIDGE
// bridge.loop() is now handled by FreeRTOS task on Core 0 - no need to call it here
// TLS runs on Core 0; the radio loop reaps only an acknowledged CLI stop.
if (bridge && bridge->isRunning()) bridge->loop();
#endif
#ifdef WITH_ESPNOW_BRIDGE
if (espnow_bridge.isRunning()) espnow_bridge.loop();
+14
View File
@@ -610,6 +610,7 @@ public:
_alerter.setBridge(nullptr);
return !bridge || !bridge->isRunning();
}
if (bridge && bridge->isStopping()) return false;
// Give the WiFi station to MQTT while it associates. ESP-NOW is restarted
// after the AP channel is known, which avoids a raw ESP-NOW-only session
// pinning the station to a different channel.
@@ -702,6 +703,9 @@ public:
}
bool setBridgeState(bool enable) override {
#ifdef WITH_MQTT_BRIDGE
if (enable && bridge && bridge->isStopping()) return false;
#endif
#if defined(WITH_MQTT_BRIDGE) && defined(WITH_ESPNOW_BRIDGE)
if (!enable) return setEspNowBridgeState(false) && setMqttBridgeState(false);
const bool mqtt_ok = _prefs.bridge_enabled
@@ -846,6 +850,16 @@ public:
return bridge && bridge->isRunning();
}
bool requestMqttBridgeStop() override {
_alerter.setBridge(nullptr);
if (bridge) bridge->requestStop();
return true;
}
bool isMqttBridgeStopping() override {
return bridge && bridge->isStopping();
}
bool syncMqttNtp() override {
if (!bridge || !bridge->isRunning()) return false;
// Queue the sync onto the MQTT task (Core 0) without blocking: this runs on