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

Display rotation issues #44

Open
positron96 opened this issue Jun 7, 2020 · 7 comments
Open

Display rotation issues #44

positron96 opened this issue Jun 7, 2020 · 7 comments

Comments

@positron96
Copy link

positron96 commented Jun 7, 2020

Hi. I just flashed my dso and my screen is rotated by 90 degrees. When I tried yesterday's version, my screen was rotated 180 degrees. This is probably caused by recent support of ST7789 display.
tmp-cam-5916317435364157606
tmp-cam-2158884534242667084

Unfortunately, I have no idea what model my display is.

@positron96
Copy link
Author

What helped me was enabling hardcoded ST7789 define and adding additional 180 deg rotation (at least, I think it's rotation)

 Src/TFTLib/Adafruit_TFTLCD_8bit_STM32.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Src/TFTLib/Adafruit_TFTLCD_8bit_STM32.cpp b/Src/TFTLib/Adafruit_TFTLCD_8bit_STM32.cpp
index 5af6f51..b0f2c67 100644
--- a/Src/TFTLib/Adafruit_TFTLCD_8bit_STM32.cpp
+++ b/Src/TFTLib/Adafruit_TFTLCD_8bit_STM32.cpp
@@ -294,7 +294,10 @@ void setRotation(uint8_t x)
   //perform hardware-specific rotation operations...
    uint16_t t = 0;
  
-  if(isST7789) x^=1; // Landscape & portrait are inverted compared to ILI
+  if(isST7789) {
+    x^=1; // Landscape & portrait are inverted compared to ILI
+    x = (x + 2)%4;
+  }
 
    switch (x)
    {

@michar71
Copy link
Owner

michar71 commented Jun 7, 2020

Hm.... So maybe it's not only the 90 Deg rotation based on controller chip but also 180 Deg rotation based ho they mount it.....

Controller chip ID doesn't seem to work for me I only get back 0. (But register read might be screwed up in general....) As I don't have that display it's hard to test for me...

For the moment I'll use your solution ;-)

@positron96
Copy link
Author

positron96 commented Jun 8, 2020

I think there might be a more elegant solution, e.g. x = (x+1)%4 instead of xoring and adding.

@positron96
Copy link
Author

positron96 commented Jun 9, 2020

Actually, reading chip ID does work for me. That commented out line
int displayId=readReg32(0x04) & 0xffff; //0x9341 for ili9341 ?
gives me 0x8552 for displayID (readReg32 returns 0xFC858552) so the check passes. 0x8552 seems to correspond to ST7789 according to its datasheet. https://www.waveshare.com/w/upload/a/ae/ST7789_Datasheet.pdf

@positron96
Copy link
Author

And my working code for rotation is now this (90 deg rotation replaces XOR and 180 rotation):

  if(isST7789) {
    x = (x+1) % 4; // Landscape & portrait are inverted compared to ILI
  }

@michar71
Copy link
Owner

michar71 commented Jun 9, 2020

On my unit it just reads back 0's from the display controller. Might have to hook up a scope to see what's going on on the data bus.
Will also try reading back other registers to see if this is a general issue or just that one register...

@luisgongod
Copy link

Hi, I think I have the same issue. If I flash the .hex from https://github.com/Shayshez/EuroScope and the Display is 90 degrees (as your first post). Cloned and build in platformio (vscode) the repo from michar71 but after flashing is all blank. Tried to un-comment the lines you mentioned above but nothing shows.
Is there an extra setting/config I need to do ? could you share the binary for your solution? Thanks!

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

3 participants