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

Add support for Lilygo TTGO T-Display ESP32 with 4Mbyte flash chip #8787

Merged
merged 8 commits into from
Jan 17, 2024

Conversation

kreier
Copy link

@kreier kreier commented Jan 6, 2024

Technically it only needs a change of one line in mpconfigboard.mk with the adjusted CIRCUITPY_ESP_FLASH_SIZE = 4MB and now CircuitPython runs on versions with a smaller flash chip. I have several boards here and they are still available to order.

While at it I changed the init sequence for the display with an adjusted MADCTL to 0x60 (instead of 0xC0 to get the rotation=0 and a refresh of the display from to to bottom. 0x68 causes inverted colors when using displayio.Palette() so I kept bit D3 of MADCTL at zero.

And I added the missing pins GPIO36 and GPIO39 even though they can only be used as input. And renamed the buttons to BUTTON_L and BUTTON_R to be consistent with the rp2040 version of this board.

@kreier kreier mentioned this pull request Jan 6, 2024
@RetiredWizard
Copy link

The CI found a duplicate creation ID, you'll probably want to change CIRCUITPY_CREATION_ID to be something like 0x00320004 (https://github.com/creationid/creators/blob/main/creations/lilygo.md). You'll also want to make a PR against https://github.com/creationid/creators to add the new creation ID.

From the How to add a new Board learn guide:

Creator/Creation IDs
For boards that don't have native USB, there is still a way to identify your board uniquely. You will see mentions of CIRCUITPY_CREATOR_ID and CIRCUITPY_CREATION_ID in their mpconfigboard.mk files. You can register new Creator and Creation IDs at https://github.com/creationid/creators.

@kreier
Copy link
Author

kreier commented Jan 7, 2024

The CI found a duplicate creation ID, you'll probably want to change CIRCUITPY_CREATION_ID to be something like 0x00320004 (https://github.com/creationid/creators/blob/main/creations/lilygo.md). You'll also want to make a PR against https://github.com/creationid/creators to add the new creation ID.

From the How to add a new Board learn guide:

Creator/Creation IDs For boards that don't have native USB, there is still a way to identify your board uniquely. You will see mentions of CIRCUITPY_CREATOR_ID and CIRCUITPY_CREATION_ID in their mpconfigboard.mk files. You can register new Creator and Creation IDs at https://github.com/creationid/creators.

Thanks! Pull request for creation_id 0x0032_0004 is created creationid/creators#52

Once approved I'll update this pull request. And when merged will add a description to the circuitpython.org website

@dhalbert
Copy link
Collaborator

dhalbert commented Jan 9, 2024

While at it I changed the init sequence for the display with an adjusted MADCTL to 0x60 (instead of 0xC0 to get the rotation=0 and a refresh of the display from to to bottom. 0x68 causes inverted colors when using displayio.Palette() so I kept bit D3 of MADCTL at zero.

And I added the missing pins GPIO36 and GPIO39 even though they can only be used as input. And renamed the buttons to BUTTON_L and BUTTON_R to be consistent with the rp2040 version of this board.

Should these changes also be made on the original board?

@kreier
Copy link
Author

kreier commented Jan 9, 2024

While at it I changed the init sequence for the display with an adjusted MADCTL to 0x60 (instead of 0xC0 to get the rotation=0 and a refresh of the display from to to bottom. 0x68 causes inverted colors when using displayio.Palette() so I kept bit D3 of MADCTL at zero.
And I added the missing pins GPIO36 and GPIO39 even though they can only be used as input. And renamed the buttons to BUTTON_L and BUTTON_R to be consistent with the rp2040 version of this board.

Should these changes also be made on the original board?

If I get a thumbs-up I can create a respective pull request. I think all 3 changes would make sense. Don't have a 16M board to test it, though.

@RetiredWizard
Copy link

RetiredWizard commented Jan 9, 2024

The button name change (if made on the 16M version) could break existing code although this PR is against MAIN so it may not show up until 9.x, that being said, the only board that uses BUTTON0 and BUTTON1 is the LIlygo_t_display_esp32_16m. BUTTON1/2/3... is used by a few NRF boards. BUTTON_L/BUTTON_R is only used by the Lilygo_t_display_rp2040 but I'm not sure the L/R (presumably Left/Right) have much meaning for that particular board layout. Several other boards do use BUTTON_LEFT/BUTTON_RIGHT.

I don't think the button name is a big deal but if I were making the decision, I would make the 4M version of this board match the existing BUTTON0/BUTTON1 used by the 16M version. I know that means that code written for the RP2040 version needs extra logic to work on the ESP32 version but that is an existing issue (between the rp2040 and esp 16M versions) and standardizing the two ESP boards seems more important.

My second choice would be to add both aliases to the two ESP boards.

@kreier
Copy link
Author

kreier commented Jan 10, 2024

Button renamed to original version for 16M edition. Indeed, it's not a big deal and best not to break code. Users will probably use some if board.board_id contains '2040': to differentiate between the boards and have the same code running on different editions.

@dhalbert dhalbert linked an issue Jan 17, 2024 that may be closed by this pull request
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.

Thank you!

@tannewt tannewt merged commit 6bdf06c into adafruit:main Jan 17, 2024
15 checks passed
romkey pushed a commit to romkey/circuitpython that referenced this pull request Jan 21, 2024
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.

Add T-Display ESP32 4M
4 participants