fix(mqtt): resume after a late stop ack; bound the hourly NTP refresh

- A stop that timed out into StopUnproven refused begin(), and only a
  later begin() honoured the task's late acknowledgement. Nothing called
  it, so restartBridge() (any `set mqtt...` restart) or an aborted OTA left
  the observer offline for the rest of the boot. MyMesh now records that a
  start was refused and restarts the bridge once stopAcknowledgedLate()
  reports the ack. The OTA-abort alert no longer claims "bridge resumed"
  when the restart was refused.
- refreshNTP() now runs the validated probe with one attempt per server.
  With two attempts and a 1 s pause it blocked the MQTT task ~18 s every
  hour on networks that drop UDP/123, where the old async SNTP cost
  nothing. Loop comment and docs updated to match.
This commit is contained in:
agessaman committed 2026-09-19 11:27:01 -07:00
1 parent 0ff3408564
commit 3c03254aa2
7 files changed
+56 -11

No files matched your search

+9
View File
@@ -1514,6 +1514,15 @@ void MyMesh::loop() {
// Check radio FIRST to ensure we don't miss incoming packets
// MQTT processing can take time, so we prioritize radio reception
mesh::Mesh::loop();
#ifdef WITH_MQTT_BRIDGE
// A timed-out stop keeps the bridge down until the MQTT task acknowledges it;
// once that late ack lands, restart the bridge that was meant to be running.
if (_bridge_resume_pending && bridge && bridge->stopAcknowledgedLate()) {
Serial.println("MQTT: stop acknowledged late - resuming bridge");
setBridgeState(true);
}
#endif
#ifdef WITH_MQTT_BRIDGE
// bridge.loop() is now handled by FreeRTOS task on Core 0 - no need to call it here
#endif