diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-10-17 20:19:34 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-10-17 20:19:34 +0200 |
commit | a760e93aabeeb34ed8223c38067aead89c0961bf (patch) | |
tree | 9d395d8a70a7567a708d3952f62bc475fe343700 /src | |
parent | 478c2f4e177f1429961b55271772e385c3eb0694 (diff) |
long-press power button to turn off blinkencat
Diffstat (limited to 'src')
-rw-r--r-- | src/system.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/system.cc b/src/system.cc index c532f34..6726db9 100644 --- a/src/system.cc +++ b/src/system.cc @@ -253,7 +253,7 @@ void System::debounce_start(void) btn_debounce = 1; wdt_reset(); WDTCSR = _BV(WDE) | _BV(WDCE); - WDTCSR = _BV(WDIE) | _BV(WDP1) | _BV(WDP0); + WDTCSR = _BV(WDIE) | _BV(WDP2); } } @@ -261,6 +261,11 @@ void System::debounce_done(void) { btn_debounce = 0; wdt_disable(); + // long press? -> turn off + if (!(PIND & _BV(PD2))) { + mode_changed = 1; + blinkencat.mode = OFF; + } } ISR(WDT_OVERFLOW_vect) |