v0.5.7
Pre-release
Pre-release
Battery: adaptive 100% charge anchor and charger-transition filter reset
Adaptive full-charge anchor
- The OCV curve hardcoded 4200 mV as 100%, but real Li-ion cells terminate charging at ~4130 mV, so the display never reached 100% (peaked at ~94%).
- When CHG_STAT goes high (charge complete), the current filtered terminal voltage is recorded as the 100% anchor. The top segment of the OCV lookup table is stretched to use this anchor instead of 4200 mV.
- The anchor is persisted to NVS (
batnamespace, keyfull_mv) via the existingnvs_writertask (internal RAM stack), so it survives reboots. Loaded at boot before the monitor task starts. - Anchor only accepted in the 4000–4200 mV range to reject transient spikes and partial-charge false triggers. NVS write only occurs when the value actually changes.
IIR filter and percentage reset on charger transitions
- When charging stopped, the 120 mV IR-offset subtraction was removed, but the IIR filter only moved 25% per cycle — taking ~4 cycles to catch up. The slew-limited percentage then took additional minutes to walk to the new target.
- Both
filtered_mvandshown_pctare now reset to -1 on any charger state change (plug or unplug). The next sample adopts directly, eliminating the lag.
nvs_writer_init() in battery monitor start
- Added
nvs_writer_init()call in bsp_power_battery_monitor_start() to ensure the internal-stack NVS writer task exists in both STA and SoftAP modes, not just when the connected HTTP server starts.