fix(wifi): one power-save mapping for CLI, startup and reconnect
`set wifi.powersave min` stored 0 and applied WIFI_PS_MIN_MODEM, but the bridge's post-reconnect mapping read the same 0 as WIFI_PS_NONE. A node explicitly configured for minimum modem sleep therefore ran with power save off after its first reconnect, while `get wifi.powersave` still reported min. The stored default is already 1 (`none`), so nothing here changes the product default — it stops an operator's explicit choice from being reinterpreted. Move the value/name/mode table into WifiPowerSavePolicy (pure, host-tested) and use it from the CLI setter and getter, the web config snapshot and the bridge. The bridge now also applies the mode when it finds the STA already associated at start — that path has no connect transition to carry the setting, so a bridge restart used to leave whatever mode was set before.
This commit is contained in:
1 parent
d8ffae3230
commit
dfdcc25b50
6 files changed
+163
-34
No files matched your search
@@ -14,6 +14,7 @@
|
||||
#include <helpers/MQTTPacketFilter.h>
|
||||
#include <helpers/MQTTPresets.h>
|
||||
#include <helpers/WebConfigKeys.h>
|
||||
#include <helpers/WifiPowerSavePolicy.h>
|
||||
#include <helpers/bridges/MQTTBridge.h>
|
||||
|
||||
#include "WebConfigHtml.h"
|
||||
@@ -722,8 +723,7 @@ void WebConfigServer::handleConfigGet(AsyncWebServerRequest* req) {
|
||||
JsonObject wifi = doc.createNestedObject("wifi");
|
||||
wifi["ssid"] = (const char*)_obs->wifi_ssid;
|
||||
wifi["pwd"] = _obs->wifi_password[0] ? SECRET_SENTINEL : "";
|
||||
wifi["powersave"] = _obs->wifi_power_save == 0 ? "min"
|
||||
: _obs->wifi_power_save == 2 ? "max" : "none";
|
||||
wifi["powersave"] = WifiPowerSavePolicy::nameFor(_obs->wifi_power_save);
|
||||
|
||||
JsonObject mqtt = doc.createNestedObject("mqtt");
|
||||
mqtt["origin"] = (const char*)_obs->mqtt_origin;
|
||||
|
||||
Reference in new issue
Block a user