dashboard: fix overview label widths
This commit is contained in:
@@ -249,6 +249,16 @@ static void parse_status_json(const String &body)
|
|||||||
status_model.temps_text = temps;
|
status_model.temps_text = temps;
|
||||||
status_model.outputs_text = outputs;
|
status_model.outputs_text = outputs;
|
||||||
|
|
||||||
|
Serial.println("Parsed status summary:");
|
||||||
|
Serial.print(" SOC: ");
|
||||||
|
Serial.println(status_model.soc);
|
||||||
|
Serial.print(" Voltage: ");
|
||||||
|
Serial.println(status_model.voltage);
|
||||||
|
Serial.print(" Temps text: ");
|
||||||
|
Serial.println(status_model.temps_text);
|
||||||
|
Serial.print(" Outputs text: ");
|
||||||
|
Serial.println(status_model.outputs_text);
|
||||||
|
|
||||||
update_overview_widgets();
|
update_overview_widgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,12 +408,13 @@ static lv_obj_t *create_card(lv_obj_t *parent, const char *title, int width, int
|
|||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
static lv_obj_t *create_body_label(lv_obj_t *card)
|
static lv_obj_t *create_body_label(lv_obj_t *card, int width)
|
||||||
{
|
{
|
||||||
lv_obj_t *label = lv_label_create(card);
|
lv_obj_t *label = lv_label_create(card);
|
||||||
lv_label_set_text(label, "Waiting for /api/v1/status...");
|
lv_label_set_text(label, "Waiting for /api/v1/status...");
|
||||||
lv_obj_set_style_text_color(label, lv_color_hex(0xDDE3EA), 0);
|
lv_obj_set_style_text_color(label, lv_color_hex(0xDDE3EA), 0);
|
||||||
lv_obj_set_width(label, lv_obj_get_width(card) - 34);
|
lv_obj_set_width(label, width);
|
||||||
|
lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP);
|
||||||
lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, 32);
|
lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, 32);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
@@ -433,20 +444,21 @@ static void create_overland_status_screen()
|
|||||||
lv_obj_t *system_card = create_card(screen, "System / Network", 620, 190, LV_ALIGN_BOTTOM_LEFT, 32, -50);
|
lv_obj_t *system_card = create_card(screen, "System / Network", 620, 190, LV_ALIGN_BOTTOM_LEFT, 32, -50);
|
||||||
lv_obj_t *touch_card = create_card(screen, "Touch", 300, 190, LV_ALIGN_BOTTOM_RIGHT, -32, -50);
|
lv_obj_t *touch_card = create_card(screen, "Touch", 300, 190, LV_ALIGN_BOTTOM_RIGHT, -32, -50);
|
||||||
|
|
||||||
battery_label = create_body_label(battery_card);
|
battery_label = create_body_label(battery_card, 260);
|
||||||
temps_label = create_body_label(temps_card);
|
temps_label = create_body_label(temps_card, 260);
|
||||||
outputs_label = create_body_label(outputs_card);
|
outputs_label = create_body_label(outputs_card, 260);
|
||||||
|
|
||||||
lv_label_set_text(battery_label, "Waiting for battery data...");
|
lv_label_set_text(battery_label, "Waiting for battery data...");
|
||||||
lv_label_set_text(temps_label, "Waiting for temp data...");
|
lv_label_set_text(temps_label, "Waiting for temp data...");
|
||||||
lv_label_set_text(outputs_label, "Waiting for output data...");
|
lv_label_set_text(outputs_label, "Waiting for output data...");
|
||||||
|
|
||||||
wifi_label = create_body_label(system_card);
|
wifi_label = create_body_label(system_card, 275);
|
||||||
|
|
||||||
system_label = lv_label_create(system_card);
|
system_label = lv_label_create(system_card);
|
||||||
lv_label_set_text(system_label, "API: waiting");
|
lv_label_set_text(system_label, "API: waiting");
|
||||||
lv_obj_set_style_text_color(system_label, lv_color_hex(0xB8C0C8), 0);
|
lv_obj_set_style_text_color(system_label, lv_color_hex(0xB8C0C8), 0);
|
||||||
lv_obj_set_width(system_label, 300);
|
lv_obj_set_width(system_label, 285);
|
||||||
|
lv_label_set_long_mode(system_label, LV_LABEL_LONG_WRAP);
|
||||||
lv_obj_align(system_label, LV_ALIGN_TOP_LEFT, 305, 32);
|
lv_obj_align(system_label, LV_ALIGN_TOP_LEFT, 305, 32);
|
||||||
|
|
||||||
lv_obj_t *button = lv_btn_create(touch_card);
|
lv_obj_t *button = lv_btn_create(touch_card);
|
||||||
|
|||||||
Reference in New Issue
Block a user