image alarm
This commit is contained in:
@@ -39,11 +39,13 @@ static lv_obj_t *lbl_cpu_temp;
|
||||
static lv_obj_t *tbl_services;
|
||||
static int s_service_count;
|
||||
|
||||
/* Local sensors */
|
||||
static lv_obj_t *lbl_room_temp;
|
||||
static lv_obj_t *lbl_room_humi;
|
||||
/* Local sensors (bottom bar) */
|
||||
static lv_obj_t *lbl_local;
|
||||
static lv_obj_t *lbl_uptime;
|
||||
|
||||
/* Status image placeholder */
|
||||
static lv_obj_t *img_status;
|
||||
|
||||
/* Network */
|
||||
static lv_obj_t *lbl_net;
|
||||
|
||||
@@ -267,11 +269,10 @@ static void create_main_section(lv_obj_t *parent)
|
||||
ry += row_h;
|
||||
lbl_uptime = create_label(parent, rx + 4, ry, &InziuIosevka_Slab_CC_12px, "Uptime: --h");
|
||||
|
||||
/* === Local Sensors (below pi vitals) === */
|
||||
int sy = ry + row_h + 4;
|
||||
create_label(parent, rx + 4, sy, &InziuIosevka_Slab_CC_12px, "LOCAL SENSORS");
|
||||
lbl_room_temp = create_label(parent, rx + 4, sy + 16, &InziuIosevka_Slab_CC_16px, "Room: --.-C");
|
||||
lbl_room_humi = create_label(parent, rx + 4, sy + 42, &InziuIosevka_Slab_CC_16px, "Humi: --%");
|
||||
/* === Status image (120x120, bottom-right above bot bar) === */
|
||||
img_status = lv_img_create(parent);
|
||||
lv_obj_set_pos(img_status, 280, 156);
|
||||
lv_obj_set_size(img_status, 120, 120);
|
||||
}
|
||||
|
||||
static void create_bottom_bar(lv_obj_t *parent)
|
||||
@@ -295,6 +296,13 @@ static void create_bottom_bar(lv_obj_t *parent)
|
||||
lv_obj_set_style_text_color(lbl_net, lv_color_black(), 0);
|
||||
lv_obj_align(lbl_net, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
lv_label_set_text(lbl_net, "NETWORK RX: ---- kbps TX: ---- kbps");
|
||||
|
||||
/* Local sensor readings — right-aligned */
|
||||
lbl_local = lv_label_create(bot_cont);
|
||||
lv_obj_set_style_text_font(lbl_local, &InziuIosevka_Slab_CC_12px, 0);
|
||||
lv_obj_set_style_text_color(lbl_local, lv_color_black(), 0);
|
||||
lv_obj_align(lbl_local, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
lv_label_set_text(lbl_local, "T: --.- H: --%");
|
||||
}
|
||||
|
||||
void dashboard_ui_create(void)
|
||||
@@ -365,11 +373,8 @@ void dashboard_ui_update_local(float temp, float humidity, uint8_t battery)
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Room: %.1fC", temp);
|
||||
lv_label_set_text(lbl_room_temp, buf);
|
||||
|
||||
snprintf(buf, sizeof(buf), "Humi: %.0f%%", humidity);
|
||||
lv_label_set_text(lbl_room_humi, buf);
|
||||
snprintf(buf, sizeof(buf), "T: %.1f H: %.0f%%", temp, humidity);
|
||||
lv_label_set_text(lbl_local, buf);
|
||||
|
||||
/* Update top bar battery text + bar */
|
||||
snprintf(buf, sizeof(buf), "%d%%", battery);
|
||||
@@ -406,3 +411,10 @@ void dashboard_ui_update_connection(ws_state_t ws_state, bool wifi_connected, co
|
||||
}
|
||||
lv_label_set_text(lbl_ws, ws_str);
|
||||
}
|
||||
|
||||
void dashboard_ui_update_status_image(const lv_img_dsc_t *dsc)
|
||||
{
|
||||
if (dsc) {
|
||||
lv_img_set_src(img_status, dsc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,12 @@ void dashboard_ui_update_time(int h, int m, int s, int year, int month, int day,
|
||||
*/
|
||||
void dashboard_ui_update_connection(ws_state_t ws_state, bool wifi_connected, const char *ip_str);
|
||||
|
||||
/**
|
||||
* Update the status image widget. LVGL lock must be held by caller.
|
||||
* @param dsc Image descriptor (1-bit monochrome, 120x120)
|
||||
*/
|
||||
void dashboard_ui_update_status_image(const lv_img_dsc_t *dsc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user