diff --git a/display/firmware/main.c b/display/firmware/main.c index f36acc6..7b0d561 100644 --- a/display/firmware/main.c +++ b/display/firmware/main.c @@ -9,6 +9,7 @@ #include "button.h" static bool report_change = false; +static uint8_t last_buttons = 0; static void init(); static void send_status(); @@ -95,6 +96,7 @@ static void loop(); static void init() { // initialize buttons button_init(); + last_buttons = button_get(); // initialize VFD display_init(); @@ -150,6 +152,14 @@ static void send_status() { } static void loop() { + // Report button state changes first + if (report_change) { + uint8_t current = button_get(); + if (current != last_buttons) { + send_status(); + last_buttons = current; + } + } // Check for new messages if (can_check_message()) { can_t msg = { 0 };