fix(network): pre-merge review fixes
- Guard the boot-time link bootstrap to observer ESP32 builds. It ran unconditionally in MyMesh::begin(), breaking every non-observer repeater/room server build (ESP32 and nRF52). - Rename NetworkInterface -> NetworkLink (class, accessor, files). Arduino-ESP32 3.x ships its own NetworkInterface class and header, which broke the ESP32-C6 builds. Drop WiFi.setAutoConnect(), a no-op on 2.x and removed in 3.x. - Refresh stored Wi-Fi credentials every bridge tick so the STA reconnect loop picks up `set wifi.ssid` / `set wifi.pwd` without a reboot, as the bridge did before the link moved out of it. Skip reconnects while the SSID is empty. - Restore the "WiFi connected: <ip>" / "WiFi disconnected: reason N" debug lines the bridge used to print. - Alert on Ethernet only once it has held a lease this boot or when no Wi-Fi is configured; Wi-Fi-only installs of an Ethernet-preferred image keep Wi-Fi alerts instead of reporting "Ethernet down". - Record wifi.setup_complete only for Ethernet LAN onboarding, so Wi-Fi builds keep the SSID-based first-boot portal rule. - Use seq_cst for the route-switch lock/mutation flag handshake. - Docs: SNMP RSSI sentinel is -127; describe link-return vs medium-switch reconnect behavior accurately; note runtime credential pickup. - Test: unknown keys inside a known /mqtt.json group are ignored, which keeps wifi.setup_complete downgrade-safe.
This commit is contained in:
1 parent
ad65f64156
commit
4c683b13b3
14 files changed
+149
-95
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "ESP32Board.h"
|
||||
#include "NetworkInterface.h"
|
||||
#include "NetworkLink.h"
|
||||
#include <target.h>
|
||||
|
||||
#if defined(ADMIN_PASSWORD) && !defined(DISABLE_WIFI_OTA) // Repeater or Room Server only
|
||||
@@ -46,7 +46,7 @@ void otaReleaseTransport() {
|
||||
ota_server_running = false;
|
||||
ota_started_at = 0;
|
||||
if (ota_network_locked) {
|
||||
activeNetworkInterface().unlockSwitching();
|
||||
activeNetworkLink().unlockSwitching();
|
||||
ota_network_locked = false;
|
||||
}
|
||||
HttpPort80Lease::release(HttpPort80Lease::Owner::Ota);
|
||||
@@ -67,7 +67,7 @@ bool ESP32Board::startOTAUpdate(const char* id, char reply[], bool force_ap) {
|
||||
}
|
||||
|
||||
inhibit_sleep = true; // prevent sleep during OTA
|
||||
activeNetworkInterface().lockSwitching();
|
||||
activeNetworkLink().lockSwitching();
|
||||
ota_network_locked = true;
|
||||
|
||||
// If the device is already on its selected network, serve ElegantOTA on that
|
||||
@@ -78,8 +78,8 @@ bool ESP32Board::startOTAUpdate(const char* id, char reply[], bool force_ap) {
|
||||
// station IP can't be reached.
|
||||
IPAddress ip;
|
||||
if (NetworkPolicy::startOtaUsesSelectedNetwork(
|
||||
force_ap, activeNetworkInterface().isConnected())) {
|
||||
ip = activeNetworkInterface().localIP();
|
||||
force_ap, activeNetworkLink().isConnected())) {
|
||||
ip = activeNetworkLink().localIP();
|
||||
} else {
|
||||
ota_raised_ap = WiFi.softAP("MeshCore-OTA", NULL);
|
||||
if (!ota_raised_ap) {
|
||||
@@ -290,7 +290,7 @@ bool ESP32Board::otaFromManifest(const char* current_ver, bool dry_run, char rep
|
||||
// mesh-receive call chain (it overflows the loopTask canary). Run the work in a
|
||||
// dedicated 24 KB-stack task and block here until it finishes. The big stack is
|
||||
// freed when the task exits; on a successful update the chip reboots inside it.
|
||||
NetworkInterface& network = activeNetworkInterface();
|
||||
NetworkLink& network = activeNetworkLink();
|
||||
network.lockSwitching();
|
||||
OtaTaskArgs args = { this, current_ver, dry_run, reply, false, false };
|
||||
TaskHandle_t handle = nullptr;
|
||||
@@ -312,9 +312,9 @@ bool ESP32Board::otaFromManifestImpl(const char* current_ver, bool dry_run, char
|
||||
strcpy(reply, "ERR: OTA not configured (build via build.sh)");
|
||||
return false;
|
||||
#else
|
||||
if (!activeNetworkInterface().isConnected()) {
|
||||
if (!activeNetworkLink().isConnected()) {
|
||||
snprintf(reply, 160, "ERR: %s not connected",
|
||||
activeNetworkInterface().mediumName());
|
||||
activeNetworkLink().mediumName());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user