diff options
Diffstat (limited to '')
| -rw-r--r-- | ui/simple/simple.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ui/simple/simple.c b/ui/simple/simple.c index 125ce2d..12184df 100644 --- a/ui/simple/simple.c +++ b/ui/simple/simple.c @@ -201,6 +201,10 @@ void low_voltage(void) { } void setup(void) { + #ifdef USE_WEAK_BATTERY_PROTECTION + detect_weak_battery(); + #endif + if (load_eeprom()) { if (eeprom[0] < NUM_LEVELS) current_level_idx = eeprom[0]; @@ -208,6 +212,20 @@ void setup(void) { push_state(off_state, 0); } +#ifndef BLINK_BRIGHTNESS +#define BLINK_BRIGHTNESS (MAX_LEVEL/6) +#endif + +void blink_once() { + uint8_t brightness = actual_level; + uint8_t bump = brightness + BLINK_BRIGHTNESS; + if (bump > MAX_LEVEL) bump = BLIP_LEVEL; + + set_level(bump); + delay_4ms(BLINK_ONCE_TIME/4); + set_level(brightness); +} + void loop(void) { StatePtr state = current_state; |
