From 049d64edc2ea4ab27b9273c4ff02afa6c5324341 Mon Sep 17 00:00:00 2001 From: nick Date: Thu, 11 Jun 2026 00:20:55 -0600 Subject: [PATCH] dashboard: move outside temp to status strip --- .../esp32-s3-dashboard/dashboard_config.h | 2 +- .../esp32-s3-dashboard/esp32-s3-dashboard.ino | 64 +++++++++++++++++-- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/firmware/esp32-s3-dashboard/dashboard_config.h b/firmware/esp32-s3-dashboard/dashboard_config.h index 39e26da..f2e59a2 100644 --- a/firmware/esp32-s3-dashboard/dashboard_config.h +++ b/firmware/esp32-s3-dashboard/dashboard_config.h @@ -1,6 +1,6 @@ #pragma once -static const char *DASHBOARD_VERSION = "0.1.37-temp-groups"; +static const char *DASHBOARD_VERSION = "0.1.38-outside-status-temp"; // Update these if your Cargo ESP AP credentials are different. static const char *CARGO_WIFI_SSID = "OverlandController"; diff --git a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino index 7c99ba4..d910094 100644 --- a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino +++ b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino @@ -25,6 +25,7 @@ static lv_obj_t *system_status_label = nullptr; static lv_obj_t *wifi_icon_label = nullptr; static lv_obj_t *wifi_bars_obj[4] = {nullptr}; static lv_obj_t *cargo_status_dot = nullptr; +static lv_obj_t *outside_status_temp_label = nullptr; static lv_obj_t *relay_buttons[6] = {nullptr}; static lv_obj_t *relay_button_labels[6] = {nullptr}; @@ -61,6 +62,7 @@ static String last_battery_soc_text; static String last_temp_tile_value_text[4]; static String last_temp_tile_name_text[4]; static String last_system_status_text; +static String last_outside_status_temp_text; static int last_wifi_bar_count = -1; static bool last_cargo_api_ok = false; @@ -114,7 +116,7 @@ static int temp_group_index(const String &group) { if (group == "cabin") return 0; if (group == "fridge") return 1; - if (group == "outside") return 2; + if (group == "battery") return 2; return 3; } @@ -171,6 +173,16 @@ static int wifi_bar_count() return 1; } + +static void update_outside_status_temp(const String &text) +{ + if (outside_status_temp_label == nullptr) { + return; + } + + set_label_text_if_changed(outside_status_temp_label, last_outside_status_temp_text, text); +} + static void update_status_icons() { if (wifi_icon_label == nullptr || cargo_status_dot == nullptr) { @@ -650,9 +662,10 @@ static void parse_status_json(const String &body) } if (doc["temps"].is()) { - String tile_names[4] = {"Cabin", "Fridge", "Outside", "Other"}; + String tile_names[4] = {"Cabin", "Fridge", "Battery", "Other"}; String tile_values[4] = {"--", "--", "--", "--"}; bool tile_has_value[4] = {false, false, false, false}; + String outside_status = "OUT --"; for (JsonObject temp : doc["temps"].as()) { bool enabled = temp["enabled"] | false; @@ -663,14 +676,37 @@ static void parse_status_json(const String &body) continue; } + float temp_f = (float)(temp["temperature_f"] | 0.0); + + if (weather) { + outside_status = "OUT "; + outside_status += String((int)round(temp_f)); + outside_status += "°"; + continue; + } + const char *raw_name = temp["name"] | ""; const char *raw_group = temp["group"] | ""; String name = raw_name && raw_name[0] ? String(raw_name) : String("Cabin"); - String group = normalize_temp_group(String(raw_group), name, weather); - int index = temp_group_index(group); + String group = normalize_temp_group(String(raw_group), name, false); - int rounded = (int)round((float)(temp["temperature_f"] | 0.0)); + // Weather-tagged sensors are excluded above. A manually configured outside + // group can still be shown later on a dedicated Temps page, but the main + // overview reserves the top status strip for outside/weather temp. + if (group == "outside") { + outside_status = "OUT "; + outside_status += String((int)round(temp_f)); + outside_status += "°"; + continue; + } + + int index = temp_group_index(group); + if (index == 2) { + index = 3; // Keep main temp card from using an Outside tile. + } + + int rounded = (int)round(temp_f); String value = String(rounded); value += "°"; @@ -685,12 +721,18 @@ static void parse_status_json(const String &body) name.replace(" Area", ""); name.replace(" Zone", ""); tile_names[index] = name.length() ? name : "Cabin"; + } else if (index == 1) { + tile_names[index] = "Fridge"; + } else if (index == 2) { + tile_names[index] = "Battery"; } else { - tile_names[index] = temp_group_label(index, name); + tile_names[index] = "Other"; } } } + update_outside_status_temp(outside_status); + for (int i = 0; i < 4; i++) { set_label_text_if_changed(temp_tile_value_labels[i], last_temp_tile_value_text[i], tile_values[i]); set_label_text_if_changed(temp_tile_name_labels[i], last_temp_tile_name_text[i], tile_names[i]); @@ -943,7 +985,7 @@ static void create_overland_overview_screen() lv_obj_align(temp_tile_value_labels[i], LV_ALIGN_TOP_MID, 0, 26); temp_tile_name_labels[i] = lv_label_create(tile); - lv_label_set_text(temp_tile_name_labels[i], i == 0 ? "Cabin" : i == 1 ? "Fridge" : i == 2 ? "Outside" : "Other"); + lv_label_set_text(temp_tile_name_labels[i], i == 0 ? "Cabin" : i == 1 ? "Fridge" : i == 2 ? "Battery" : "Other"); lv_obj_set_style_text_color(temp_tile_name_labels[i], lv_color_hex(0xB8C0C8), 0); lv_obj_set_style_text_font(temp_tile_name_labels[i], &lv_font_montserrat_26, 0); lv_obj_set_width(temp_tile_name_labels[i], temp_tile_w - 8); @@ -1014,6 +1056,14 @@ static void create_overland_overview_screen() lv_obj_set_width(system_status_label, 1); lv_obj_add_flag(system_status_label, LV_OBJ_FLAG_HIDDEN); + outside_status_temp_label = lv_label_create(system_card); + lv_label_set_text(outside_status_temp_label, "OUT --"); + lv_obj_set_style_text_color(outside_status_temp_label, lv_color_hex(0xDDE3EA), 0); + lv_obj_set_style_text_font(outside_status_temp_label, &lv_font_montserrat_30, 0); + lv_obj_set_width(outside_status_temp_label, 220); + lv_obj_set_style_text_align(outside_status_temp_label, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_align(outside_status_temp_label, LV_ALIGN_CENTER, 0, 0); + lv_obj_t *page_dots = lv_label_create(system_card); lv_label_set_text(page_dots, "● ○ ○ ○"); lv_obj_set_style_text_color(page_dots, lv_color_hex(0xB8C0C8), 0);