Closed kraa965 closed 1 year ago
I had a look at the datasheet for the WT32 SC01 Plus as well as the documentation for TFT_eSPI. Although it has "SPI" in the name, the library seems to support 8 bit parallel operation for at least some of the ESP32 module variants, including the ESP32-S3 used on the board so you should be OK.
The trick is going to be working through the GPIO assignments. Fortunately the datasheet has them nicely laid out. WT32-SC01-Plus-V1.3-EN.pdf
in this topic https://github.com/Bodmer/TFT_eSPI/issues/2078 another user asked a question about the work of wt32 sc01 plus on tft_espi and the author replied that 8 bit parallel works from 0-31 Pins, and wt32 sc01 plus has pins above 31, so it will not work on this library
I found out what the error is, why the program does not want to work out the first condition in the void drawButtonRowCol function(uint8_t page, uint8_t row, uint8_t col)
at this moment if (menu[pageNum] hangs.button[row][col].islatched) {
what could be the problem?
Is this when you try the LovyanGFX library?
When you say that the program doesn't want to work out the first condition I assume that you are talking about the line
if (menu[pageNum].button[row][col].islatched) {
just below if (activeButton) {
Is that correct?
void drawButtonRowCol(uint8_t page, uint8_t row, uint8_t col)
{
bool drawTransparent;
uint16_t imageBGColor;
uint16_t buttonBG = TFT_BLACK;
uint16_t outlineColor = TFT_BLACK;
bool activeButton = false;
buttonBG = TFT_BLACK;
outlineColor = TFT_BLACK;
activeButton = false;
uint8_t status = ReturnSuccess;
activeButton = isActiveButton(pageNum, row, col);
if (activeButton) {
if (menu[pageNum].button[row][col].islatched) {
if (menu[pageNum].button[row][col].pLatchImage == nullptr) {
if (psramAvailable) {
status = loadBmpToPSRAM(menu[pageNum].button[row][col].latchlogo, &(menu[pageNum].button[row][col].pLatchImage));
if (status == ReturnSuccess) {
imageBGColor = menu[pageNum].button[row][col].pLatchImage[2];
menu[pageNum].button[row][col].latchImageBGColour = imageBGColor;
menu[pageNum].button[row][col].latchImageBGColourValid = true;
}
else {
MSG_ERROR1("Error allocating PSRAM for latch logo: ", menu[pageNum].button[row][col].latchlogo);
}
}
else {
It is interesting that the following lines are using the PSRAM. Have you seen any PSRAM error messages? Do you know if your processor module has PSRAM? I did some searches for PSRAM on the ESP32-S3 and some messages said that some of them have it and others don't. I found this code https://github.com/AdamJHowell/ESP32_CPU_Memory_Info that is supposed to print out the memory configuration. You could try that and see if the PSRAM is working properly.
Also, could you just please confirm if you ever get anything on the display? Even just a text string with the S/W version number that is displayed at startup?
Also, could you just please confirm if you ever get anything on the display? Even just a text string with the S/W version number that is displayed at startup?
yes, the version, PSRAM and loading of images into PSRAM are displayed on the screen, but the buttons themselves from the void drawButtonRowCol function(uint8_t page, uint8_t row, uint8_t col) are not output, they hang on if (menu[pageNum].button[row][col].islatched)
Does "hang" mean that if (menu[pageNum].button[row][col].islatched)
is never true (in which case execution should continue at the
else {
if (menu[pageNum].button[row][col].pImage == nullptr) {
statement? Or that it tests true, execution continues on the next line, but nothing seems to happen? What type of test did you use to show that it hangs there?
Just to get the PSRAM out of the picture, could you try the following change in FreeTouchDeckWT32.cpp? Comment out the test for psramAvailable, and force it to be false.
void setup()
{
// Use serial port
Serial.begin(115200);
Serial.setDebugOutput(true);
MSG_INFOLN("");
MSG_INFOLN("[INFO] Loading saved brightness state");
savedStates.begin("ftd", false);
ledBrightness = savedStates.getInt("ledBrightness", 255);
MSG_INFOLN("[INFO] Brightness has been set");
// psramAvailable = psramFound();
psramAvailable = false;
Another thing to try would be to see if there is anything in menu0.json that it doesn't like. Could you post your latest version? Either download menu0.json to your PC using the configurator, or send whatever version is on your PC now and make sure it still fails when you upload that version with "Upload Filesystem Image" in PlatformIO. I will try it on my system.
Just to get the PSRAM out of the picture, could you try the following change in FreeTouchDeckWT32.cpp? Comment out the test for psramAvailable, and force it to be false.
psramAvailable was set to true, but rendering did not occur
// psramAvailable = psramFound();
psramAvailable = false;
the same thing, the buttons are not drawn
tft.setFont(LABEL_FONT);
key[row][col].initButton(&tft, KEY_X + col * (KEY_W + KEY_SPACING_X),
KEY_Y + row * (KEY_H + KEY_SPACING_Y), // x, y, w, h, outline, fill, text
KEY_W, KEY_H, outlineColor, buttonBG, outlineColor,
(char *)"", KEY_TEXTSIZE);
key[row][col].drawButton();
for some reason, the key[row][col].drawButton() function(taken from the LovyanGFX library) is not executed in DrawHelper.cpp
My menu0.json file menu0.zip
Check my branch LovyanGFX pushed a couple of minutes ago. It is working on a standard WT32-SC01 (not the "Plus") with the LovyanGFX library. You will need to figure out how the parallel communication is defined (presuambly already in hand as you said that you see the version number, etc.). You will probably need some other variant of the "LGFX_ESP32_ST7796_Generic.hpp" file. I built it from a template in "FreeTouchDeckWT32.pio\libdeps\esp-wrover-kit\LovyanGFX\src\lgfx_user". You might be able to start from "LGFX_ESP32S2_DSO138_Parallel8.hpp" in the same folder. Copy it into a new file in your include folder so that it doesn't get overwritten if the library is updated, make whatever changes are needed, then include the new file rather than "LGFX_ESP32_ST7796_Generic.hpp". Good luck!
The LovyanGFX branch shows that the code can be run with that library. However, I do not plan on moving away from TFT_eSPI because:
Hi there, I have added support for the WT32-SC01 Plus module to TFT_eSPI and created a pull request (3423). While it is being reviewed you can give it a spin using my fork.
Hi there, I have added support for the WT32-SC01 Plus module to TFT_eSPI and created a pull request (3423). While it is being reviewed you can give it a spin using my fork.
I tried to use your library but Im getting error when Im trying to upload it.
In file included from /Users/user/Documents/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:20:
/Users/user/Documents/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_S3.c: In member function 'uint8_t TFT_eSPI::readByte()':
/Users/user/Documents/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32_S3.c:96:8: error: 'gpio_get_level' was not declared in this scope; did you mean 'gpio_ll_get_level'?
96 | b = gpio_get_level((gpio_num_t)TFT_D0); // Read three times to allow for bus access time
| ^~~~~~~~~~~~~~
| gpio_ll_get_level
exit status 1
Compilation error: exit status 1
I assume you are using arduino-esp32 version 3.x, which introduced breaking changes to TFT_eSPI (not related to my changes). For the time being, if you want to use TFT_eSPI you have to downgrade your arduino_esp32 to version 2.x. I'm using 2.0.14 without any issues on PlatformIO and Arduino. See TFT_eSPI issue #3355
Hi there, I have added support for the WT32-SC01 Plus module to TFT_eSPI and created a pull request (3423). While it is being reviewed you can give it a spin using my fork.
Thank you for doing that. I don't have a Plus board so won't be able to try it out until I buy one. Do you see any improvement in the screen update speed with the parallel I/O? Having the S3 processor should allow the FreeTouchDeckWT32 code to be adapted to connect as a USB HID device rather than using bluetooth.
I'd consider the speed about on par with the WT32-SC01 operating at 40MHz SPI. However, the WT32-SC01-Plus's display has much better viewing angles, the touch screen seems to be directly fused to the display (better contrast), and moving graphics seem to create less artifacts (smearing, shifting colors, ...). Apart from this I prefer the mechanical design and there are the obvious advantages of having an ESP32-S3. I still have a few WT32-SC01 sitting around, but I always find myself using the WT32-SC01-Plus instead (this is why I decided to bite the bullet and get TFT_eSPI working).
Good afternoon, maybe tell me, you can somehow transfer your firmware from TFT_eSPI to LovyanGFX, since TFT_eSPI does not support 8 bit parallel operation on WT32 SC01 Plus, or maybe you can somehow make WT32 SC01 Plus work on TFT_eSPI. I will be very grateful for the answer)