strange-v / ha_deck

Config-driven Home Assistant dashboard (built on top of ESPHome)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Display rotation possible?

lechk82 opened this issue · comments

First of all: I have been searching for a way to integrate LVGL and esphome for a long time, and I am very impressed by this project.
Is there a way to adjust the display orientation using the rotation parameter?

Two options:

  1. Clone the repo and do this #7
  2. Optionally, make it configurable via YAML and create a PR.

Hello I tried with value 0 ; 2 ; 3 but the screen is rotatted only bu 90° right and with a lot of glitch. Any help on the correct value to use ?

Hello I tried with value 0 ; 2 ; 3 but the screen is rotatted only bu 90° right and with a lot of glitch. Any help on the correct value to use ?

I initially had the same problem and solved it as follows:

hd_device_sc01_plus.cpp:

    disp_drv.rotated = 0;
    disp_drv.sw_rotate = 0;

LGFX.cpp:

cfg.offset_rotation = 2;

20240216_214159

Uploading Capture d’écran 2024-02-17 à 09.32.29.png…
Oh OK, my need is a bit different, I need to rotate by 180° (because of my dock I cant put the screen in the other way)

Do you know the value for 180° ?

Thank you !

Tested 0,1,2,3 for cfg.offset_rotation giving me 0, 90,180,270 degrees, respectively. choose the one you like

Hello do you modify the 2 occurences of cfg.offset_rotation in LGFX.cpp or only one ?
do you modify anything in hd_device_sc01_plus ? (what is your values of disp_drv.rotated and disp_drv.sw_rotate ) ?
thank you

@multinet33 My mistake was, that I changed cfg.offset_rotation = 0; in line 73. Changing cfg.offset_rotation in line 40 works for me.

For the life in me, I can't figure this one out. I did set disp_drv.rotated = 0; and disp_drv.sw_rotate = 0; and I also changed both line 40 and 73 to 2. Screen is still in Landscape. Am I missing something?

Make sure that disp_drv.rotated = 0; and disp_drv.sw_rotate = 0 are not overwritten, as esphome sometimes pulls the git sources. In addition, a clean build is sometimes helpful

I cloned the git - https://github.com/genasoft/ha_deck/blob/main/components/hd_device_sc01_plus/hd_device_sc01_plus.cpp and they are set to 0. On top, this clone is brand new as I wanted to start fresh (initially I thought that this might be causing the problem).
I have also deleted the instance in ESPhome (HA) - all cleaned from BUILD, STORAGE and IDEDATA.
Do I need to swap HEIGHT and WIDTH variables?

apart from the changes mentioned, i haven't changed anything else, so specifically only this:

hd_device_sc01_plus.cpp:

    disp_drv.rotated = 0;
    disp_drv.sw_rotate = 0;

LGFX.cpp:

cfg.offset_rotation = 2;

I suspect that some caches remain in the build directory in your case

You could fork the repo, hardcode the rotation settings in your fork end use that one directly as a component.

I am deleting the full build directory, so unless there is somewhere else cache, that shouldn't be the case.
strange-v, any idea that would help solve the issue?

You could fork the repo, hardcode the rotation settings in your fork end use that one directly as a component.

This is what I did - https://github.com/genasoft/ha_deck/tree/main

right, i've just seen it, i'll try your component and see what comes out for me

your fork gave me an error, so I forked it myself and it works as expected. I also removed the background image because it overshoots the rotated image area. try it with my fork: https://github.com/lechk82/ha_deck

Ha, it worked with your fork. This is very weird. Could it be because of the background?
Thanks

On my side anything else that 0 ( 1 2 3 ) in LGFX.cpp: cfg.offset_rotation line 40 put the screen in portait mode

so I can have only one orientation in landscape on only one orientation in portrait

Make sure before re-compiling, you clean up everything - build, idedata, storage,cache/platformio/cache/http, external_components

I compile it via ESPhome under home assistant

before I always make a clean build files so it download all dependencies every times

is it the correct way to do it ?

i think yes because every time I put back 0 I get my screen landscape (but I would like it in 180 degrees because I can’t reverse my screen due to my case)

The directories that I gave you are within the ESPHOME docker image. Before any new build, you have to go in there and clean up. I was having a lot of misery when I didn't do a complete clean up.