From 4b3d885b61e4756c2a48d29ef26246430471205c Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Fri, 17 Feb 2023 14:00:32 +0100 Subject: [PATCH] Check that no key is pressed right after setting up IC interrupt and before going to sleep --- firmware/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/firmware/main.c b/firmware/main.c index c993872..c6ffc51 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -2075,6 +2075,12 @@ void main(void) // pin state against the P6 latch for output p6_changed = 0; P6 = P6; + // last check that nothing is pressed currently + // if it is, we need to abort the sleep + if (keyscan_idle_is_pressed()) { + p6_changed = 1; + continue; + } P0_ICEN = BIT(5); ICIE = 1;