-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
adding support for the ST7796 + creating a new variant of the T-beam #6575
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
base: master
Are you sure you want to change the base?
Conversation
…/meshtastic-firmware into T-beam-display-no-touch
converted it to draft because i seem to get SPI related errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good overall, though i'd prefer if you got the touchscreen working as well
e145e10
to
e0bb762
Compare
…/meshtastic-firmware into T-beam-display-no-touch
… for the lora module, display shield pumps out EMI?
yesterday i had a SPI related error every ~20 minutes, also next to zero Bluetooth reception i first want to resolve that issue before i start implementing the touchscreen edit: resolved, Bluetooth reception is resolved with higher pinheaders |
hello, could somebody that has a device with a CST328 test if the detection is working properly?, the else case is the CST328, it detects the CST226SE |
The T-Deck Pro has a CST328. Actually the scan result does not matter as the touch controller is hard-coded for the device variant. |
Hey, @mverch67 , @caveman99 , @thebentern , @vidplace7 , sorry for the ping in the first place. I know it has been a long road for me to get it working properly as in no code duplication etc... But i think the final version is good/proper, could you guys take a look at it and hopefully merge it? kind regards, Wout |
PR7613 also integrates the ST7796 but via TFTDisplay as most other TFT displays do. It would be more homogeneous to also adopt this way for the tbeam display otherwise the code gets more and more confusing (e.g. ST7796_CS vs. USE_ST7796)... |
i understand that code readability is important, but USE_ST7789 is also used with the same driver type as my use case of the USE_ST7796, the mui or the lovyangfx driver is to large to use on the esp32 i know that @Szetya got it working with lovyangfx but he had to exclude default included features. thanks mverch67 for your input |
USE_DISPLAYTYPE has its own driver. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the ST7796 display controller to create a new T-beam variant with the ST7796 display shield. The changes enable a new hardware configuration with touchscreen support using the CST226SE touch controller.
- Modified existing ST7789 library integration to support ST7796 displays
- Created new T-beam variant with display shield configuration
- Added touchscreen support using CST226SE controller with I2C scanning improvements
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
variants/esp32/tbeam/variant.h | Adds ST7796 display and CST226SE touchscreen pin definitions |
variants/esp32/tbeam/platformio.ini | Creates new tbeam-displayshield build environment with ST7796 support |
src/platform/extra_variants/tbeam_displayshield/variant.cpp | Implements CST226SE touchscreen initialization and touch reading logic |
src/mesh/NodeDB.cpp | Adds USE_ST7796 to display detection conditional |
src/main.cpp | Includes USE_ST7796 in screen setup conditionals |
src/graphics/images.h | Extends high-resolution image support to ST7796 |
src/graphics/draw/UIRenderer.cpp | Includes ST7796 in high-resolution display conditionals |
src/graphics/draw/DebugRenderer.cpp | Adds ST7796 support to debug rendering conditionals |
src/graphics/ScreenFonts.h | Includes ST7796 in large font conditional |
src/graphics/Screen.h | Adds ST7796Spi header include |
src/graphics/Screen.cpp | Implements ST7796 display initialization and control logic |
src/detect/ScanI2CTwoWire.cpp | Enhances I2C scanning to differentiate CST226SE from other devices |
src/detect/ScanI2C.h | Adds CST226SE device type to enum |
src/configuration.h | Defines CST226SE I2C addresses |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if (registerValue == 0x5a) { | ||
// Do we have the MLX90614 or the MPR121KB or the CST226SE | ||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x06), 1); | ||
if (registerValue == 0xAB) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 0xAB should be defined as a named constant to improve code readability and maintainability.
if (registerValue == 0xAB) { | |
if (registerValue == CST226SE_DEVICE_ID) { |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this increase readability or should i add a comment on how or what the hex code means?
@@ -588,7 +629,7 @@ void Screen::setup() | |||
touchScreenImpl1->init(); | |||
} | |||
} | |||
#elif HAS_TOUCHSCREEN && !defined(USE_EINK) | |||
#elif HAS_TOUCHSCREEN && !defined(USE_EINK) && !HAS_CST226SE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The conditional logic is becoming complex with multiple negations. Consider refactoring to use positive conditions or extracting this logic into a helper function for better readability.
#elif HAS_TOUCHSCREEN && !defined(USE_EINK) && !HAS_CST226SE | |
#elif HAS_USABLE_TOUCHSCREEN |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requires multiple changes, should this be done, in a other way that's more convenient / readable?
typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…as 2 posible adresses
modified the existing library for the ST7789 to support the ST7796
created a new variant of the T-beam that supports the ST7796 shield
edit:
the touchscreen is
notworkingyet, the address has been added to the scani2c, should i separate it?🤝 Attestations