Skip to content

Rotate display on Sunton ESP32 2432S028#9340

Merged
tannewt merged 1 commit intoadafruit:mainfrom
occasional-contributor:occasional-contributor/sunton_esp32_2432S028_rotate_display
Jun 17, 2024
Merged

Rotate display on Sunton ESP32 2432S028#9340
tannewt merged 1 commit intoadafruit:mainfrom
occasional-contributor:occasional-contributor/sunton_esp32_2432S028_rotate_display

Conversation

@occasional-contributor
Copy link

@occasional-contributor occasional-contributor commented Jun 16, 2024

The display is 240w x 320h. We could swap the width and height, or rotate it by 270 degrees.

Before

PXL_20240616_002411510

After

PXL_20240616_010042463

@occasional-contributor
Copy link
Author

@tannewt Please let me know if there are any concerns with this PR.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me. Thanks!

@tannewt tannewt merged commit c965074 into adafruit:main Jun 17, 2024
@occasional-contributor
Copy link
Author

Thank you!

@occasional-contributor occasional-contributor deleted the occasional-contributor/sunton_esp32_2432S028_rotate_display branch June 17, 2024 23:38
@RetiredWizard
Copy link

@occasional-contributor Let me know if you have a discord handle, I'd rather talk there than a closed issue :/

Is there any chance you could post the identifying string from the back side of your board? After applying this PR, my display is rotated 270 degrees in a portrait mode, just like your "Before" photo so it appears our two devices have different rotation requirements.

If the ID on your board is the same as mine, I'll just submit a PR that adds a comment to the board.c file indicating that rotation variable may need to be modified and a custom firmware built depending on how the particular board was designed.

Here's the back of my board
SUNTONESP32-2432S028

@SeanTheITGuy FYI...

@occasional-contributor
Copy link
Author

occasional-contributor commented Aug 28, 2024

@RetiredWizard That's mildly infuriating. I will post a pic of the backside when I'm home.

I was on Discord, once upon a time. Then I went on an IM/social media detox trip.

I am using my board with stock xtouch firmware, and there are no rotation issues there. So it may be your unit that's a bit different.

@occasional-contributor
Copy link
Author

PXL_20240828_223158275~2

@SeanTheITGuy
Copy link

SeanTheITGuy commented Aug 28, 2024 via email

@occasional-contributor
Copy link
Author

I suggest we create two different boards. I am not sure if more variants exist and/or how to tell them apart without visual inspection.

@dhalbert
Copy link
Collaborator

There are so many versions of this board on AliExpress. There's no way to identify the display driver chip, is there?

@RetiredWizard
Copy link

I don't think it's worth trying to set up different firmware variants for these CYD boards that have the same silk screened model number. They appear to be cloned left and right and who knows what other differences may show up. The screen orientation can probably be dealt with in software by releasing the board.DISPLAY object and re-initializing the display with the proper rotation.

@occasional-contributor
Copy link
Author

Is it possible to add a display rotation property to settings.toml (or whatever is used for setting WiFi credentials)? That way, if a particular board needs display rotation, we do not need multiple versions.

@RetiredWizard
Copy link

Is it possible to add a display rotation property to settings.toml (or whatever is used for setting WiFi credentials)? That way, if a particular board needs display rotation, we do not need multiple versions.

I suspect settings.toml is read prior to the execution of board.c (I'm not sure though). Even if it is, it's probably not worth adding the additional code (firmware space) to the core to carry a parameter forward to support screen rotation options.

That being said, it is possible to rotate the screen after the board boots with the following code.py:

import displayio
import board
import fourwire
import adafruit_ili9341
import digitalio

displayio.release_displays()
spi = board.LCD_SPI()
disp_bus = fourwire.FourWire(spi,command=board.LCD_DC,chip_select=board.LCD_CS)
display=adafruit_ili9341.ILI9341(disp_bus,width=320,height=240)
bl = digitalio.DigitalInOut(board.LCD_BCKL)
bl.direction = digitalio.Direction.OUTPUT
bl.value=1

One thing to note, is that with the merging of this PR, the default rotation of the display is not the same as that used by the adafruit_ili9341 library.

@deshipu
Copy link

deshipu commented Sep 14, 2024

The settings.toml is read every time you access a variable defined in it, so I think there should be no problem getting it in board.c. I have done a similar thing on my PewPew M4 boards that can use displays with different initialization requirements, but in their case the display parameter is stored in the UF2 bootloader: https://github.com/adafruit/circuitpython/blob/main/ports/atmel-samd/boards/pewpew_m4/board.c#L93-L95

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

Successfully merging this pull request may close these issues.

6 participants