From ae9789ca4a91aab12a2c7326988702c1a7cdc942 Mon Sep 17 00:00:00 2001 From: Vitalii Popov Date: Fri, 16 May 2025 10:23:22 +0300 Subject: [PATCH] allow to turn off light --- src/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 182aa5d..1ec3e4c 100644 --- a/src/main.c +++ b/src/main.c @@ -343,8 +343,13 @@ interrupt(IRQ_EXTI_C, touch) { // Get time on release i16 time = elapsed(); if (time > LONG_PRESS_MS) { - // Make light continuously if pressed for long - timer = -1; + if (timer == 0) { + // Make light continuously if pressed for long + timer = -1; + } else { + // Or turn it off + timer = 0; + } } else if (time > SHORT_PRESS_MS) { // If it was short touch set timer for enough time timer = PRESS_ACTIVATION_TIME; // 30 seconds * 4 (250ms tick)