From 71bb855d09fb307050bf43a917b8f29c60611e94 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:20:26 -0500 Subject: [PATCH] feat: serve OTA page on the station IP when Wi-Fi is connected `start ota` always brought up the `MeshCore-OTA` setup AP and replied with 192.168.4.1, even on an observer that already holds a station link. Use the station address when the link is up and keep the AP as the fallback, so the reply URL points somewhere the operator can actually reach from their own network. Companion builds with Wi-Fi get the same behaviour. --- MQTT_OBSERVER.md | 7 +++++++ src/helpers/ESP32Board.cpp | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/MQTT_OBSERVER.md b/MQTT_OBSERVER.md index 1bc8b5a9..206ef683 100644 --- a/MQTT_OBSERVER.md +++ b/MQTT_OBSERVER.md @@ -139,6 +139,13 @@ and do not paste the output anywhere. and `max` trade latency for power. The observer manages Wi-Fi and reconnects automatically — do not run two things that fight over the Wi-Fi interface. +`start ota` uses that station link: while Wi-Fi is connected it serves the +update page on the node's own address (`Started: http://192.0.2.10/update`) +instead of starting the `MeshCore-OTA` hotspot. Without a station link the +command falls back to the usual hotspot. To force the hotspot on a configured +observer, disable both broker slots (`set mqtt1.enabled off` / +`set mqtt2.enabled off`, which powers Wi-Fi down) and run `start ota` again. + The observer gets UTC from NTP before it connects anywhere. The default server is `pool.ntp.org` with `time.google.com` and `time.cloudflare.com` as fallbacks; an invalid clock means no TLS and no JWT, so it retries time every 30 s until diff --git a/src/helpers/ESP32Board.cpp b/src/helpers/ESP32Board.cpp index a55abb26..be501922 100644 --- a/src/helpers/ESP32Board.cpp +++ b/src/helpers/ESP32Board.cpp @@ -13,9 +13,15 @@ bool ESP32Board::startOTAUpdate(const char* id, char reply[]) { inhibit_sleep = true; // prevent sleep during OTA - WiFi.softAP("MeshCore-OTA", NULL); - sprintf(reply, "Started: http://%s/update", WiFi.softAPIP().toString().c_str()); + IPAddress ip; + if (WiFi.status() == WL_CONNECTED) { + ip = WiFi.localIP(); // already on a Wi-Fi network: serve the update page there + } else { + WiFi.softAP("MeshCore-OTA", NULL); + ip = WiFi.softAPIP(); + } + sprintf(reply, "Started: http://%s/update", ip.toString().c_str()); MESH_DEBUG_PRINTLN("startOTAUpdate: %s", reply); static char id_buf[60];