Add persistent native Guition rotation to screen settings

This commit is contained in:
Max Gramser
2026-09-12 18:29:06 +02:00
parent 8171629678
commit 0109bfd6d2
15 changed files with 155 additions and 12 deletions
+1 -1
View File
@@ -59,7 +59,7 @@
############################################################
substitutions:
SCREEN_FIRMWARE_VERSION: "0.2.8"
SCREEN_FIRMWARE_VERSION: "0.2.9"
DYNAMIC_TILES: "true"
DASHBOARD_INBOX_INTERNAL: "false"
DEVICE_NAME: "cyd-new"
+14 -1
View File
@@ -2,7 +2,7 @@
# Guition ESP32-S3-4848S040 / 4-inch EU wallbox, 480x480 IPS + GT911.
# Use guition-device.yaml; see docs/GUITION.md. CYD hardware is a separate profile.
substitutions:
SCREEN_FIRMWARE_VERSION: "0.2.8"
SCREEN_FIRMWARE_VERSION: "0.2.9"
DYNAMIC_TILES: "true"
DASHBOARD_INBOX_INTERNAL: "false"
DEVICE_NAME: "guition-new"
@@ -621,6 +621,7 @@ esphome:
runtime_tiles::watch_font = id(headline)->get_lv_font();
runtime_tiles::enabled = std::string("${DYNAMIC_TILES}") == "true";
if (!runtime_tiles::enabled) return;
runtime_tiles::rotation_supported = true;
runtime_tiles::load_settings();
runtime_tiles::settings_changed = []() { id(apply_screen_settings).execute(); };
runtime_tiles::dismiss = []() {
@@ -782,6 +783,7 @@ api:
(unsigned)(millis() - id(last_touch_ms)), id(display_dimmed));
ESP_LOGI("ui_diag", "navigation page=%d runtime_detail=%d", id(tile_page),
runtime_tiles::detail_root && !lv_obj_has_flag(runtime_tiles::detail_root, LV_OBJ_FLAG_HIDDEN));
ESP_LOGI("ui_diag", "rotation=%u actual=%u", (unsigned)runtime_tiles::rotation, (unsigned)id(screen_lvgl).get_rotation());
lv_area_t nav, grid;
lv_obj_update_layout(id(home_page)->obj);
lv_obj_get_coords(id(page_next), &nav);
@@ -1287,6 +1289,11 @@ binary_sensor:
# - Used by the UI to display fan presets when applicable
# ----------------------------------------------------------
text_sensor:
- platform: template
name: "Guition schermtype"
entity_category: diagnostic
update_interval: never
lambda: 'return {"guition"};'
- platform: template
name: "Schermfirmware"
entity_category: diagnostic
@@ -1616,6 +1623,7 @@ display:
lvgl:
id: screen_lvgl
on_draw_start:
- lambda: 'id(rendered_frames)++;'
displays:
@@ -4479,6 +4487,11 @@ script:
then:
- lambda: |-
const auto &settings = screen_settings::current;
if(runtime_tiles::enabled && static_cast<unsigned>(id(screen_lvgl).get_rotation())!=runtime_tiles::rotation){
cyd::touch_guard.consume();
if(lv_indev_get_act())lv_indev_wait_release(lv_indev_get_act());
id(screen_lvgl).set_rotation(static_cast<esphome::display::DisplayRotation>(runtime_tiles::rotation));
}
if (id(display_dimmed) && !settings.standby_enabled) {
id(display_dimmed) = false;
}