Change debounce interval checking to handle millis wrap around

This commit is contained in:
Junior 2026-11-10 13:08:24 -05:00
parent 0f388e004f
commit 945a46cde4

View File

@ -79,7 +79,7 @@ void loop() {
debouncing = true; debouncing = true;
lastDebounceTime = currentMillis; lastDebounceTime = currentMillis;
} }
if ( debouncing && (currentMillis >= (lastDebounceTime + DEBOUNCEMS)) ) { if ( debouncing && ((currentMillis - lastDebounceTime) >= DEBOUNCEMS) ) {
debouncing = false; debouncing = false;
if ( buttonCheck != buttonState ) { if ( buttonCheck != buttonState ) {
buttonState = buttonCheck; buttonState = buttonCheck;