mirror of
https://github.com/jhuebert/MeshCore.git
synced 2026-12-03 10:54:13 +00:00
merge: serve observer OTA page on the station IP
This commit is contained in:
commit
e5d8ecff54
2 files changed
+15
-2
No files matched your search
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in new issue
Block a user