Xinyuan-LilyGO / TTGO-T-Display

MIT License
1.05k stars 337 forks source link

How to make the display work? #1

Open Nufflee opened 5 years ago

Nufflee commented 5 years ago

I tried running the exact example code using the forked TFT_eSPI but the only thing I could get working is the backlight. I also used the correct User Setup but it just wouldn't work. I could use some guidance with this.

tablatronix commented 5 years ago

At first I thought it was tft_espi, but that will not have the offset defines in it yet.

I found this though, which seems to be a non forked clone ( why!!!!! what is so hard about forking and PR your changes ? )

https://github.com/REVOtic/TFTDriver

https://github.com/REVOtic/TFTDriver/blob/master/TFT_Drivers/ST7789_Rotation.h#L34

#ifdef TTGO_114_INC_DISPLAY
      colstart = 53;
      rowstart = 40;
  #else
       colstart = 0;
       rowstart = 80;
  #endif
Nufflee commented 5 years ago

@tablatronix That actually does work perfectly! Thank you so much!

Nufflee commented 5 years ago

Actually @LilyGO @lewisxhe you should fix the README.

cyraxx commented 5 years ago

Looks like the repo linked in the README now includes the proper defines. It works fine for me (after enabling the correct User_Setup).

TotallyInformation commented 5 years ago

@cyraxx I've just tried the version in the README and it does not work - see Issue #4

The REVOtic library works perfectly.

OK, now I see that the README references a FORK of the TFT_eSPI library rather than the original. That fork is 96 commits behind current. So clearly not being maintained very well. That is crazy - why not just submit a PR back to the original to get the correct settings included?

I'm guessing that, while it works, the REVOtic library is probably even worse since it doesn't even reference the original it was based on.

What a pain. I can't see myself buying any more LilyGO hardware if this is the quality of support.

cyraxx commented 5 years ago

Yup, both of the libraries referenced in README are actually forks.

I didn't check whether their fork or the REVOtic one is more current but they do both include the offsets needed for this board.

TotallyInformation commented 5 years ago

This is what the readme says:

Move or copy User_Setups/TTGO_T_Display.h to TFT_eSPI/User_Setups/

But that source does not exist in this repo nor in the fork. So the README needs to be at least updated.

I've tried using the original TFT_eSPI library and I can nearly get it working correctly. However, the offsets are clearly not quite right somewhere because some of the original bitmap still shows to the right of the screen (about a 1/3 of the right-hand-side).

I'll look at it again tomorrow if I have time and if I can work it out, I'll raise an issue with Bodmer's repo.

cyraxx commented 5 years ago

Move or copy User_Setups/TTGO_T_Display.h to TFT_eSPI/User_Setups/

But that source does not exist in this repo nor in the fork. So the README needs to be at least updated.

The source file actually is in this repo but the path in the README is wrong - it's in the root directory, not in User_Setups. Copying that file into the lewisxhe fork of TFT_eSPI (and editing User_Setup_Select.h to include it) made it work for me.

BTW I found this issue in Bodmer´s repo: https://github.com/Bodmer/TFT_eSPI/issues/379 I think that's the same screen.

lewisxhe commented 5 years ago

Yes, the referenced TFT_eSPI is the branch that I modified after the fork. I should describe it clearly in the readme. Thank you for your reminder.

TotallyInformation commented 5 years ago

Well, I've looked again but there are too many differences between the libraries for me to work it out. I'll raise an issue in Bodmer/TFT_eSPI though to see if someone with better understanding than me can add T-Display support to the original library. Oops, I should have checked, Issue #379 has already been raised.

I still can't work out how the offset works even though I've changed the entries in the TFT_Drivers folder to include the rotation (and other) changes.

Drat, wasted some time there. You also need to set the define for CGRAM_OFFSET in TFT_Drivers/ST7789_Defines.h.

So, with the simple tweaks to the original library, you can use it just fine. Hopefully, Bodmer will be able to update soon.

Also I note that you have to manually turn on the backlight so you need to add that code to the setup function of the Bodmer/TFT_eSPI repo examples.

tablatronix commented 5 years ago

The backlight is IO4 NOT IO14 as the graphic on the readme says!

Bodmer commented 5 years ago

TFT_eSPI has been updated to include offsets for this display. A new user setup file has been added to show the setup used for testing.

lewisxhe commented 5 years ago

The library used has been synchronized to the main branch

SuperEugen commented 5 years ago

I added the following two lines to the TTGO_T_Display.h file and can now use the examples from the original TFT_eSPI library from @Bodmer :

define TFT_BL 4

define TFT_BACKLIGHT_ON HIGH

@lewisxhe can you add these lines to the .h file?

Joennuh commented 5 years ago

It is the best to handle that in your main sketch since the pin on which the led backlight is connected is capable of PWM. Defining an on or off state in header file could lead to issues to set the backlight intensity. And besides that: the example sketch already turns the backlight on on line 135: https://github.com/Xinyuan-LilyGO/TTGO-T-Display/blob/master/TTGO-T-Display.ino#L135

Bodmer commented 5 years ago

Defining the backlight pin and level in the setup file does not affect the ability to use PWM later in the sketch. The pin is only set during the init() function.

The point of defining the pin in the setup file is that all the existing TFT_eSPI examples can then be run without modification.

lewisxhe commented 5 years ago

The reason I define it in the sketch is to let everyone know the pin behind it. I feel that this is not a big problem.

lewisxhe commented 5 years ago

I can of course add it. Small meaning. @SuperEugen

auculab commented 4 years ago

Hello, can you pls request your support on how to turn off the backlight of TTGO T-Display. I want to turn off the display backlight after a timeout to be able to conserve battery if not being used and bring back at the press of button 2. I'm unable to find how to reverse this.

     digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); 

Thank you

lewisxhe commented 4 years ago

digitalWrite(TFT_BL, 0); @auculab

kalyan540 commented 4 years ago

Pls help me the TTGO-TDisplay won't display anything after I upload a new code TTGO_T-Display.ino,and I follow instructions in readme.md,could any one rectify my problem.

lewisxhe commented 4 years ago

@kalyan540 Please manually refresh the firmware in the warehouse to eliminate hardware problems.

kalyan540 commented 4 years ago

@lewisxhe Thanku for your reply If my problem is not solved then I reply ones.

lewisxhe commented 4 years ago

@kalyan540 If that doesn't work, please contact customer service and provide a video

kalyan540 commented 4 years ago

@lewisxhe it is working but not displaying anything ,it shows in serial monitor(voltage, WiFi networks), and it is a new one, before uploading it displays (like brand and voltage....)but after uploading TTGO.....ino only backlight is glowing ... What should I do now..?

lewisxhe commented 4 years ago

Sorry, it should be the screen is damaged, please contact customer service

kalyan540 commented 4 years ago

@lewisxhe Thanku for your reply It is working with Adafruit_ST7789.h along with Adafruit_GFX.h library functions, I think code has some errors, pls do any changes, and I got an error msg " TFT_BACKLIGHT_ON was not declared in this scope " Thanku.

lewisxhe commented 4 years ago

@kalyan540 Define a macro directly `

define TFT_BACKLIGHT_ON 1

` Or directly change TFT_BACKLIGHT_ON to 1

kalyan540 commented 4 years ago

@lewisxhe Thanks for your reply

#define TFT_BACKLIGHT_ ON  HIGH //it is working (Backlight on)

But the TFT_eSPI.h library function is not working for my ttgo t-display ,and I followed the instructions in Readme.md Pls show me a way to work with this library .