Let every screen choose its top bar: clocks, date and entities (0.2.38)
The name stays on the left; up to six items go on the right: the time, an analog clock, the date, or a Home Assistant entity with its icon, showing its state or how long ago it changed, always or only while active. The add-on formats entity text in Dutch and sends it as op: header right after the layout to firmware 0.2.32+; older firmware keeps the clock of show_clock, which now follows the clock item. The firmware draws every value in one font on the name's baseline, centres icons and the dial on the digit height and measures gaps between glyph ink, so the bar looks even; the editor's mockup uses Roboto and the same integer rules. tools/render_topbar.py renders the real LVGL code on a computer (ESPHome host + SDL2). The editor's section buttons are gone. Firmware 0.2.32 for both boards. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+13
-8
@@ -58,7 +58,7 @@
|
||||
############################################################
|
||||
|
||||
substitutions:
|
||||
SCREEN_FIRMWARE_VERSION: "0.2.31"
|
||||
SCREEN_FIRMWARE_VERSION: "0.2.32"
|
||||
# A tap survives a finger that drifts up to this far (320 px over 58 mm: 1 cm); further is a swipe.
|
||||
TOUCH_MOVE_LIMIT_PX: "56"
|
||||
# Shortest contact that counts as a tap; a resistive panel bounces, a capacitive one does not.
|
||||
@@ -827,6 +827,11 @@ esphome:
|
||||
runtime_tiles::now_time = []() { return id(homeassistant_time).now(); };
|
||||
runtime_tiles::mini_icon_font = id(materialdesign_icons_mini)->get_lv_font();
|
||||
runtime_tiles::control_font = id(sublabel_big)->get_lv_font();
|
||||
// Top bar (0.2.32+): values in the text font, icons in the small icon font; the clock
|
||||
// label lends its margin and drawing order and stays hidden in runtime mode.
|
||||
runtime_tiles::header_text_font = id(sublabel_big)->get_lv_font();
|
||||
runtime_tiles::header_icon_font = id(materialdesign_icons_mini)->get_lv_font();
|
||||
runtime_tiles::time_label = id(lbl_time);
|
||||
runtime_tiles::enabled = std::string("${DYNAMIC_TILES}") == "true";
|
||||
if (!runtime_tiles::enabled) return;
|
||||
runtime_tiles::load_settings();
|
||||
@@ -1345,7 +1350,7 @@ font:
|
||||
'0','1','2','3','4','5','6','7','8','9',
|
||||
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
|
||||
' ','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
|
||||
'ä','ö','ü','Ä','Ö','Ü','ß','/','…','·']
|
||||
'ä','ö','ü','Ä','Ö','Ü','ß','/','…','·',"'",'#','*','=',';','²','³','µ','é','è','ë','ê','ï','î','ó','ô','à','á','â','ç','ñ','ú','û','–']
|
||||
|
||||
# Material Design Icons (MDI) — included at fonts/materialdesignicons-webfont.ttf (Apache 2.0)
|
||||
# Source: https://github.com/Templarian/MaterialDesign-Webfont
|
||||
@@ -5316,8 +5321,11 @@ script:
|
||||
id(back_light).turn_on().set_transition_length(300).set_brightness(level / 100.0f).perform();
|
||||
if (id(display_dimmed)) { lv_obj_clear_flag(id(dim_wake_overlay), LV_OBJ_FLAG_HIDDEN); lv_obj_move_foreground(id(dim_wake_overlay)); }
|
||||
else lv_obj_add_flag(id(dim_wake_overlay), LV_OBJ_FLAG_HIDDEN);
|
||||
if (settings.show_clock) lv_obj_clear_flag(id(lbl_time), LV_OBJ_FLAG_HIDDEN);
|
||||
else lv_obj_add_flag(id(lbl_time), LV_OBJ_FLAG_HIDDEN);
|
||||
// Runtime mode draws the clock in the top bar; the manual profile keeps its own label.
|
||||
if (!runtime_tiles::enabled) {
|
||||
if (settings.show_clock) lv_obj_clear_flag(id(lbl_time), LV_OBJ_FLAG_HIDDEN);
|
||||
else lv_obj_add_flag(id(lbl_time), LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
if (!id(ui_refresh).is_running()) id(ui_refresh).execute();
|
||||
|
||||
- id: close_cards
|
||||
@@ -6452,11 +6460,8 @@ script:
|
||||
- delay: 100ms
|
||||
- lambda: |-
|
||||
if (runtime_tiles::enabled) {
|
||||
// The name and the top bar (clock included) draw together.
|
||||
runtime_tiles::render(id(lbl_room));
|
||||
auto now = id(homeassistant_time).now();
|
||||
if (screen_settings::current.show_clock) lv_obj_clear_flag(id(lbl_time), LV_OBJ_FLAG_HIDDEN);
|
||||
else lv_obj_add_flag(id(lbl_time), LV_OBJ_FLAG_HIDDEN);
|
||||
if (now.is_valid()) runtime_tiles::label(id(lbl_time), now.strftime(screen_settings::current.clock_24h ? "%H:%M" : "%I:%M"));
|
||||
return;
|
||||
}
|
||||
auto set_lbl = [](lv_obj_t* lbl, const std::string& s) {
|
||||
|
||||
Reference in New Issue
Block a user