summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-10-17 20:19:34 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-10-17 20:19:34 +0200
commita760e93aabeeb34ed8223c38067aead89c0961bf (patch)
tree9d395d8a70a7567a708d3952f62bc475fe343700
parent478c2f4e177f1429961b55271772e385c3eb0694 (diff)
long-press power button to turn off blinkencat
-rw-r--r--src/system.cc7
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)