Module battery

Module battery 

Source
Expand description

User-facing tracker battery-state classification.

Structs§

BatteryThresholds
Default state thresholds for a single-cell Li-ion tracker.
LevelEstimator
Approximate state-of-charge estimator for gauge-less boards: a rest-gated OCV table with a median filter, a discharge-direction clamp, and quantized output.
LevelSample
One estimator input: the monitor’s measurement plus its context.

Enums§

BatteryState
Mutually exclusive battery modes presented by the tracker UX.
ChargeClass
The charge-state distinction reported to something outside the UX — a protocol property, a companion app — as opposed to the five-way presentation classification.

Constants§

SAG_WINDOW_MS
How long after a transient load a terminal-voltage reading is still treated as possibly sagged rather than as resting OCV.

Functions§

charge_class
The ChargeClass behind a five-way BatteryState.
classify
Classify external power first so battery-only warnings and lockouts can never leak into Charging or Charged from the user’s perspective.
load_recent
Whether a reading taken at now_ms falls inside the sag window of the most recent reported load.
soc_from_ocv
State of charge for a resting (open-circuit) terminal voltage.