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

Signal the battery level steps to the user, by blinking the output during the output mode. More...

Classes

class  BlinkTracker
 Decide when to blink, independently of the hardware. More...
 

Functions

void signal_output_on ()
 Call when the output mode is entered.
 
void loop ()
 Call on each main loop of the output mode, before the user loop.
 
void set_enabled (const bool isEnabled)
 Enable or disable the blinks. Saved with the system parameters.
 
bool is_enabled ()
 Return true if the blinks are enabled.
 
constexpr uint8_t get_blink_count (const uint16_t level)
 Return the number of blinks of a battery level.
 

Variables

static constexpr uint32_t levelFilterWindow_ms = 1000
 A level must be held for this time to be displayed, the voltage drops on high current use.
 
static constexpr uint32_t minOutputUseTime_ms = 10000
 A level passed before this output use time is never displayed.
 
static constexpr uint32_t blinkOffTime_ms = 50
 Time the output is off during a blink.
 
static constexpr uint32_t blinkPeriod_ms = 150
 Time between the start of two successive blinks.
 

Detailed Description

Signal the battery level steps to the user, by blinking the output during the output mode.

Function Documentation

◆ get_blink_count()

constexpr uint8_t lampda::logic::battery_blink::get_blink_count ( const uint16_t  level)
constexpr

Return the number of blinks of a battery level.

Parameters
[in]levelThe battery level, in percent * 100
Returns
1 under 75%, 2 under 50%, 3 under 25%, and 0 otherwise