Way to Rotate lvgl example?

Hi,

I have been working on a project involving an LCD screen using the LVGL sample as a base. However, it would be nice if I could rotate either the text itself or the screen by 90 degrees. I tried the lv_disp_set _rotation command found in lv_hal_disp.c but rather than rotating the screen it just broke the display. The same thing happens if I flip the width and height in the overlay. 1) is this error some how caused by the lv_disp library and 2) is there a fix for this? I am using the SH1107 OLED which is compatible with the ssd1306 drivers and I am using an unedited version of the lvgl example. Any help would be appreciated.

Thanks!

Parents
  • Hi,

    I tried the lv_disp_set _rotation command found in lv_hal_disp.c but rather than rotating the screen it just broke the display

    What does it look like when it breaks?

    It seems like others are experiencing this with the SSD1306 driver:

    https://github.com/lvgl/lvgl/issues/3379#issuecomment-1147954592

    https://github.com/zephyrproject-rtos/zephyr/issues/46446

    https://github.com/zmkfirmware/zmk/issues/1749

  • So looking more into it looks like the fixes posted on the LVGL forum are a little outdated. Kconfig.graphical doesn't exist anymore, for example and the fixes in the Zephyr forums don't work in isolation. Still looking into seeing if there is a fix.

  • Hi,

    Thanks for the .dts clarification and the /delete-property clarification. I am not as good at the overlay stuff as I would like to be so I appreciate the patient clarification.

    Deleting segment-remap rotates the screen by 180 degrees which is neat but not the 90 that I am looking for. Deleting com-invdir just breaks the output which is unfortunate. I tried messing around with some of the together settings to try to get a version working after deleting com-invdir but to no avail. 

  • Hi 

    Really odd that the com-invdir change wouldn't work. Looking at the driver implementation this seems to be a standard feature. 

    Regarding the lv_disp_set_rotation command, did you try this with all possible rotation values? 

    Did you try to enable the software rotation feature?
    Possibly this one will allow you to rotate the display, even if it is a slower method compared to hardware rotation. 

    Best regards
    Torbjørn

  • I did try lv_set_rotation with all the possible rotation values. None of them gave a legible output.

    I tried setting driver->sw_rotate = LV_DISP_ROT_90 in the lv_disp_drv_init() function. Doesn't seem to accomplish anything. I have tried a few other things (like trying to change it in the lv_disp_drv_t typdef declaration) but I havn;t been able to get it to work. If you have an idea of how I could better use that then I would love to hear about it. I don't really care how slow it is. I just need to do it once during initialization. 

    Thanks,

    Rainier

  • Hi Rainier

    I guess I should have read the entire thread properly, now I realize there is a known issue in LVGL regarding the SW rotate function. 

    Reading through the issues it doesn't seem this issue was ever fixed, but I see a patch is proposed here. Could you try this fix and see if you can get the rotate function to work? 

    RHOOD said:
    I don't really care how slow it is. I just need to do it once during initialization. 

    I expect software rotation will slow down every display update operation, not just initialization, but how big of an impact it will be I don't know. This would be resolution dependent, but since you are only using a 128x64 pixel display it would hopefully not be a very big impact. 

    Either way, it is something to be aware of if you are able to get the sw rotation feature working. 

    Best regards
    Torbjørn

  • Hi,

    Yeah, I tried to implement that fix a little while ago. Unfortunately both LVGL and Zephyr have updated since then so a lot of the files they reference don't exist anymore. lvgl.c and lvgl_display_mono are still around but I don't see Kconfig.graphical anywhere in my zephyr directories and I believe I confirmed that this file no longer exists on current version when doing research online.I have been looking to see if there is an equivalent Kconfig they just renamed to something else but so far I havn't found it. If you know of where I could find such an equivalent config that would be awesome.

    Thanks,

    Rainier

Reply
  • Hi,

    Yeah, I tried to implement that fix a little while ago. Unfortunately both LVGL and Zephyr have updated since then so a lot of the files they reference don't exist anymore. lvgl.c and lvgl_display_mono are still around but I don't see Kconfig.graphical anywhere in my zephyr directories and I believe I confirmed that this file no longer exists on current version when doing research online.I have been looking to see if there is an equivalent Kconfig they just renamed to something else but so far I havn't found it. If you know of where I could find such an equivalent config that would be awesome.

    Thanks,

    Rainier

Children
Related