diff --git a/include/controller.h b/include/controller.h index bdf8394..9a054a1 100644 --- a/include/controller.h +++ b/include/controller.h @@ -14,6 +14,7 @@ class Controller { Playlist current_playlist; bool is_rfid_present = false; unsigned long last_rfid_check = 0; + unsigned long last_button_check = 0; uint8_t button_pressed = 0; unsigned long button_pressed_since = 0; bool button_already_processed = false; diff --git a/src/controller.cpp b/src/controller.cpp index 1eab3d7..e491e7f 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -6,7 +6,10 @@ void Controller::handle() { handle_rfid(); last_rfid_check = millis(); } - handle_buttons(); + if (last_button_check + 10 < millis() || last_button_check > millis()) { + handle_buttons(); + last_button_check = millis(); + } } void Controller::handle_buttons() {