fix(wifi): keep the legacy power-save default off; store explicit min as 3

Stored 0 was the shipped default from 2026-01-02 to 2026-03-28, and every
association path has run it with power save off since. Reading it as
MIN_MODEM, as F11 did, would have put every node set up in that window
into modem sleep on its next association. 0 now reads as `none`, and
`set wifi.powersave min` stores a new value 3. /mqtt.json accepts 0..3;
older firmware repairs 3 to `none` on load. Binary snapshots are no longer
written, so 3 never reaches a legacy layout.
This commit is contained in:
agessaman committed 2026-09-19 11:27:01 -07:00
1 parent 800a27fe83
commit 0ff3408564
3 files changed
+23 -9

No files matched your search

+2 -1
View File
@@ -4,6 +4,7 @@
#include <helpers/MQTTObserverValidation.h>
#include <helpers/MQTTPresets.h>
#include <helpers/MQTTPrefsStorage.h>
#include <helpers/WifiPowerSavePolicy.h>
#ifdef WITH_MQTT_BRIDGE
@@ -50,7 +51,7 @@ class MQTTPrefsSerializer : public ConfigSerializer {
public:
explicit WifiPrefs(MQTTPrefs* prefs) : _prefs(prefs), _power_save(prefs->wifi_power_save) {}
bool apply(bool* repaired) {
if (_power_save < 0 || _power_save > 2) {
if (_power_save < 0 || _power_save > WifiPowerSavePolicy::kMaxStoredValue) {
_power_save = 1;
*repaired = true;
}
+9 -6
View File
@@ -11,15 +11,18 @@
// to `min` silently ran with power save off after its first reconnect while
// `get wifi.powersave` still said min.
//
// Stored values are fleet state — never renumber them. The product default is
// `none`, which is a *default* (MQTTDefaults.h), not a reinterpretation of an
// operator's explicit `min`.
// Stored values are fleet state — never renumber them. 0 was the shipped
// default from 2026-01-02 to 2026-03-28, and every association path ran it with
// power save off, so it keeps meaning `none`; an explicit `min` is stored as 3.
// Older firmware repairs 3 to `none` when it loads /mqtt.json.
namespace WifiPowerSavePolicy {
enum StoredValue : uint8_t {
kMin = 0, // WIFI_PS_MIN_MODEM
kNone = 1, // WIFI_PS_NONE (default)
kMax = 2, // WIFI_PS_MAX_MODEM
kLegacyDefault = 0, // WIFI_PS_NONE: the old default, never an operator choice
kNone = 1, // WIFI_PS_NONE (default)
kMax = 2, // WIFI_PS_MAX_MODEM
kMin = 3, // WIFI_PS_MIN_MODEM
kMaxStoredValue = kMin,
};
// Mirrors wifi_ps_type_t. MQTTBridge.cpp static_asserts these against the SDK.