dashboard: color relay buttons by state

This commit is contained in:
2026-06-10 02:44:54 -06:00
parent d1959bb55f
commit 9d932815df
2 changed files with 19 additions and 1 deletions
@@ -1,6 +1,6 @@
#pragma once
static const char *DASHBOARD_VERSION = "0.1.29-force-relay-layout";
static const char *DASHBOARD_VERSION = "0.1.30-relay-state-colors";
// Update these if your Cargo ESP AP credentials are different.
static const char *CARGO_WIFI_SSID = "OverlandController";
@@ -307,6 +307,24 @@ static void update_relay_buttons()
label += on_off(relay_states[i]);
lv_label_set_text(relay_button_labels[i], label.c_str());
if (relay_count >= 5) {
lv_obj_set_style_text_font(relay_button_labels[i], &lv_font_montserrat_30, 0);
} else {
lv_obj_set_style_text_font(relay_button_labels[i], &lv_font_montserrat_40, 0);
}
if (relay_states[i]) {
lv_obj_set_style_bg_color(relay_buttons[i], lv_color_hex(0x027A48), 0);
lv_obj_set_style_border_color(relay_buttons[i], lv_color_hex(0x32D583), 0);
lv_obj_set_style_border_width(relay_buttons[i], 2, 0);
} else {
lv_obj_set_style_bg_color(relay_buttons[i], lv_color_hex(0x26313D), 0);
lv_obj_set_style_border_color(relay_buttons[i], lv_color_hex(0x3A4652), 0);
lv_obj_set_style_border_width(relay_buttons[i], 2, 0);
}
lv_obj_set_style_text_color(relay_button_labels[i], lv_color_hex(0xFFFFFF), 0);
} else {
lv_obj_add_flag(relay_buttons[i], LV_OBJ_FLAG_HIDDEN);
}