Fix re-entry to sleep after the first keypress

This commit is contained in:
Ondrej Jirman 2023-02-17 14:02:28 +01:00
parent 61e90842de
commit 6145b3df0a
1 changed files with 10 additions and 2 deletions

View File

@ -2142,9 +2142,17 @@ void main(void)
// if active scanning is not active and port 6 change was
// detected, and some key is still pressed, enter active
// scanning mode
if (!scan_active && keyscan_idle_is_pressed())
if (!scan_active) {
if (keyscan_idle_is_pressed())
keyscan_active();
// when the scan is not active, we may have been woken up
// by port 6 change interrupt, so we want to clear the
// port 6 change flag here, to allow the controller to
// sleep again in case the active scanning is not needed
p6_changed = 0;
}
// if we're in active scanning, scan the keys, and report
// new state
if (scan_active) {