diff options
| author | Selene ToyKeeper | 2017-08-19 16:25:39 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2017-08-19 16:25:39 -0600 |
| commit | 9a6965d62578bc7260c7ba1d4860152721c12ea9 (patch) | |
| tree | bf4a69d0c970f032554dbaf28ccb8e48a08e03a1 /spaghetti-monster/momentary.c | |
| parent | Fixed momentary UI (API changed a little). (diff) | |
| download | anduril-9a6965d62578bc7260c7ba1d4860152721c12ea9.tar.gz anduril-9a6965d62578bc7260c7ba1d4860152721c12ea9.tar.bz2 anduril-9a6965d62578bc7260c7ba1d4860152721c12ea9.zip | |
Extra debouncing in PCINT (don't emit event if push was rejected).
Fixed memory error in Baton -- long-press from off didn't restart at moon.
Made Momentary and Baton go to sleep while light is off.
Diffstat (limited to 'spaghetti-monster/momentary.c')
| -rw-r--r-- | spaghetti-monster/momentary.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/spaghetti-monster/momentary.c b/spaghetti-monster/momentary.c index a585152..23cc359 100644 --- a/spaghetti-monster/momentary.c +++ b/spaghetti-monster/momentary.c @@ -44,35 +44,28 @@ uint8_t momentary_state(EventPtr event, uint16_t arg) { if (event == EV_click1_press) { brightness = 255; light_on(); - // don't attempt to parse multiple clicks - empty_event_sequence(); + empty_event_sequence(); // don't attempt to parse multiple clicks return 0; } else if (event == EV_release) { light_off(); - // don't attempt to parse multiple clicks - empty_event_sequence(); + empty_event_sequence(); // don't attempt to parse multiple clicks + standby_mode(); // sleep while light is off return 0; } - else if (event == EV_debug) { - //PWM1_LVL = arg&0xff; - DEBUG_FLASH; - return 0; - } - - // event not handled - return 1; + return 1; // event not handled } // LVP / low-voltage protection void low_voltage() { - debug_blink(3); if (brightness > 0) { + debug_blink(3); brightness >>= 1; if (on_now) light_on(); } else { + debug_blink(8); light_off(); standby_mode(); } @@ -80,6 +73,5 @@ void low_voltage() { void setup() { debug_blink(2); - push_state(momentary_state, 0); } |
