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];