|
|
static void | publish_status () |
| | Publish the working balancer status to the readers.
|
| |
|
uint16_t | get_battery_voltage_mv (const uint8_t index) |
| |
|
uint8_t | compute_cell_balancing_max () |
| | Compute the maximum number of cells that should be balanced at the same time prevent the breakage of the component at high temperatures.
|
| |
|
void | set_balancing (uint8_t cellIndex, bool shouldBalance) |
| |
|
bool | is_balancing (uint8_t cellIndex) |
| |
|
void | balance_batteries () |
| |
|
void | disable_battery_balancing () |
| |
|
Status | get_status () |
| | Return the status of the balancer.
|
| |
| bool | init () |
| | Call once on init.
|
| |
|
void | loop () |
| | call often to refresh measurments
|
| |
|
void | enable_balancing (bool enable) |
| | enable the battery balancing process
|
| |
|
void | go_to_sleep () |
| | call before the system goes to sleep
|
| |
|
|
constexpr uint16_t | unbalancedMv = 3 |
| | threshold at which point a battery is considered unbalanced with another
|
| |
|
Status | _status |
| | Working balancer status: only accessed by the power thread, that runs the balancer loop.
|
| |
|
static Status | _publishedStatus |
| | Copy of the balancer status given to the readers of all threads, see get_status(). The power thread updates it from _status once a measurement is complete: only access it under _publishedStatusMutex.
|
| |
|
static hal::mutex::hal_mutex_t | _publishedStatusMutex |
| | Guards _publishedStatus: a reader never sees a partial measurement. Not recursive.
|
| |
| static const bool | _isPublishedStatusMutexInit |
| | Initialized at program start: the status can be read before the balancer init.
|
| |
|
balancer_t | balancer |
| |
|
balancer_t::Regt | balancerRegisters |
| |
|
bool | isBalancingEnabled = false |
| |
|
bool | isInit = false |
| |
|
bool | isInitFirstFullScanDone = false |
| |
Handles the battery balancing process.