dashboard: reduce status indicator redraws
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#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.
|
// Update these if your Cargo ESP AP credentials are different.
|
||||||
static const char *CARGO_WIFI_SSID = "OverlandController";
|
static const char *CARGO_WIFI_SSID = "OverlandController";
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ static String last_battery_soc_text;
|
|||||||
static String last_inside_temp_text;
|
static String last_inside_temp_text;
|
||||||
static String last_outside_temp_text;
|
static String last_outside_temp_text;
|
||||||
static String last_system_status_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)
|
static String on_off(bool value)
|
||||||
{
|
{
|
||||||
@@ -117,9 +119,17 @@ static void update_status_icons()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lvgl_port_lock(-1);
|
|
||||||
|
|
||||||
int bars = wifi_bar_count();
|
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++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if (wifi_bars_obj[i] == nullptr) {
|
if (wifi_bars_obj[i] == nullptr) {
|
||||||
@@ -135,7 +145,7 @@ static void update_status_icons()
|
|||||||
|
|
||||||
lv_obj_set_style_bg_color(
|
lv_obj_set_style_bg_color(
|
||||||
cargo_status_dot,
|
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
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -488,7 +498,7 @@ static void update_system_status_label()
|
|||||||
was_wifi_connected = false;
|
was_wifi_connected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (millis() - last_wifi_label_update_ms < 1000) {
|
if (millis() - last_wifi_label_update_ms < 5000) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user