PebbleOS
Loading...
Searching...
No Matches
Functions
Battery monitor

Power state control in response to battery state changes. More...

Functions

void battery_monitor_init (void)
 Initialize the monitor and battery state tracking.
 
void battery_monitor_handle_state_change_event (PreciseBatteryChargeState state)
 Update the power state after a battery state change.
 
bool battery_monitor_critical_lockout (void)
 Check whether the UI must be locked out because the battery is critical.
 
TimerID battery_monitor_get_standby_timer_id (void)
 Get the standby timer, for unit tests.
 

Detailed Description

Power state control in response to battery state changes.

Enters low power mode below the board's low power threshold while discharging, and standby when the battery stays critical (0 % and not charging) for 30 s, or 2 s right after boot. Neither happens while plugged in, nor on QEMU outside recovery firmware.

Function Documentation

◆ battery_monitor_critical_lockout()

bool battery_monitor_critical_lockout ( void  )

Check whether the UI must be locked out because the battery is critical.

Returns
true when the battery is critical, or was low at boot while unplugged.

◆ battery_monitor_get_standby_timer_id()

TimerID battery_monitor_get_standby_timer_id ( void  )

Get the standby timer, for unit tests.

Returns
Timer id.

◆ battery_monitor_handle_state_change_event()

void battery_monitor_handle_state_change_event ( PreciseBatteryChargeState  state)

Update the power state after a battery state change.

Called on KernelMain for each PEBBLE_BATTERY_STATE_CHANGE_EVENT.

Parameters
stateNew battery state.

◆ battery_monitor_init()

void battery_monitor_init ( void  )

Initialize the monitor and battery state tracking.