From 5afd50e98d120a5dfb88e81ad8bf9ed5bc860f7d Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 10 Jun 2026 22:39:50 -0600 Subject: [PATCH] dashboard: reduce status indicator redraws --- firmware/esp32-s3-dashboard/dashboard_config.h | 2 +- .../esp32-s3-dashboard/esp32-s3-dashboard.ino | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/firmware/esp32-s3-dashboard/dashboard_config.h b/firmware/esp32-s3-dashboard/dashboard_config.h index 54c0b15..228e695 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.33-etr-label"; +static const char *DASHBOARD_VERSION = "0.1.34-reduce-status-redraws"; // 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 1d98b2a..e4b1586 100644 --- a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino +++ b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino @@ -61,6 +61,8 @@ static String last_battery_soc_text; static String last_inside_temp_text; static String last_outside_temp_text; static String last_system_status_text; +static int last_wifi_bar_count = -1; +static bool last_cargo_api_ok = false; static String on_off(bool value) { @@ -117,9 +119,17 @@ static void update_status_icons() return; } - lvgl_port_lock(-1); - int bars = wifi_bar_count(); + bool cargo_ok = status_model.api_ok; + + if (bars == last_wifi_bar_count && cargo_ok == last_cargo_api_ok) { + return; + } + + last_wifi_bar_count = bars; + last_cargo_api_ok = cargo_ok; + + lvgl_port_lock(-1); for (int i = 0; i < 4; i++) { if (wifi_bars_obj[i] == nullptr) { @@ -135,7 +145,7 @@ static void update_status_icons() lv_obj_set_style_bg_color( cargo_status_dot, - status_model.api_ok ? lv_color_hex(0x32D583) : lv_color_hex(0xF97066), + cargo_ok ? lv_color_hex(0x32D583) : lv_color_hex(0xF97066), 0 ); @@ -488,7 +498,7 @@ static void update_system_status_label() was_wifi_connected = false; } - if (millis() - last_wifi_label_update_ms < 1000) { + if (millis() - last_wifi_label_update_ms < 5000) { return; }