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

TRGBArduinosupport lib does not work properly #43

Closed
ThomasSlowhand opened this issue Jan 16, 2024 · 42 comments
Closed

TRGBArduinosupport lib does not work properly #43

ThomasSlowhand opened this issue Jan 16, 2024 · 42 comments

Comments

@ThomasSlowhand
Copy link

You recommended:

Easy to use RGB panel library, organized by fablabnbg/TRGBArduinoSupport,This is more recommended for novices<<

TRGBArduinosupport works fine with FT3267 board, but with CST820 board the touch-function raises a fault in PIO serial monitor:

Connecte[ 15731][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
[ 15761][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
[ 15791][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1

With GT911 boards the touch-function does not work at all.

@lewisxhe
Copy link
Contributor

Because the CST820 enters sleep mode, the CST820 will not respond from I2C until the touch starts.

@ThomasSlowhand
Copy link
Author

Hello Lewis,

with CST820 the touch is signaled, but is not properly handled by TRGBArduinosupport, this error msg is raised with every touch:

Connecte[ 15731][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
[ 15761][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
[ 15791][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1

@lewisxhe
Copy link
Contributor

You shouldn't get errors when touching. Can touch be used normally except for reporting errors?

@ThomasSlowhand
Copy link
Author

No, CST820 and GT911 the touch function is faulty and does not work, touch is not recognized by the software using TRGBArduinosupport.. But only CST820 generates the mentioned error msg in the serial monitor. Because this lib is a re-mixed excerpt from your "factory" example I hope you might have more clue about this issue.

@lewisxhe
Copy link
Contributor

TRGBArduinoSupport is written by fablabnbg. He has stated in the README that he only uses FT3267 and does not support other models. If you need to use other models. If you use other two types of touch, please use the examples provided by this warehouse, or modify TRGBArduinoSupport.

@ThomasSlowhand
Copy link
Author

He has updated the lib in 09/2023, please read
https://github.com/fablabnbg/TRGBArduinoSupport/issues/5,
but it not working properly as already reported.

@lewisxhe
Copy link
Contributor

lewisxhe commented Jan 19, 2024

T-RGB was maintained by @mmMicky in the early days. It is really not good for novices. I have been integrating the LilyGo display series recently and TRGB is also planned. Please give me some time and I will reorganize T-RGB.

@ThomasSlowhand
Copy link
Author

Hello Lewis,

T-RGB is a really good product, and is very useful for my project for which I am planning to sell a few hundred items if I can proceed with it. I already have on project ready with 2.1" halfcircle, but its screen shape is too weird and it is to complicated to mount, because it needs a wide bezel to fasten which looks ugly. I therefore definitely need 2.1" fullcircle & 2.8", but as long as I cannot use the TRGBArduinosupport with it, both my projects are halted.I do not know what you mean with "I will reorganize T-RGB.", my only need is to get TRGBArduinosupport working with these two board versions.

@lewisxhe
Copy link
Contributor

I understand, what I mean is to integrate the drivers together, and there is no need to distinguish the driver model. I have already implemented many cases, and TRGB is not difficult. Please give me a few days.

@ThomasSlowhand
Copy link
Author

Yes, this was already announced for being done by Ian Hubberts when creating the 2nd version (09/2023) of TRGBArduinosupport as already mentioned by me, and if you can get this lib working with the two other board and touch controller versions the sun will shine for me again. The lib eases the pain to work manually with LVGL by using Squarlinestudio, so it might be very important for future buyers of your T-RGB boards. My hardware specific programming knowledge is very limited, as my last programming experience is 25 years old, and with 70 years, as I am now, I do not want to learn new skills.

@lewisxhe
Copy link
Contributor

@ThomasSlowhand
I have completed the upgrade to T-RGB and now it is installed in the form of a library. Users do not need to distinguish between 2.1 and 2.8, nor what touch model it is.

@lewisxhe
Copy link
Contributor

I will register the platformio and arduino libraries for T-RGB soon. Then you can install it directly from pio or arduino. Please use it manually now.

lib_deps =
https://github.com/Xinyuan-LilyGO/LilyGo-T-RGB

@ThomasSlowhand
Copy link
Author

ThomasSlowhand commented Jan 25, 2024 via email

@ThomasSlowhand
Copy link
Author

ThomasSlowhand commented Jan 25, 2024 via email

@lewisxhe
Copy link
Contributor

Below is my demo platformio.ini. You can develop directly in the root directory of LilyGo-T-RGB, or you can integrate LilyGo-T-RGB into your project.

[env:T-RGB]
platform = [email protected]
board = esp32s3box
framework = arduino
board_build.partitions = default_16MB.csv
upload_speed =  921600
monitor_speed = 115200
build_flags =
    -DLV_CONF_INCLUDE_SIMPLE
    -DDISABLE_ALL_LIBRARY_WARNINGS
    ; Enable UARDUINO_USB_CDC_ON_BOOT will start printing and wait for terminal access during startup
    ; -DARDUINO_USB_CDC_ON_BOOT=1
    ; Enable UARDUINO_USB_CDC_ON_BOOT will turn off printing and will not block when using the battery
    -UARDUINO_USB_CDC_ON_BOOT

; If you are not using TFT_eSPI, and GFX Library for Arduino can be ignored to reduce compilation time.
lib_ignore = 
    TFT_eSPI
    GFX Library for Arduino
lib_deps = 
    https://github.com/Xinyuan-LilyGO/LilyGo-T-RGB
    FS
    SPIFFS


image

@lewisxhe
Copy link
Contributor

lewisxhe commented Jan 25, 2024

Now LilyGo-T-RGB has been registered in platformio, you can also use pio management to do it

[env:T-RGB]
platform = [email protected]
board = esp32s3box
framework = arduino
board_build.partitions = default_16MB.csv
upload_speed =  921600
monitor_speed = 115200
build_flags =
    -DLV_CONF_INCLUDE_SIMPLE
    -DDISABLE_ALL_LIBRARY_WARNINGS
    ; Enable UARDUINO_USB_CDC_ON_BOOT will start printing and wait for terminal access during startup
    ; -DARDUINO_USB_CDC_ON_BOOT=1
    ; Enable UARDUINO_USB_CDC_ON_BOOT will turn off printing and will not block when using the battery
    -UARDUINO_USB_CDC_ON_BOOT

; If you are not using TFT_eSPI, and GFX Library for Arduino can be ignored to reduce compilation time.
lib_ignore = 
    TFT_eSPI
    GFX Library for Arduino
lib_deps = 
    xinyuan-lilygo/LilyGo-T-RGB @ ^1.0.0
    FS
    SPIFFS

@ThomasSlowhand
Copy link
Author

ThomasSlowhand commented Jan 25, 2024 via email

@lewisxhe
Copy link
Contributor

cheers🍻

@lewisxhe
Copy link
Contributor

@ThomasSlowhand Please note that due to changes in platformio, LilyGo-T-RGB was registered under my name and has now been changed to xinyuan-lilygo/LilyGo-T-RGB.

Please remember to change the dependency to

lib_deps = 
    xinyuan-lilygo/LilyGo-T-RGB @ ^1.0.0

@ThomasSlowhand
Copy link
Author

Many thanks, Lewis, but do you have any clue, while serial debug is not working, even if

-DBOARD_HAS_PSRAM
-DLV_LVGL_H_INCLUDE_SIMPLE
-DARDUINO_USB_MODE=1
; Enable UARDUINO_USB_CDC_ON_BOOT will start printing and wait for terminal access during startup
-DARDUINO_USB_CDC_ON_BOOT=1
; Enable UARDUINO_USB_CDC_ON_BOOT will turn off printing and will not block when using the battery
;-UARDUINO_USB_CDC_ON_BOOT

is set correctly?

@lewisxhe
Copy link
Contributor

You can add while(!Serial); after Serial.begin(115200);
Wait for the Serial monitor to connect before starting it and see if you can print messages.

void setup(){
Serial.begin(115200);
while(!Serial); 

while(1){
Serial.println(millis());
delay(1000);
}
}

@ThomasSlowhand
Copy link
Author

ThomasSlowhand commented Jan 27, 2024 via email

@lewisxhe
Copy link
Contributor

I noticed ARDUINO_USB_MODE=1 , please set ARDUINO_USB_MODE to 0 , or remove it, if set to 1 then serial messages will be output from GPIO43,44 by default

@ThomasSlowhand
Copy link
Author

ThomasSlowhand commented Jan 27, 2024

Setting ARDUINO_USB_MODE=0 causes warnings for each complied file:

: warning: "ARDUINO_USB_MODE" redefined
: note: this is the location of the previous definition
Compiling .pio\build\T-RGB\lib913\lvgl\draw\sdl\lv_draw_sdl_stack_blur.c.o
Compiling .pio\build\T-RGB\lib913\lvgl\draw\sdl\lv_draw_sdl_texture_cache.c.o

Removing ARDUINO_USB_MODE=1 resolves these warnings, but does not heal the fault.

But I think, it is some sort of timing problem:

If I press "RESET" on the device only shortly, the serial monitor does not recognize the disconnection of the device and stays connected. No serial output.

But if I press RESET longer than 2-3 seconds, the serial monitor recognizes the disconnection of the device and reconnects, and serial output is running.

@lewisxhe
Copy link
Contributor

T-RGB uses USBC, that is, USB-CDC simulates serial and then outputs messages. When RESET is pressed, the device will not be able to run. At this time, the USB device will be invalid, so the serial monitor cannot recognize it.
But after releasing RESET, the device will restart and the USB serial device should be recognized normally.
The effect of short press and long press should be the same. If short press does not work, I will suspect whether there is something wrong with the button.

@ThomasSlowhand
Copy link
Author

No, it only works when the RESET button is pressed long. No hardware failure, I've tried this with two different devices (2.1 full circle and 2.8"), same behavior on both devices. Cross-checked with another project and ESP32 with IL9341 display, this acts normal with the serial monitor.

@ThomasSlowhand
Copy link
Author

A short press on reset does not make the USB device invalid for the serial monitor. And, as already mentioned, I think the serial monitor output is much slower than normal.

@lewisxhe
Copy link
Contributor

I'm not sure if my understanding is correct, can you record a video for me to check if it is correct?

@ThomasSlowhand
Copy link
Author

When I press "Reset" only shortly, the serial is not disconnected from the device. Only if I press "Reset" longer than 3-5 seconds, than the serial monitor detects a connection loss.

@lewisxhe
Copy link
Contributor

I uploaded a video so you can see if your T-RGB behavior matches mine
https://youtu.be/8d4hLItuTR4

@ThomasSlowhand
Copy link
Author

Hello Lewis,

many thanks for your engagement, it is truly appreciated. Despite your video more looks like the necessary driver installation for a SIM-7000, my T-RGB act like described: A short press on "RESET" does not make the PIO serial monitor disconnect from the COM-port, it stays connected. Only by a long press (4-5 sec) on "RESET" the serial monitor detects a communication loss to the com-port and reconnects, after reconnection debug information by "serial.print" is displayed. When stopping serial monitor output by clicking "stop Monitoring" the screen of the device is shut off and gets dark.

@lewisxhe
Copy link
Contributor

Sorry, the link is wrong, this is
https://www.youtube.com/watch?v=srqI424p5Yk

@lewisxhe
Copy link
Contributor

I noticed you said platformio monitor's window, this is inaccurate, you should be monitoring the computer device manager

@lewisxhe
Copy link
Contributor

This is the Serial monitoring software used in my video
Sscom_V5.13.1.zip

@lewisxhe
Copy link
Contributor

lewisxhe commented Jan 29, 2024

I rarely use platformio Serial monitor, but I just tested it and I have the same problem as you. This is a problem with the platformio monitor. After you press Rst, make sure you click on the Serial monitor and press Enter on the keyboard. platformio It can detect Serial disconnection immediately. If you don't press Enter, it will not be detected.

@ThomasSlowhand
Copy link
Author

I noticed you said platformio monitor's window, this is inaccurate, you should be monitoring the computer device manager

My device manager acts the same as yours. Immediate disconnection detected.

@ThomasSlowhand
Copy link
Author

This is the Serial monitoring software used in my video Sscom_V5.13.1.zip

I use this and it works fine:

image

@ThomasSlowhand
Copy link
Author

I rarely use platformio Serial monitor, but I just tested it and I have the same problem as you. This is a problem with the platformio monitor. After you press Rst, make sure you click on the Serial monitor and press Enter on the keyboard. platformio It can detect Serial disconnection immediately. If you don't press Enter, it will not be detected.

What are you using? Arduino IDE? Many thanks for the hint, I will check it.

@lewisxhe
Copy link
Contributor

So that's normal.
I use platformio as the compiler, but I use SSCON to monitor the serial data, because it can freely set the RTS DTR to reset the board without disconnecting the USB connection

@ThomasSlowhand
Copy link
Author

So that's normal. I use platformio as the compiler, but I use SSCON to monitor the serial data, because it can freely set the RTS DTR to reset the board without disconnecting the USB connection

I cannot use that, because the UI is in Chinese...

@lewisxhe
Copy link
Contributor

image
Check here

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

No branches or pull requests

2 participants