diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-05-31 10:58:21 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-05-31 10:58:21 +0200 |
commit | a13d74779b25dda964d81b36b1ab12863111e8f5 (patch) | |
tree | 9e3065c1f05ccf651d5460ed6394057177771ca3 | |
parent | d040ed5eecb104c201b330c468df3b6d8c59b7f1 (diff) |
Handle high-frequency key presses in debounce logic
-rw-r--r-- | src/system.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/system.cc b/src/system.cc index 9b04f69..66b3a53 100644 --- a/src/system.cc +++ b/src/system.cc @@ -152,10 +152,12 @@ void System::next_mode(void) void System::debounce_start(void) { - btn_debounce = 1; - wdt_reset(); - WDTCSR = _BV(WDE) | _BV(WDCE); - WDTCSR = _BV(WDIE) | _BV(WDP1) | _BV(WDP0); + if (!btn_debounce) { + btn_debounce = 1; + wdt_reset(); + WDTCSR = _BV(WDE) | _BV(WDCE); + WDTCSR = _BV(WDIE) | _BV(WDP1) | _BV(WDP0); + } } void System::debounce_done(void) |