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/baton.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/baton.c')
| -rw-r--r-- | spaghetti-monster/baton.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spaghetti-monster/baton.c b/spaghetti-monster/baton.c index ea8d49f..02b7c00 100644 --- a/spaghetti-monster/baton.c +++ b/spaghetti-monster/baton.c @@ -48,7 +48,9 @@ uint8_t off_state(EventPtr event, uint16_t arg) { if (event == EV_enter_state) { PWM1_LVL = 0; PWM2_LVL = 0; - // TODO: standby_mode(); + // sleep while off (lower power use) + //empty_event_sequence(); // just in case (but shouldn't be needed) + standby_mode(); return 0; } // hold (initially): go to lowest level, but allow abort for regular click @@ -114,7 +116,7 @@ uint8_t steady_state(EventPtr event, uint16_t arg) { // hold: change brightness else if (event == EV_click1_hold) { if ((arg % HOLD_TIMEOUT) == 0) { - memorized_level = (memorized_level+1) % sizeof(pwm1_modes); + memorized_level = (actual_level+1) % sizeof(pwm1_modes); set_mode(memorized_level); } return 0; |
