prefs: move led_brightness after wifi_pwd; enable PWM in board.conf

led_brightness sat at companion offset 174, in front of the WiFi
fields, so a 272-byte file written by upstream dev decoded with the
wrong led_brightness and a shifted SSID. Append it after wifi_pwd
(offset 272) and restore the original test offsets and the 208/272
historical lengths.

WT2 and V4.3 only got CONFIG_PWM through esp32s3_pwm_led.conf, which
the release build never passes, so release links would fail. Set
CONFIG_PWM=y in each board.conf instead. board.conf is app-only and
mcuboot does not inherit it, so the mcuboot link failure that rules out
the defconfig does not apply.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ZephCore T096
2026-10-08 18:27:00 +02:00
co-authored by Claude Sonnet 5
parent 263171bdd4
commit ad2e17e5e6
4 changed files with 12 additions and 9 deletions
+3 -6
View File
@@ -106,10 +106,10 @@ size_t companionPrefsEncode(const NodePrefs &p, uint8_t *buf, size_t cap)
w.put(&p.tz_offset, 1);
w.put(&p.leds_radio_mode, 1);
w.put(&p.leds_hb_mode, 1);
w.put(&p.led_brightness, 1);
w.put(&p.wifi_enabled, 1);
w.put(p.wifi_ssid, sizeof(p.wifi_ssid));
w.put(p.wifi_pwd, sizeof(p.wifi_pwd));
w.put(&p.led_brightness, 1);
return w.off;
}
@@ -188,14 +188,11 @@ bool companionPrefsDecode(NodePrefs &prefs, const uint8_t *buf, size_t len)
r.take(&p.tz_offset, 1);
r.take(&p.leds_radio_mode, 1);
r.take(&p.leds_hb_mode, 1);
/* led_brightness (ZephCore extension, since 1.17.4). Absent in files
* written before this field existed; the no-op EOF read leaves the
* initNodePrefs() default ZEPHCORE_LED_DEFAULT_BRIGHTNESS_PCT (10%),
* same value a fresh node already showed before this was persisted. */
r.take(&p.led_brightness, 1);
r.take(&p.wifi_enabled, 1);
r.take(p.wifi_ssid, sizeof(p.wifi_ssid));
r.take(p.wifi_pwd, sizeof(p.wifi_pwd));
/* led_brightness at offset 272, after wifi_pwd: a 272-byte file leaves it at the initNodePrefs() default. */
r.take(&p.led_brightness, 1);
/* The one validator: bounds, NaNs, and the unterminated char fields */
sanitizeNodePrefs(&p);