dashboard: reduce status indicator redraws
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user