From c0c97bdbf222864fa0be88760599dc15a58d6010 Mon Sep 17 00:00:00 2001 From: melody Date: Mon, 18 Aug 2025 14:06:21 +0200 Subject: [PATCH] fix debounce --- main.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.ino b/main.ino index ef4e086..3b2dfc3 100644 --- a/main.ino +++ b/main.ino @@ -224,9 +224,9 @@ class DisplayConfig { }; +const byte DEBOUNCE_DELAY = 50; unsigned long previousMillis = -1000000000; unsigned long lastDebounceTime = 0; -unsigned long debounceDelay = 50; bool buttonPressedLastCycle = false; bool sht3xErrorLastCycle = false; @@ -337,7 +337,7 @@ void loop() { } } if (digitalRead(buttonPin)){ - if (!buttonPressedLastCycle && millis() - lastDebounceTime > debounceDelay){ + if (!buttonPressedLastCycle && millis() - lastDebounceTime > DEBOUNCE_DELAY){ config->cycleScreen()->draw(); buttonPressedLastCycle = true; lastDebounceTime = millis();