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
8ab6a988aa
commit
a129420804
14 files changed
+149
-95
No files matched your search
@@ -2,7 +2,7 @@
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <helpers/RxReservePacketManager.h>
|
||||
#include <helpers/NetworkInterface.h>
|
||||
#include <helpers/NetworkLink.h>
|
||||
#include <helpers/NetworkHostname.h>
|
||||
#if defined(ESP_PLATFORM)
|
||||
#include <WiFi.h>
|
||||
@@ -949,7 +949,8 @@ void MyMesh::begin(FILESYSTEM *fs) {
|
||||
// load persisted prefs
|
||||
_cli.loadPrefs(_fs);
|
||||
|
||||
NetworkInterface& boot_network = activeNetworkInterface();
|
||||
#if defined(WITH_MQTT_BRIDGE) && defined(ESP_PLATFORM)
|
||||
NetworkLink& boot_network = activeNetworkLink();
|
||||
if (boot_network.isAutomatic()) {
|
||||
char network_hostname[NetworkHostname::kBufferSize];
|
||||
NetworkHostname::build(network_hostname, sizeof(network_hostname),
|
||||
@@ -966,6 +967,7 @@ void MyMesh::begin(FILESYSTEM *fs) {
|
||||
boot_network.mediumName(), boot_network.statusName(),
|
||||
(unsigned long)(millis() - ethernet_probe_started_at));
|
||||
}
|
||||
#endif
|
||||
|
||||
acl.load(_fs, self_id);
|
||||
region_map.load(_fs);
|
||||
@@ -1306,13 +1308,13 @@ bool MyMesh::startWebConfig(bool force_ap, char* reply) {
|
||||
if (force_ap) {
|
||||
// The setup AP owns WiFi outright; refuse while the bridge holds the STA.
|
||||
if (bridge && bridge->isRunning() &&
|
||||
activeNetworkInterface().medium() != NetworkMedium::Ethernet) {
|
||||
activeNetworkLink().medium() != NetworkMedium::Ethernet) {
|
||||
strcpy(reply, "Err: MQTT bridge is running - 'set bridge off' first");
|
||||
return true;
|
||||
}
|
||||
_webconfig->startSetupMode(reply);
|
||||
} else if (activeNetworkInterface().isConnected()) {
|
||||
_webconfig->startLanMode(activeNetworkInterface().localIP(),
|
||||
} else if (activeNetworkLink().isConnected()) {
|
||||
_webconfig->startLanMode(activeNetworkLink().localIP(),
|
||||
!mqttNetworkSetupComplete(_cli.getObserverPrefs()), reply);
|
||||
} else if (!mqttNetworkSetupComplete(_cli.getObserverPrefs())) {
|
||||
_webconfig->startSetupMode(reply);
|
||||
@@ -1353,7 +1355,7 @@ void MyMesh::onConfigBatchEnd() {
|
||||
void MyMesh::buildStatsJson(char* buf, size_t buf_size) {
|
||||
char ip[20] = "";
|
||||
char wifi_rssi[12] = "null";
|
||||
NetworkInterface& network = activeNetworkInterface();
|
||||
NetworkLink& network = activeNetworkLink();
|
||||
const char* network_medium = network.mediumName();
|
||||
if (network.isConnected()) {
|
||||
strncpy(ip, network.localIP().toString().c_str(), sizeof(ip) - 1);
|
||||
|
||||
Reference in new issue
Block a user