Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for manual offset setting, and automatic swapping of resoultion and offsets when changing screen orientation #65

Open
frhun opened this issue Jun 6, 2021 · 0 comments

Comments

@frhun
Copy link

frhun commented Jun 6, 2021

While trying to set up the library for the TTGO T-DISPLAY i ran into the problem that the premade config didn't work (which is another issue in it self #50).
To get around this, i instead just tried to configure everything manually, but then ran into the problem that that also didn't work, because the offset settings needed for the display used on the T-Display ( which is this; for reference), isn't using the full address area of the ST7789V.
So i made this patch, in order to be able to configure for this display manually.

diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig
index ddd7f51..ba6746e 100644
--- a/lvgl_tft/Kconfig
+++ b/lvgl_tft/Kconfig
@@ -206,24 +206,28 @@ menu "LVGL TFT Display controller"
         default 3 if DISPLAY_ORIENTATION_LANDSCAPE_INVERTED
 
     config LV_TFT_DISPLAY_OFFSETS
-        bool
+        bool "enable coordinate offsets"
         help
-        Display area doesn't start at address 0
+            Set this to configure coordinate offsets for the visible display Area.
+            In other words: set Adress offsets
 
     config LV_TFT_DISPLAY_X_OFFSET
         depends on LV_TFT_DISPLAY_OFFSETS
-        int
+        int "the vertical display window coordinate offset"
         default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
         default 53 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT  || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
         default 0
+        help
+            Set this to the number of pixels the active display area is offset horizonatlly
 
     config LV_TFT_DISPLAY_Y_OFFSET
         depends on LV_TFT_DISPLAY_OFFSETS
-        int
+        int "the vertical display window coordinate offset"
         default 53  if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
         default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT  || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
         default 0
-
+        help
+            Set this to the number of pixels the active display area is offset horizonatlly
 
     # Display colors(?)
     # Useful to know when the display being used is a monochrome

But even then i had to set the resolution with LV_HOR_RES_MAX and LV_VER_RES_MAX to 135 and 240. (which btw are confusingly described because they aren't really the "Maximal vertical/horizontal resolution to support by the library", but just the resolution of the display used, in this case)

Which then brought up the issue that these (both resolution an offsets) values are relative to the resulting coordinate system after setting screen orientation, which means they have to be manually changed every time the screen orientation is changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant