russhughes / st7789py_mpy

Driver for 320x240, 240x240, 135x240 and 128x128 ST7789 displays written in MicroPython
MIT License
159 stars 59 forks source link

st7789py.py: WIDTH_320 Rotation Table Values Reversed #1

Closed connorhickton closed 2 years ago

connorhickton commented 2 years ago

Apologies if this is done improperly, I am very new to GitHub.

In lib/st7789py.py, it looks like the values for the rotation table WIDTH_320 are reversed (240 should be 320 and vice versa). I was encountering errors with my 320x240 display not showing the full screen beyond 240x240, until I swapped all the values. The swapped values also better reflects the pattern from WIDTH_135.

I've attached images to show the issue:

Old Rotation Table WIDTH_320 is:

WIDTH_320 = [(320, 240,  0,  0),
             (240, 320,  0,  0),
             (320, 240,  0,  0),
             (240, 320,  0,  0)]

20211222_222944

Fixed Rotation Table WIDTH_320 is:

WIDTH_320 = [(240, 320,  0,  0),
             (320, 240,  0,  0),
             (240, 320,  0,  0),
             (320, 240,  0,  0)]

20211222_222840

Thanks for the code otherwise - this is my first time controlling a display with a microcontroller, and I wouldn't have been able to do it without this code!

russhughes commented 2 years ago

You are correct; I had the widths and heights reversed in the WIDTH_320 table. Thanks for the report.