From 44128f83be3fd730a50351f30eaebe2a3ff84cfd Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 15 Jun 2026 17:47:50 -0600 Subject: [PATCH] Revert "dashboard: queue latest relay target states" This reverts commit e1bbe2c135673c4221517928f8482e151a574a49. --- firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino index bbf837b..2abd020 100644 --- a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino +++ b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino @@ -541,6 +541,7 @@ static void relay_button_event_cb(lv_event_t *event) pending_relay_previous_state[index] = previous_state; } + // Latest-state queue: rapid taps overwrite this relay's desired target. pending_relay_state[index] = next_state; relay_command_pending[index] = true; @@ -574,6 +575,8 @@ static void process_pending_relay_command() bool next_state = pending_relay_state[index]; bool previous_state = pending_relay_previous_state[index]; + // Clear before posting. If the user taps again after this command returns, + // the new desired state will be queued as a fresh command. relay_command_pending[index] = false; bool ok = post_relay_state(relay_id, next_state); @@ -581,7 +584,8 @@ static void process_pending_relay_command() if (ok) { set_label_text_if_changed(system_status_label, last_system_status_text, "Relay command sent"); } else { - if (!relay_command_pending[index]) { + // Only revert if no newer desired state was queued for this relay. + if (!relay_command_pending[index] && index >= 0 && index < relay_count) { relay_states[index] = previous_state; update_relay_buttons(); }