Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Classes | Functions | Variables
lampda::component::charger::policy Namespace Reference

Charge stop rules, from a snapshot of the battery measurements. More...

Classes

class  ChargeLimiter
 Track the charge stop state (battery full, over voltage) More...
 
struct  Inputs
 Snapshot of the measurements used by the charge stop rules. More...
 

Functions

bool is_over_voltage (const Inputs &in)
 True if a cell or the pack is over the charge voltage limit.
 
bool is_end_of_charge (const Inputs &in)
 True if the battery reached the end of charge: pack at the target voltage, or charge current tapered off near full.
 

Variables

static constexpr uint16_t fullLevel = 9900
 Battery level (percent * 100) from which the battery is considered full.
 
static constexpr uint16_t rechargeLevel = 9500
 Once full, the charge restarts below this battery level (percent * 100)
 
static constexpr uint32_t endOfChargeDeglitch_ms = 5000
 The end of charge condition must stay true for this time before the charge is considered done.
 
static constexpr uint16_t cellOverVoltageMargin_mV = 10
 Accepted cell voltage above the safe maximum (cell imbalance, measure noise)
 
static constexpr uint16_t cellOverVoltage_mV = physical_constants::maxSafeLiionVoltage_mV + cellOverVoltageMargin_mV
 A cell over this voltage stops the charge immediately.
 
static constexpr uint16_t packOverVoltage_mV
 A pack over this voltage stops the charge immediately.
 
static constexpr uint16_t cellResumeVoltage_mV = physical_constants::maxSafeLiionVoltage_mV - 20
 After an over voltage, the charge can restart when all cells are below this voltage.
 
static constexpr uint32_t overVoltagePause_ms = 20000
 After an over voltage, the charge stays stopped at least this long (lets the balancer work)
 

Detailed Description

Charge stop rules, from a snapshot of the battery measurements.

Variable Documentation

◆ fullLevel

constexpr uint16_t lampda::component::charger::policy::fullLevel = 9900
staticconstexpr

Battery level (percent * 100) from which the battery is considered full.

The charging IC regulates the pack voltage on its own reference (+-0.5%, ~60mV at 12.3V) and does not see the cells: it can settle above the target. The charge is stopped from the balancer measurements, that are more precise.

◆ packOverVoltage_mV

constexpr uint16_t lampda::component::charger::policy::packOverVoltage_mV
staticconstexpr
Initial value:
= physical_constants::batteryMaxVoltageSafe_mV +
cellOverVoltageMargin_mV * physical_constants::batterySeriesCount
static constexpr uint16_t cellOverVoltageMargin_mV
Accepted cell voltage above the safe maximum (cell imbalance, measure noise)
Definition: charge_policy.h:33

A pack over this voltage stops the charge immediately.