dashboard: remove wifi signal bars
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
static const char *DASHBOARD_VERSION = "0.1.76-api-led-left";
|
static const char *DASHBOARD_VERSION = "0.1.77-remove-wifi-bars";
|
||||||
|
|
||||||
// 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";
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ static lv_obj_t *temp_tile_value_labels[2] = {nullptr};
|
|||||||
static lv_obj_t *temp_tile_name_labels[2] = {nullptr};
|
static lv_obj_t *temp_tile_name_labels[2] = {nullptr};
|
||||||
static bool last_temp_tile_alert[2] = {false, false};
|
static bool last_temp_tile_alert[2] = {false, false};
|
||||||
static lv_obj_t *system_status_label = nullptr;
|
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 *cargo_status_dot = nullptr;
|
||||||
static lv_obj_t *outside_status_temp_label = nullptr;
|
static lv_obj_t *outside_status_temp_label = nullptr;
|
||||||
|
|
||||||
@@ -81,7 +79,6 @@ static String last_temp_tile_value_text[2];
|
|||||||
static String last_temp_tile_name_text[2];
|
static String last_temp_tile_name_text[2];
|
||||||
static String last_system_status_text;
|
static String last_system_status_text;
|
||||||
static String last_outside_status_temp_text;
|
static String last_outside_status_temp_text;
|
||||||
static int last_wifi_bar_count = -1;
|
|
||||||
static bool last_cargo_api_ok = false;
|
static bool last_cargo_api_ok = false;
|
||||||
|
|
||||||
static String on_off(bool value)
|
static String on_off(bool value)
|
||||||
@@ -187,28 +184,6 @@ static String format_hours(float hours)
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wifi_bar_count()
|
|
||||||
{
|
|
||||||
if (WiFi.status() != WL_CONNECTED) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int rssi = WiFi.RSSI();
|
|
||||||
|
|
||||||
if (rssi > -60) {
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rssi > -70) {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rssi > -80) {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void update_outside_status_temp(const String &text)
|
static void update_outside_status_temp(const String &text)
|
||||||
@@ -222,43 +197,28 @@ static void update_outside_status_temp(const String &text)
|
|||||||
|
|
||||||
static void update_status_icons()
|
static void update_status_icons()
|
||||||
{
|
{
|
||||||
if (wifi_icon_label == nullptr || cargo_status_dot == nullptr) {
|
if (cargo_status_dot == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bars = wifi_bar_count();
|
|
||||||
bool cargo_ok = status_model.api_ok;
|
bool cargo_ok = status_model.api_ok;
|
||||||
|
|
||||||
if (bars == last_wifi_bar_count && cargo_ok == last_cargo_api_ok) {
|
if (cargo_ok == last_cargo_api_ok) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_wifi_bar_count = bars;
|
|
||||||
last_cargo_api_ok = cargo_ok;
|
last_cargo_api_ok = cargo_ok;
|
||||||
|
|
||||||
lvgl_port_lock(-1);
|
lvgl_port_lock(-1);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
if (wifi_bars_obj[i] == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
lv_obj_set_style_bg_color(
|
|
||||||
wifi_bars_obj[i],
|
|
||||||
i < bars ? lv_color_hex(0xDDE3EA) : lv_color_hex(0x3A4652),
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
lv_obj_set_style_bg_color(
|
lv_obj_set_style_bg_color(
|
||||||
cargo_status_dot,
|
cargo_status_dot,
|
||||||
cargo_ok ? lv_color_hex(0x32D583) : lv_color_hex(0xF97066),
|
cargo_ok ? lv_color_hex(0x32D583) : lv_color_hex(0xF97066),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
lvgl_port_unlock();
|
lvgl_port_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int clamp_int(int value, int min_value, int max_value)
|
static int clamp_int(int value, int min_value, int max_value)
|
||||||
{
|
{
|
||||||
if (value < min_value) {
|
if (value < min_value) {
|
||||||
@@ -1599,21 +1559,7 @@ static void create_overland_overview_screen()
|
|||||||
lv_obj_center(relay_button_labels[i]);
|
lv_obj_center(relay_button_labels[i]);
|
||||||
lv_obj_add_flag(relay_buttons[i], LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(relay_buttons[i], LV_OBJ_FLAG_HIDDEN);
|
||||||
}
|
}
|
||||||
|
cargo_status_dot = lv_obj_create(system_card);
|
||||||
wifi_icon_label = lv_label_create(system_card);
|
|
||||||
lv_label_set_text(wifi_icon_label, "");
|
|
||||||
lv_obj_add_flag(wifi_icon_label, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
wifi_bars_obj[i] = lv_obj_create(system_card);
|
|
||||||
lv_obj_set_size(wifi_bars_obj[i], 10, 10 + (i * 7));
|
|
||||||
lv_obj_set_style_radius(wifi_bars_obj[i], 2, 0);
|
|
||||||
lv_obj_set_style_border_width(wifi_bars_obj[i], 0, 0);
|
|
||||||
lv_obj_set_style_bg_color(wifi_bars_obj[i], lv_color_hex(0x3A4652), 0);
|
|
||||||
lv_obj_align(wifi_bars_obj[i], LV_ALIGN_LEFT_MID, 12 + (i * 16), 10 - (i * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
cargo_status_dot = lv_obj_create(system_card);
|
|
||||||
lv_obj_set_size(cargo_status_dot, 18, 18);
|
lv_obj_set_size(cargo_status_dot, 18, 18);
|
||||||
lv_obj_set_style_radius(cargo_status_dot, LV_RADIUS_CIRCLE, 0);
|
lv_obj_set_style_radius(cargo_status_dot, LV_RADIUS_CIRCLE, 0);
|
||||||
lv_obj_set_style_bg_color(cargo_status_dot, lv_color_hex(0xF97066), 0);
|
lv_obj_set_style_bg_color(cargo_status_dot, lv_color_hex(0xF97066), 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user