aboutsummaryrefslogtreecommitdiff
path: root/ui/simple
diff options
context:
space:
mode:
authorChristian Schubert2026-04-02 21:53:09 +0200
committerChristian Schubert2026-04-02 21:53:09 +0200
commitd2b281ccbd8b1b49050bdf44e7573b954869567f (patch)
treea1f66b0c6e33a76ea9ced59efbe614c248ef39a6 /ui/simple
parentadjust timing/comments (diff)
downloadanduril-d2b281ccbd8b1b49050bdf44e7573b954869567f.tar.gz
anduril-d2b281ccbd8b1b49050bdf44e7573b954869567f.tar.bz2
anduril-d2b281ccbd8b1b49050bdf44e7573b954869567f.zip
detect_weak_battery() on powerup
Diffstat (limited to 'ui/simple')
-rw-r--r--ui/simple/simple.c18
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;