Arduino Forum

Using Arduino => Displays => Topic started by: bodmer on Dec 23, 2016, 04:22 pm

Title: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Dec 23, 2016, 04:22 pm
Update on 15/8/18: The TFT_eSPI library can now be loaded via the library manager in the Arduino IDE.


Update on 11/3/18: The libray now supports 8 bit parallel TFTs with an ESP32. For example UNO style TFT displays made by mcufriend.

UPDATE on 22/2/17: The TFT_ILI9341_ESP library has now morphed into a new library that supports multiple display drivers. The new library TFT_eSPI can be found here (https://github.com/Bodmer/TFT_eSPI). See also post #63 (https://forum.arduino.cc/index.php?topic=443787.msg3145402#msg3145402). The library currently supports the ILI9341, ILI9163, ST7735 and S6D02A1 based TFT displays with SPI interface.


I have ported my TFT_ILI9341 graphics library to the NodeMCU.  A copy can be found on GitHub (https://github.com/Bodmer/TFT_ILI9341_ESP).


The library support use of the hardware SPI interface, example connections for a NodeMCU board with a 2.2" 320x240 display are:

Display SDO/MISO to NodeMCU pin D6
Display LED      to NodeMCU pin VIN (5V)
Display SCK      to NodeMCU pin D5
Display SDI/MOSI to NodeMCU pin D7
Display DC       to NodeMCU pin D3
Display RESET    to NodeMCU pin D4
Display CS        to NodeMCU pin D8
Display GND      to NodeMCU pin GND (0V)
Display VCC      to NodeMCU pin VIN (5V)

Performance is quite reasonable with a 40MHz SPI clock when running the graphicstest sketch:

Benchmark                Time (microseconds)
Screen fill              161973
Text                     49593
Lines                    320578
Horiz/Vert Lines         17827
Rectangles (outline)     13985
Rectangles (filled)      333103
Circles (filled)         187493
Circles (outline)        210565
Triangles (outline)      70579
Triangles (filled)       212988
Rounded rects (outline)  88425
Rounded rects (filled)   429151
Done!

The library is based on (but does not use) the Adafruit_GFX library. Extra fonts have been added that are encoded for fast rendering. Text and numbers can also be right/left/centre justified to assist in creating neat displays.

Examples are included which show how to use the features.

Report any bugs here.

Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Dec 23, 2016, 05:55 pm
Amazingly the the ILI9341 based display I have seems to work OK with a 160MHz SPI clock (not recommended though!) ...

If you want to try this change the CPU frequency in the IDE to 160MHz and set the SPI frequency in the library's User_Setup as follows:

 #define SPI_FREQUENCY 160000000


Results then are that the ported UTFT_demo completes in 1.2s and graphicstest completes in 1.12s:

Benchmark                Time (microseconds)
Screen fill              81895
Text                     28177
Lines                    180730
Horiz/Vert Lines         9173
Rectangles (outline)     7297
Rectangles (filled)      168457
Circles (filled)         101677
Circles (outline)        121312
Triangles (outline)      39352
Triangles (filled)       111733
Rounded rects (outline)  50062
Rounded rects (filled)   219447
Done! Total = 1118586


Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: david_prentice on Dec 23, 2016, 06:07 pm
Ah-ha.   I generally find that ARM M3 or M4 go faster than the TFT on 8-bit parallel interface.

Are you really going at SCK = 80MHz?
One byte is going to take 100ns.   

Quote
18.3.4 Display Serial Interface Timing Characteristics (4-line SPI system)
TFT Instruction write cycles are 100ns.  Read cycles 150ns.

Quote
18.3.1 Display Parallel 18/16/9/8-bit Interface Timing Characteristics (8080-Ⅰ system)
Write cycle = 66ns.  Read cycle is 450ns.

In practice,  I have found that read cycles are often slower than the datasheet suggests.   Yes,  ILI9341 is a lot faster than some "other" models.

David.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Dec 23, 2016, 06:31 pm
@david_prentice

Yes, it dawned on me that the SPI frequency is set to 80MHz even though the CPU clock has been upped to 160MHz.

So the results in post#1 are with 160MHz CPU and 80MHz SPI clock. Trying to set the SPI clock to 160MHz actually only sets it to 80MHz.

Very aggressive tests indicate that 80MHz SPI clock is marginal and pixels etc can get "lost" at that frequency, so 40MHz SPI is the highest my setup works reliably in this situation.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: ZinggJM on Dec 23, 2016, 06:40 pm
First I got a Christmas Tree, now I get even a BIG Christmas Present! Thank you.

Would it be easy to adapt it to support 9 bit SPI transfer? There seem to be quite a few TFTs without C/D pin.

Merry Christmas and a Happy New Year to all of you.

Jean-Marc
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: ZinggJM on Dec 25, 2016, 06:18 pm
I don't understand how and where the member variable:

SPIClass *_SPI;

gets initialized.

Somehow it works, and it works extremely well, speed is impressive.

I tried to enhance the SPI class of the ESP8266 package. But adding additional member values does not work, I got exceptions on access to these member variables. So I created a new class SPI9Class, and modified a copy of TFT_ILI9341_ESP to use this class:

SPI9Class * _SPI9;

but it looks like the pointer gets set to the standard SPI instance of SPIClass.

Strange.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bperrybap on Dec 26, 2016, 11:25 pm
The library needs a license file.
The code says it is a derivative work from the adafruit code. If so, then it must retain the original copyrights and license of that code.
I'd recommend putting the removed license file back in the repository as well as the source code file copyright and license information back at the top of the source modules.
Even better would be to do a fork from the original adafruit code and then apply your changes to your repo.
That way everything is properly tracked back to the original work.
It also might create the potential to do pull requests or merges back to the original adafruit code.

--- bill
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: ZinggJM on Dec 27, 2016, 05:40 am
The library needs a license file.
The code says it is a derivative work from the adafruit code. If so, then it must retain the original copyrights and license of that code.
I'd recommend putting the removed license file back in the repository as well as the source code file copyright and license information back at the top of the source modules.
Even better would be to do a fork from the original adafruit code and then apply your changes to your repo.
That way everything is properly tracked back to the original work.
It also might create the potential to do pull requests or merges back to the original adafruit code.

--- bill
That's why I like the concept of "Help Yourself Software", that I try to introduce.

It is more open than Open Software, but with its true meaning, give away and take, without obligations.

Jean-Marc Zingg, 27.12.2016
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Dec 27, 2016, 10:54 am
@bperrybap
Here's a link to the Adafruit library (https://github.com/adafruit/Adafruit_ILI9341) that this is derived from, no license file has been removed.  The original Adafruit MIT licence text has been retained in the main .cpp and .h files, see header for location.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bperrybap on Dec 27, 2016, 06:41 pm
It appears to me that this library is a mushing together of two adafruit libraries (Adafruit-GFX-Library and Adafruit_ILI9341) with some tweaks & modifications to create a single library that does not depend on either original library.
If so, it makes it a derivation subject to both library's copyrights and licenses.

Your original post says:
Quote
The library is based on (but does not use) the Adafruit_GFX library.
but given the similarity of the code and and a few of the comments in the .cpp and .h files
like:
Quote
This library has been derived from the Adafruit_GFX
  library and the associated driver library. See text
  at the end of this file
and
Quote
// Fill a triangle - original Adafruit function works well and code footprint is small
it appears that it is based on (as in uses code from Adafruit_GFX library) but then does not depend on that library.

Was any code taken from Adafruit-GFX-Libary ? (It does look like it)

If so, the library is missing the required copyright notice from the Adafruit-GFX-Library .cpp file.
It would also be helpful to provide links back to the repositories for the original code.

Regardless of the library's heritage, it is always best to have a clear license file included in the top level directory.
Adafruit-GFX has one, but Adafruit_ILI9341 doesn't (I'll go file a bug to get LadyAda to correct that).

--- bill




Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: ZinggJM on Dec 27, 2016, 06:57 pm
Uff, this is ugly. I don't give credit to Bjarne Stroustrup for every line of C++ code I produce, or have copied from somewhere.

I thought the whole Arduino World is based on Open Software. This openness is what makes it live and evolve, so rapidly.

Lets continue in this attitude.

Jean-Marc Zingg
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bperrybap on Dec 27, 2016, 07:28 pm
I don't think it is getting ugly at all. s/w is considered private copyrighted work that is protect against copying unless otherwise noted; so, some sort of copyright and licensing must be stated and granted if it is to be shared and used by others.

Open source is not the same as FreeWare.
Open source usually comes with copyright and licensing requirements/restrictions that allows it to be copied and shared and often does not allow it to be used in certain ways.
So you can't just copy open source software and use it anyway you want.
That is the price you pay for being able to start with someone else's s/w code vs having to start from scratch.
People have different views on the s/w that they create and the license they choose allows them to choose how their s/w can or cannot be used by others.

In this case it looks like it might be easy to clean things up by adding some missing notices and copyrights.
The tricky part will be if the the library is using code from both GFX and and ILI9341 since they have different licenses.
It may be that the combined work will have to become BSD vs MIT since I think BSD is a bit more restrictive, assuming the MIT licensing actually allows that.
(Although I just created an issue in the Adafruit ILI9314 library asking them to clarify the licensing)

btw, I faced a some licensing & copyright issue when I created my arduino hd44780 library.
This was mainly because the Arduino team (Including Adafruit) was so sloppy with their licensing and copyrights.
This was particularly an issue on the LiquidCrystal library. I pushed hard on both Arduino and Adafruit to clean up their copyrights and licensing on their code & libraries and for the most part they have.
In my case I was having to dance around a bit since they originally didn't have any licensing or copyright notices for LiquidCrystal when I started hd44780.
They had a very vague and general license file for Arduino code but that license file was never included with the Arduino IDE distribution - it was only in the repository - so nobody that had the IDE would ever be able to see it - which does not comply with the GPL/LGPL requirements.
My eventual solution was to look at their intent and went with that until they updated their licensing.
I now also include a licenseInfo.txt file that provides a detailed description of the licensing and the history of the licensing of the original sources.
You can see in my repo here: https://github.com/duinoWitchery/hd44780 (https://github.com/duinoWitchery/hd44780)

I am a big believer in s/w copyrights and licensing and believe that ALL s/w should be very clear as to its licensing and the lineage of the code, including arduino libraries and sketches.

One of the worst licenses of all is Creative Commons CC-BY-SA 3.0 as that license is not compatible with anything but itself. It was never intended to be used on a work that is piece of something else. So legally you can't ever create a public/shared project that uses it in something like an adrduino project (even if the CC-BY-SA 3.0 work is just a library) since CC-BY-SA 3.0 is not compatible with other licenses like GPL/LGPL code due to some of the attributions required by CC-BY-SA 3.0 that are forbidden by GPL/LGPL.
CC-BY-SA 4.0 was created to work around this by allowing the work to be re-licensed as GPL/LGPL.

--- bill
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Dec 28, 2016, 07:48 pm
@bperrybap

Ah! Missed the BSD reference, it seems that Adafruit have different license and license versions sprinkled through their various libraries.

I've have updated the repository.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Dec 28, 2016, 07:56 pm
The NodeMCU has an ESP8266 at heart which makes a networked sketch for the library a must, so here is a starter sketch that will (after some more tweaks) find it's way into the examples

If anyone has some cool ideas for another networking sketch that needs a TFT then post on this thread.

Work on this library will cease now for a while until I can persuade Alexa (i.e.and Amazon Echo) to talk to and read some networked sensors, that may take some time as she is proving to be a bit obstinate :-)
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bperrybap on Dec 28, 2016, 08:50 pm
Ah! Missed the BSD reference, it seems that Adafruit have different license and license versions sprinkled through their various libraries.
They have been and continue be sloppy with their licenses. And in some past cases they have violated licenses and copyrights by claiming a different license for their derivative work that is simply not allowed.
It has gotten better in recent times, but as you have seen, there are still some "gotchyas".


The NodeMCU has an ESP8266 at heart which makes a networked sketch for the library a must, so here is a starter sketch that will (after some more tweaks) find it's way into the examples
Have you seen the WifiManager? It is really cool.
You might consider adding the WifiManager to the code so that it is usable "out of the box".
i.e. users attached to it to set the ssid & password rather than have to hard code them in to the sketch code.
But that does add more complexity and the addition of another library so you may not want to go that route. - but is very cool.

--- bill
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Dec 29, 2016, 10:36 pm
@bperrybap

Had a look at WifiManager, briefly hoped it would allow me to upload sketches remotely (OTA) and securely, but that is not the purpose...

Have been playing with a fork of the JPEG decoder library here (https://github.com/fredericplante/JPEGDecoder) for the ESP8266, it runs quite fast and a neat feature is that it uses the SPIFFS library so JPEGs can be easily stored as file copies in the FLASH chip using the SPIFFS data upload tool. SPIFFS saves a lot of tedious mucking about with arrays or SD cards.

Also found the ESP8266 can be programmed to emulate a WeMo mains switch (https://tinkerman.cat/emulate-wemo-device-esp8266/) which can then be controlled with on/off voice commands via the Amazon Echo or an Android AP.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bperrybap on Dec 29, 2016, 11:52 pm
@bperrybap

Had a look at WifiManager, briefly hoped it would allow me to upload sketches remotely (OTA) and securely, but that is not the purpose...
WiFi manager is just to set up the ssid and password so you can do it with a browser vs having to re-compile the code.
But there is a s/w bundle for doing OTA updates as well. You have to include some extra code in your code just like with wifi manager but it is pretty cool.


If you google around you can find information on tutorials on Arduino OTA updates.


--- bill
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Dec 31, 2016, 08:35 pm
I have updated the TFT_ILI9341 graphics library for the NodeMCU (and ESP8266 variants).  A copy can be found on GitHub (https://github.com/Bodmer/TFT_ILI9341_ESP).

The 49 Adafruit_GFX Free Fonts have all been added plus two new examples.

The free fonts (as wells as the other resident fonts) can be drawn onto the screen with a background colour and can be drawn relative to a chosen datum, so it easy to right justify text or centre text about a point on the screen (the Adafruit_GFX library lacks these abilities).  The examples show how this works.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Jan 02, 2017, 11:12 pm
I just tried this out, It works perfectly.  Thanks for your hard work and for sharing it!
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 07, 2017, 11:03 pm
I have made some performance tweaks to the library, latest version is on GitHub (https://github.com/Bodmer/TFT_ILI9341_ESP).

With a stock 320x240 display the NodeMCU can now execute all the timed "graphicstest" functions in 0.91s (totalled) and a compatible UTFT_Demo finishes in 0.92s.

Considering these NodeMCU boards sell for only $3 (and have Wifi built in) they are exceptional value if a small powerful processor with wireless connectivity is needed. As they operate at 3.3V they can be wired straight to the display.  Typically the backlight LED benefits from the extra brightness if powered driven from 5V. (Note: some variants of the NodeMCU provide the USB 5V on the Vin pin which is handy).

I have a higher performance ESP32 on order so when the Adruino core libraries are in place for that chip I will see if I can adapt the code for that 240MHz processor though the performance is more dominated by the SPI frequency than the CPU frequency and 80MHz is the limit with the 2.2" ILI9341 display I have.

These are the times reported by the "graphicstest" for different CPU and SPI frequencies:

Code: [Select]
CPU 160MHz, SPI 80MHz
Benchmark                Time (microseconds)
Screen fill              81880
Text                     17484
Lines                    110823
Horiz/Vert Lines         8784
Rectangles (outline)     6683
Rectangles (filled)      168311
Circles (filled)         79768
Circles (outline)        65434
Triangles (outline)      25870
Triangles (filled)       100298
Rounded rects (outline)  30082
Rounded rects (filled)   212347
Done! Total = 0.907055 s


CPU 80MHz, SPI 80MHz
Benchmark                Time (microseconds)
Screen fill              82850
Text                     26730
Lines                    162672
Horiz/Vert Lines         10251
Rectangles (outline)     8617
Rectangles (filled)      170695
Circles (filled)         121724
Circles (outline)        97799
Triangles (outline)      37727
Triangles (filled)       137253
Rounded rects (outline)  43787
Rounded rects (filled)   236197
Done! Total = 1.135728 s


CPU 160MHz, SPI 40MHz
Benchmark                Time (microseconds)
Screen fill              157817
Text                     20258
Lines                    130615
Horiz/Vert Lines         15264
Rectangles (outline)     10667
Rectangles (filled)      323955
Circles (filled)         100700
Circles (outline)        74626
Triangles (outline)      30953
Triangles (filled)       151077
Rounded rects (outline)  36637
Rounded rects (filled)   384025
Done! Total = 1.435837 s


80MHz, 40MHz SPI
Benchmark                Time (microseconds)
Screen fill              161944
Text                     29219
Lines                    179507
Horiz/Vert Lines         16988
Rectangles (outline)     12709
Rectangles (filled)      332815
Circles (filled)         142200
Circles (outline)        106428
Triangles (outline)      42014
Triangles (filled)       189318
Rounded rects (outline)  50262
Rounded rects (filled)   414494
Done! Total = 1.677213 s


160MHz, 20MHz SPI
Benchmark                Time (microseconds)
Screen fill              312993
Text                     26787
Lines                    173766
Horiz/Vert Lines         28570
Rectangles (outline)     18852
Rectangles (filled)      642021
Circles (filled)         145685
Circles (outline)        98588
Triangles (outline)      41397
Triangles (filled)       255954
Rounded rects (outline)  52092
Rounded rects (filled)   735513
Done! Total = 2.531470 s

80MHz, 20MHz SPI
Benchmark                Time (microseconds)
Screen fill              315007
Text                     35582
Lines                    221512
Horiz/Vert Lines         30092
Rectangles (outline)     20778
Rectangles (filled)      646544
Circles (filled)         186471
Circles (outline)        129292
Triangles (outline)      52337
Triangles (filled)       292740
Rounded rects (outline)  65204
Rounded rects (filled)   761167
Done! Total = 2.756191 s
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Jan 10, 2017, 12:21 am
Is there some way to make the clock on your Clock_TFT_NTP sketch display local time? I un commented the line for it and in the serial window it displays the correct time but not on the display itself.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 10, 2017, 01:01 am
Hi Stan,

The attached should do what you want but it is a "work in progress" and therefore not fully finished/tested. It uses a worldwide DST correction library, see comments in sketch.

Things to be aware of:
1. It also uses a SI7021 sensor to display temperature and humidity, so comment out those bits
2. It uses a NTP pool lookup, so I get faster responses from a UK NTP server, your mileage may vary
3. It takes a couple of minutes to show the correct time due to an uncorrected bug :-)

You can set your time zone and display different time zones on the analogue and digital clock displayed. You will need to read the TimeZone library documentation to see how to edit the sketch to do what you want.

Link to the libraries needed are in the sketch header.

Have fun.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Jan 10, 2017, 11:37 pm
Hi,
Thank you! I have one of the gy21 sensors and loaded the sketch, it works perfectly. I am reading the documentation to figure out the time zone part.
All your hard work is greatly appreciated from a beginner like me.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 11, 2017, 12:57 am
Hi Stan,

The good news is that I have attached an improved NTP time sketch with comments that show you where/how to change the time zones for the analogue and/or digital clocks!

The bad news is that I have taken out the SI7021 (GY-21 board) code... so if you want that back in there you still have something else to do!

If you get stuck or find it has a coding bug then post back.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Jan 11, 2017, 11:18 pm
Hi,
The latest sketch works great, with your well written & commented coding it was easy to figure out how to change the time zone. The new feature with the day & date is better than the temp & humidity I think.

Thanks again for your contribution :-)

Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 11, 2017, 11:49 pm
Hi Stan,

Thanks for the feedback, I appreciate your appreciation!

I expect you have noticed there is an indicator shown on the top right corner, this shows the NTP reply status:

 Green: NTP message received in last minute
Amber: No NTP message for 1-15 minutes
Red:     No NTP message for more than 15 minutes

If it goes red then the time will drift from the real time due to the accuracy of the local clock.

"All your hard work is greatly appreciated from a beginner like me."

As a beginner you are the one that is doing the hard stuff by having to clicmb that steep learning curve to get new things working! I have a lot of code and hardware experience, so now it is like building software with Lego and is no longer hard work.  In fact I rather like it when things don't work, as I have something interesting to investigate and find a solution!
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Jan 12, 2017, 10:52 pm
I wondered what the green dot was, This is loaded with all the features you could want.
I have had it running without a problem for about 24 hours now and it is my favorite desktop toy.
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 13, 2017, 12:30 am
Hi Stan,

You will have to wait and see if the DST time is automatically applied on the correct day for your time zone :-)
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 14, 2017, 03:54 pm
This might please David  :) , I have added 8+16+32 bit reads to the library with indexing so arbitrary register bytes can be read rather than a simple sequence. This also helps when the are dummy, "don't care" undefined values in the register that can be skipped. Github has been updated.

These new functions only work with ILI9341 displays configured for SPI Interface II which reply with data on the SPI MISO line.  Some displays are configured for SPI Interface I and have a bi-directional SDA (aka MOSI) line.

There are two example sketches added that will indicate which interface you have on your display, one of these will give good values including the 9341 ID of the driver:

TFT_Read_Reg example uses the TFT_ILI9341_ESP member functions for Interface II displays

Read_ID_bitbash
is a stand-alone sketch that tries to read a Interface I display with a bidirectional data line

Just because you have 2 identical looking displays does not mean you have 2 of the same Interface type as the configuration is done at PCB level via hidden links (i.e. configuration pins IM [3:0] are "1110" for Interface II).
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: ZinggJM on Jan 14, 2017, 04:49 pm
Hi Rowboteer

Thank you very much for all your contributions.

Support for ESP8266 is highly welcome; this system is very usable for IoT kind of applications, and to be able to add a display to the network with just one inexpensive "Arduino" is interesting. I use quite many of these.

May I suggest a simple fix to your code?

The member variable

Code: [Select]
           SPIClass *_SPI;

at line 433 does not get initialized. Line 60 in .cpp is commented out:

Code: [Select]
  //_SPI = SPIdev;

and should be

Code: [Select]
  _SPI = &SPI;

Fortunately no method of SPIClass is virtual, so calls zero instance pointer work.
Why access to the only member variable useHwSpi does not cause exceptions is unclear to me.

I prefer references instead of pointers as member variables, then the compiler forces me to initialize them.

Jean-Marc
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 14, 2017, 06:47 pm
Sorted, take a Karma point.

Github has been updated.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 14, 2017, 11:27 pm
There is a really cool font converter here (http://oleddisplay.squix.ch/#/home) that generates fonts in the Adafruit "Free Font" format. This has got to be the neatest way of generating new fonts that I have seen.

It looks like there is about 100 fonts available and you can select the size you want and if it is italic or bold etc. It even shows you what the font looks like on a small emulated OLED screen.

The generated fonts can be added to the TFT_ILI9341_ESP  library Fonts/GFXFF folder and then called up in the "TFT_ILI9341_ESP.h"  header file with a like like:

Code: [Select]
#include <Fonts/GFXFF/Yellowtail_32.h>

In this case the new font file is called Yellowtail_32.h

The #include must be added to the TFT_ILI9341_ESP.h after this line:

Code: [Select]
#include <Fonts/GFXFF/gfxfont.h>

I will simplify this whole process allowing new fonts to be called up in the User_Setup.h file and include an example at some point, however if you have played with the Free Fonts before I am sure these brief instructions will help you get started.


Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Jan 15, 2017, 12:32 am
Have you considered doing a sketch with this display to get weather from the web?
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 15, 2017, 12:18 pm
Hi Stan,

Yes! That is a project I am working on, the NT clock is a stepping stone towards a weather clock goal. There are a few projects on the Web that have done this already using the Weather Underground as a source as there is a simple API to get the data. In principal it is not much different to fetching the time and decoding the reply packet.

Most  of the effort will be in the graphics, but there are fairly standard symbols for the different weather conditions so plenty of copyright free material on the Web.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Jan 24, 2017, 01:51 am
I came across this site  (https://blog.squix.org/2017/01/esp8266-planespotter-color.html)recently and have been impressed at what a ESP8266 based NodeMCU can be persuaded to do.

The sketch set uses a WiFi Locator to work out your location and download a jpeg map off the internet (e.g. Google maps).  It then checks what planes are in the area and plots their location on the map, with info displayed on the nearest plane.  How cool is that!

I have forked the project here (https://github.com/Bodmer/esp8266-plane-spotter-color) and adapted it to be compatible with the latest TFT_ILI9341_ESP library (https://github.com/Bodmer/TFT_ILI9341_ESP) and the latest JPEGDecoder library (https://github.com/Bodmer/JPEGDecoder).

So, if you have the TFT_ILI9341_ESP library running with a display it should be straightforward to download the entire project sketch folder and get it up and running.


Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Jan 26, 2017, 01:03 am
This looks like another great project, I have a couple displays coming and can't wait to get started with it.
Did you look at the weather station project there? I tried to get it working but get a ton of errors when it compiles and haven't been able to get it working.

The clock project has been running for about 10 days now and it is working perfectly.
Thanks for your efforts!
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 01, 2017, 11:42 pm
Hi,
I installed your new library and none of the sketches will compile including the NTP clock sketch that was working before. I get the following error:

Arduino: 1.8.0 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

In file included from C:\Users\stan\Documents\Arduino\TFT_Clock_NTP\TFT_Clock_NTP.ino:43:0:

C:\Users\stan\Documents\Arduino\libraries\TFT_ILI9341_ESP-master\src/TFT_ILI9341_ESP.h:28:30: fatal error: Fonts/glcdfont.c: No such file or directory

   #include <Fonts/glcdfont.c>

                              ^

compilation terminated.

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I have spent a couple hours trying to resolve it with no success, can you offer any help?
Regards,
Stan

Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 03, 2017, 01:45 am
@stan

Have been very busy with paid work for a few days hence the delay...

I have not had a chance to have a look at the Weather station code yet.

It looks like you may have multiple copies of the library perhaps. It seems to work for me.

Delete the -master off the end of the library name, look for another copy of the library and delete it if you find one.  Make sure you are using the latest copy off Github.

I have made a tweak to the library to move the main source files into a folder called "src" as this is the "approved" library structure these days.

If that does not fix the problem then let me know and I will see if I can reproduce the problem. I am now using 1.8.1 as IDE 1.8.0 had some bugs, but I dont think that is the problem in this case.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 05, 2017, 05:36 pm
Hi,
I have only one copy of the ESP library. I have tried deleting the existing copy and reinstalling a new copy, but it still has the same error. I also have updated to version 1.81 with the same result.

What I fins confusing is when I first downloaded the new library I extracted it in my download folder and was able to compile and load the graphics test with no problem.
But after I deleted the old library and installed the new one none of the examples would compile.
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 05, 2017, 06:17 pm
OK, I will download a clean copy of the IDE and library on a laptop and see if I can see what is happening.  It looks like something has got broken by the move to using the src folder.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 05, 2017, 07:31 pm
Hi Stan,

Yes, there was a problem with the latest copy.

The problem was two fold, first moving the files into the src folder meant one of the font files could not be found, second there were some new custom fonts missing.

Thanks for pointing this out.  If you download the latest copy of the library from Github (https://github.com/Bodmer/TFT_ILI9341_ESP) then it should all be working OK now.

Report back if you are still having problems.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bperrybap on Feb 05, 2017, 08:53 pm
There is no need to mess with using a src directory.
I don't and won't ever use it.
The 1.5x library spec wiki is currently wrong about how the include paths work when building the code.
As you can see, you can have a 1.5x library without having or using a src directory.
But if you really want to use it, you still can.
And for organization for other files, you could use src or any other sub directory with any name you want, but to reference anything in a subdirectory you have to properly reference it from the libraries root location.
I do this in my openGLCD library as I moved all the bitmaps, fonts, and other headers off to separate subdirectories.

That src directory came into creation very early on during the 1.5x library development.
The original 1.5x spec was VERY brutal it intentionally didn't support any pre 1.5x libraries and forced each architecture underneath a separate directory under a "arch" directory.
This essentially created the same STUPID "break the world" issue that was created between the 1.0 release candidate and the shipped version of 1.0 that broke 100% of all the existing 3rd party libraries.
Paul Stoffregen and I highly objected to this and there were many long conversations with the Arduino team and others on the developers list about 1.0 library backward compatibility and the architecture specific sub directories.
Luckily Cristian Maglie had been brought in and was doing most of the development for this.
I had many long email conversations with him offline about what happened during the 1.0 release and the impact of Arduino.cc decisions related to the 1.5x libraries.
Eventually, I realized that they simply had no idea what the 3rd party developers and end users were going through every time Arduino.cc made non backward compatible changes.
After I finally explained all this to Cristian, and the light bulb went off and he finally understood.
And Cristian overrode the older/original Arduino team members and that is how we ended up pre 1.5x library support. - Which was a very good thing as it meant that all the existing Arduino libraries could continue to work once 1.5x library support was turned on.

Another area the Paul and I tried to get them to understand was that the architecture specific directories under an "arch" directory was simply unworkable. They still wanted this and and their early versions of 1.5 libraries used it. After a while the Arduino team realized it was unworkable from a maintenance and 3rd party support perspective. It didn't even work for their own internal AVR vs ARM development.
And that is why you no longer see the arch directory for the architecture specific directories and it has been removed from the 1.5x library documentation in favor of using architecture specific conditionals.
And for separate architecture specific libraries, a core can ship its own version of a library which overrides a bundled version of the library.
Ironically, this methodology is basically what Paul and I were originally wanting but were initially unsuccessful in trying to convince them to move in this direction.

--- bill
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 05, 2017, 10:37 pm
@bperrybap

It is interesting to see the history of the src folder.

I recently asked for the JPEGDecoder library to be included in the Library Manager search and the first review comment was telling me to put the code into a src folder! So I did that and the next reviewer asked me to add more examples, but before I had time to do that a third reviewer just added the library to the search list...

It is great to hear that someone has been battling to avoid 3rd party developers from chasing an ever changing environment.  Some folk do not realize that change is not always necessary to make progress and that any changes must be very well thought out. Good work!

Back to the TFT_ILI9341_ESP library, I pulled the files out of the src folder and the file path error was fixed but there was another one of missing font files (my mistake) and that is fixed too, so all should be working now.  :)
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 07, 2017, 11:18 pm
It works!!! :-)

Thank you, I was going nuts trying to figure out the problem.

Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 08, 2017, 06:40 am
Hi Stan,

I have have put s fork of the Squix weather station code here (https://github.com/Bodmer/esp8266-weather-station-color). This is a big multi-file sketch.

You will also need this library (https://github.com/squix78/esp8266-weather-station) loaded as well as the Adafruit_GFX and Adafruit_ILI9341 libraries for the sketch to compile.  I will update to use the much faster TFT_ILI9341_ESP library at some point.

It should run on your desktop NTP clock hardware, the settings you need to change are in the "settings.h" file in the sketch (such as country, city, time zone ofset). At the moment it does not correct for DST/BST but I will change that at some point to use the code form the NTP clock sketch.

You will need to register for a free user account on the Weather Wunderground website. You will then get a weather data access key that is substituted for <WUNDERGROUND KEY HERE> in the "settings.h" file of the sketch.

There are a few display artifact bugs with the original code and I have made a quick fix to correct this for the time display but this needs further consideration.

The sketch is really cool, at first boot up it fetches all the weather bitmap icons from a website and saves them in FLASH! How cool is that!  It only need to do this once. I also like the moon phase graphic. I checked the local weather on another website and it is being reported correctly.

Post back if you have problems.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 10, 2017, 12:43 am
Hi,
I downloaded the sketch and am working on it , I ran into some problems with some of the ESP8266 chips I got, a couple of them aren't seen and 2 of them get seen but you can't upload code to them. I got 2 out of the batch that are working. Now I can move forward.
You have a link to some 2.2" displays from banggood. I got 2 2.8" ones from aliexpress for about the same price. they work well and look better than the smaller ones.
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 11, 2017, 11:03 pm
Hi Stan,

You have been unlucky with your NodeMCU purchase. Can you post a link to the vendors page so readers can see where you got them?

The ones with the CP2102 USB to serial chips are the best ones for upload reliability.  The ones fitted with CH340G chips are not totally reliable at high baud rates. If you have those then try uploading at the lowest baud rate and increase it step by step if that works, I find the upload aborts about 1 in 5 times at 921600 with the CH340G chips.

I have some 2.8" ILI9341 screens on order, they should be here soon.

I've been tweaking the Squix weather station display code, I am about to look at the Wunderground API and figure out how to add wind speed and direction to the display. When that is done and working I will upload a copy to Github.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 13, 2017, 11:52 pm
Hi Stan,

I will be uploading a new version of the squix weather station sketch soon, it uses the TFT_ILI9341_ESP library.

Do you have a setup (NodeMCU and ILI9341 connected and working) that can be used to test it for me  and provide feedback?

Here is a couple of screen dumps pulled out of the TFT:

(http://i.imgur.com/vwvLz1T.png)


(http://i.imgur.com/xS7fWyw.png)
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 15, 2017, 09:57 pm
Hi,
I kind of got sidetracked on the weather station project. I spent a lot of time dealing with the defective chips. I bought several of them from different vendors over a few months, so I am not sure who the bad ones came from. I will try a lower baud rate on the ones that are detected.

I like the ntp clock so much I decided to make a stand for it. I cut out some plexi on my cnc mill and will wire wrap the connections. I will post some better photos when it is done.

I will try your new code tonight and let you know the results.
Thanks & Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 15, 2017, 10:50 pm
I went on aliexpress and looked at a number of vendors with the node mcu's and it looks like most of them use the CH304G chip. However I did find one that sells chips with the CP102. I am going to order a couple today. I also found 2 of them on amazon, they were more expensive but they will be here in a couple of days.
I have a working setup to check your code when you post it.

Here is a link to the chips with the cp102 interface.:
https://www.aliexpress.com/store/product/Wireless-module-NodeMcu-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266-CP2102-with-pcb-Antenna/1630603_32716714257.html?spm=2114.12010615.0.0.Eo3Giv

Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 17, 2017, 08:12 pm
Hi Stan,

The Weather Station code has been updated on Github (https://github.com/Bodmer/esp8266-weather-station-color) and is ready for tests.

Some 2.8" ILI9341 displays turned up today and are working fine, It is nice to have a bigger display so it can be seen at a distance.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 17, 2017, 08:22 pm
New functions have been added to the TFT_ILI9341_ESP library to read the screen contents.

These are working and I have used then to dump screenshot images to a PC via the serial link.

Examples are missing at the moment for these new functions but I am working on them!

Here are the function prototypes:

Code: [Select]
          // Read the colour of a pixel at x,y and return value in 565 format
  uint16_t readPixel(int32_t x0, int32_t y0);

           // The next functions can be used as a pair to copy screen blocks (or horizontal/vertical lines) to another location
   // Read a block of pixels to a data buffer, buffer is 16 bit and the array size must be at least w * h
  void     readRect(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h, uint16_t *data);
   // Write a block of pixels to the screen
  void     pushRect(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h, uint16_t *data);

   // This next function has been used successfully to dump the TFT screen to a PC for documentation purposes
   // It reads a screen area and returns the RGB 8 bit colour values of each pixel
   // Set w and h to 1 to read 1 pixel's colour. The data buffer must be at least w * h * 3 bytes
  void     readRectRGB(int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_t *data);
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 18, 2017, 04:43 am
I downloaded the new library and get the following error.

C:\Users\stan\Documents\Arduino\libraries\SD/utility/Sd2PinMap.h:371:2: error: #error Architecture or board not supported.

 #error Architecture or board not supported.

  ^

The 2.8" displays add a whole new look toy these projects. I just finished wiring ub the clock on the plexi  base and it looks great.
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 18, 2017, 02:59 pm
I downloaded the new library and get the following error...
OK, that is an SD library generated error.

What sketch are you trying to run?
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 18, 2017, 03:38 pm
Stan,

Update to above post. I think you just need the latest version of the JPEGDecoder library as that does call up the SD library in certain circumstances.  This is now available using the IDE Library manager. The latest version is 1.7.4

Also check you have the right board selected in the IDE.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 18, 2017, 03:50 pm
Hi,
I updated the  JPEG library but no change.
I don't understand what the SPiff sketch is for. When I compile it I get the following errors:
Arduino: 1.8.1 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

Build options changed, rebuilding all
C:\Users\stan\Documents\Arduino\esp8266-weather-station-color-master\SPIFFS_Support\SPIFFS_Support.ino: In function 'void listFiles()':

SPIFFS_Support:15: error: 'fs' has not been declared

   fs::Dir dir = SPIFFS.openDir("/"); // Root directory

   ^

SPIFFS_Support:15: error: expected ';' before 'dir'

   fs::Dir dir = SPIFFS.openDir("/"); // Root directory

           ^

SPIFFS_Support:23: error: 'dir' was not declared in this scope

   while (dir.next()) {

          ^

SPIFFS_Support:28: error: 'fs' has not been declared

     fs::File f = dir.openFile("r");

     ^

SPIFFS_Support:28: error: expected ';' before 'f'

     fs::File f = dir.openFile("r");

              ^

SPIFFS_Support:29: error: 'f' was not declared in this scope

     Serial.print(f.size()); Serial.println(" bytes");

                  ^

exit status 1
'fs' has not been declared

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 18, 2017, 09:56 pm
Hi Stan, I will download a clean copy onto a laptop off Github and report back as I can't seem to get the same errors. I'll be back...
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 19, 2017, 03:40 pm
Hi Stan,

OK I started with a  new clean laptop running Windows 10, downloaded IDE 1.8.1, installed the latest ESP8266 core, pulled in the weather station sketch and all needed libraries all at the latest versions and the weather station sketch all compiles and works fine.

All I can suggest is to make sure you have all the latest libraries and the latest weather station sketch from github loaded and compile it before making any changes just to make sure it is good.

You might need to manually remove the JPEGDecoder library, close the IDE, open the IDE and then install using the library manager directly as it seems the IDE library manager does not update a library correctly sometimes.

Your display stand looks great by the way  :)
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 20, 2017, 02:45 am
Hi,
I finally got it to load. I installed a fresh copy of the IDE & library's on my laptop and got it to compile and load. It is an awesome project!!

I still  have a couple things to do.  I don't see where to enter my network id & pass word and I don't think
the settings I entered for weather underground are correct.

I think I need to redo my IDE on my destopas it is loaded  with a lot of excess stuff.

I got ht clock wired up on the plexi stand  and will post a photo of it working tomorrow

Thanks for all your help
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 20, 2017, 01:59 pm
I finally got it to load...

I don't see where to enter my network id & pass word and I don't think
the settings I entered for weather underground are correct.

Great!

The sketch uses the WiFi Manager, so it tries to use the network ID etc from a stored value in FLASH/EEPROM, but this only works if that NodeMCU has run a sketch previously  that connected it to the WiFi.  If the Weather Station sketch cannot find a WiFi SSID and password then it sets up an Access Point with a web page that can be connected to. Instructions should appear on the screen.
Another way is run a simple Web Server sketch or the NTP clock sketch that does need the SSID and password in the sketch, then after that has run load the Weather Station sketch again and it will find the info it needs from FLASH/EEPROM.

The only bits you need to complete are in the last tab called "settings.h":
Code: [Select]
const String WUNDERGRROUND_API_KEY = "<WUNDERGROUND KEY HERE>";
//const String WUNDERGRROUND_API_KEY = "1c265fajf48s0a82"; // Example only of what the above line should look like
const String WUNDERGRROUND_LANGUAGE = "EN"; // Language EN = English
const String WUNDERGROUND_COUNTRY = "Peru"; // UK etc
const String WUNDERGROUND_CITY = "Lima"; // City, London etc


Post back if you are still having problems.

For a bit of frivolous fun you might like to try the sketch here (https://github.com/Bodmer/ESP8266_uncannyEyes)   :) , which is a port to the NodeMCU of the Teensy code here (https://learn.adafruit.com/animated-electronic-eyes-using-teensy-3-1/overview). The single moving "eye" graphic runs at about 30fps, not sure how that compares with a Teensy but it is quite usable for a fun application and technically very well thought out.

Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 20, 2017, 11:40 pm
Hi,
I got it working, I just need to figure out the proper settings for my city. I set it for UK and london and it works fine. it looks great!! You are a genius.

I loaded the eye sketch and it looks interesting as well.

I need to do a clean install of the IDE on my desktop that is my next project. Then I would like to work on the plane spotter.

I have a couple more of the 2.8" displays coming as well as a couple more of the esp chips with the better usb driver. The power & technology in these things for under $4.00 is amazing.

I attached a photo of the finished clock.

Thanks for all your patience and help. It is greatly apriciated.
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 21, 2017, 02:55 am
Great to hear it is working.

All the hard coding work was done by Daniel Eichhorn, see here (https://blog.squix.org/2016/10/esp8266-weather-station-color-code-published.html). I just tweaked it, tidied up the formatting, added the wind speed and weeded out some bugs.

The Wunderground City list is here (https://www.wunderground.com/about/faq/international_cities.asp) , most big cities are probable there for the UK.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: Stan_S on Feb 21, 2017, 11:37 pm
Hi,
My problem ids getting it to find my city. I think for the US you need a state as well. I tried adding a state identifier in the settings.h file but have not been successful so far. I will keep plugging away at it.

I tried Daniels projects but was not able to get them to compile. Your code works.

I need to clean out my IDE and start fresh on my desktop, I think there is to much junk in it and it is giving me problems.

Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI ILI9341 based TFT displays
Post by: bodmer on Feb 22, 2017, 11:45 pm
The TFT_ILI9341_ESP library has morphed into a new library called TFT_eSPI on Github (https://github.com/Bodmer/TFT_eSPI). This new version carries over all the features of the TFT_ILI9341_ESP library and is compatible with the Espressif ESP8266 and SPI based TFT displays. At the moment the supported display drivers are ILI9341 and ST7735. New display drivers will be added periodically.


This new library absorbs all the functions present in the TFT_ILI9341_ESP library, thus the TFT_ILI9341_ESP library will no longer be developed further. Potential users will be pointed towards the new TFT_eSPI library.

The old TFT_ILI9341_ESP library will remain on Github to support legacy projects.

The new TFT_eSPI library is extensible to support other display drivers, this is something I have been meaning to do for some time. It also supports multiple "User_Setup" files for different hardware setups (different pins used, different display driver etc). Selection of which setup to use is via a simple "User_Setup_Selection.h" file.  This allows the same example/user sketches to be used for different hardware configurations, with no need to edit the sketch (providing the display resolution is compatible).

If any bugs are found then the best place to report them is via the Github "Issues" form, but I will respond to messages on this thread too.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: ZinggJM on Feb 23, 2017, 08:10 am
Hi Bodmer,

Thank you for this new version and all your work that I and we all use, like and depend on.

My display classes are derived from TFT_HX8357, TFT_HX8357_Due and TFT_ILI9341_ESP.

My current work is still based on these, but uses a new design to separate the display class from the IO class. This makes it slightly less performing, but makes enhancements easier.

May I propose you take a look at this idea?

Code: [Select]
#include "Arduino.h"

class GxIO
{
  public:
    GxIO(){};
    virtual void reset();
    virtual void init();
    virtual void writeCommandTransaction(uint8_t c);
    virtual void writeDataTransaction(uint8_t d);
    virtual void writeData16Transaction(uint16_t d);
    virtual void writeData16Transaction(uint16_t d, uint32_t num);
    virtual void writeCommand(uint8_t c);
    virtual void writeData(uint8_t d);
    virtual void writeData16(uint16_t d);
    virtual void writeData16(uint16_t d, uint32_t num);
    virtual void writeData2x8(uint16_t d);
    virtual void startTransaction();
    virtual void endTransaction();
    virtual void setBackLight(bool lit);
  protected:
    int8_t _cs, _rs, _rst, _wr, _rd, _bl; // Control lines
};

#if defined(ARDUINO_ARCH_SAM)

class GxIO_TikyOnDue : public GxIO
{
  public:
    GxIO_TikyOnDue();
    void reset();
    void init();
    void writeCommandTransaction(uint8_t c);
    void writeDataTransaction(uint8_t d);
    void writeData16Transaction(uint16_t d);
    void writeData16Transaction(uint16_t d, uint32_t num);
    void writeCommand(uint8_t c);
    void writeData(uint8_t d);
    void writeData16(uint16_t d);
    void writeData16(uint16_t d, uint32_t num);
    void writeData2x8(uint16_t d);
    void startTransaction();
    void endTransaction();
    void setBackLight(bool lit);
  private:
    void strobe();
    void strobes(uint32_t num);
};

class GxIO_HVGAOnDue : public GxIO
{
  public:
    GxIO_HVGAOnDue();
    void reset();
    void init();
    void writeCommandTransaction(uint8_t c);
    void writeDataTransaction(uint8_t d);
    void writeData16Transaction(uint16_t d);
    void writeData16Transaction(uint16_t d, uint32_t num);
    void writeCommand(uint8_t c);
    void writeData(uint8_t d);
    void writeData16(uint16_t d);
    void writeData16(uint16_t d, uint32_t num);
    void writeData2x8(uint16_t d);
    void startTransaction();
    void endTransaction();
    void setBackLight(bool lit);
  private:
    void strobe();
    void strobes(uint32_t num);
};

#endif


You will notice it is influenced by both TFT_HX8357 and SPI.

kind regards

Jean-Marc Zingg
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Feb 23, 2017, 11:25 pm
Hi Jean-Marc,

Thanks for you input. There is certainly scope for improving the way extensions could be added to the library

The original set of libraries were targeted at specific displays and processors to try and squeeze the best performance out of each component combination. The ESP8266 has changed the game somewhat as it has a much higher performance compared to an UNO so optimisation is less critical (but still nice to have).

Ideally it would be nice to have different displays classes and processor IO classes all sat on top of the graphics class but at the moment that is a step too far for my coding skills. I like the breakdown you have listed and it will reduce the number of undesirable #ifdef's in the code.

The new library was pulled together in one evening to start moving in the direction you suggest and help get one of my projects going.  The library will probably evolve in the direction you suggest but this will occur at a future time and will be transparent at the user sketch level interface to the library.

Thanks, you have given me "food for thought" and that is helpful, I will think on this further...
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: Stan_S on Feb 24, 2017, 12:28 am
Hi,
I still can't get the weather sketch to get data for my city. I think that the problem is that for the US you need to identify the state as well as the city.
I have tried adding this line to the setup.h file:

const String WUNDERGROUND_COUNTRY = "US";
const String WUNDERGROUND_STATE = "Fl";
const String WUNDERGROUND_CITY = "Boca Raton";

And added state to these lines in the sketch #259, 263, 267
 wunderground.updateConditions(WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY , WUNDERGROUND_STATE, WUNDERGROUND_CITY);

When I try to compile it it creates errors in the Wundergroundclient.h file that I can't seem to fix.

Do you have any suggestions on what to do?

The sKetch works fine calling up cities in the UK.

Also it seems the problems I was having before were from this sketch conflicting with the SD card library's

Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: ZinggJM on Feb 24, 2017, 06:12 am
Thanks, you have given me "food for thought" and that is helpful, I will think on this further...
Thank you for looking at my design idea.

I am still on a steep learning curve for displays usable with Arduinos.

May I present some more thoughts about my design idea:

Displays usable with Arduinos have four mayor aspects or properties:
- display dimensions in pixels,
- color depth (or color/bw),
- controller used,
- io connection or method.

For color TFTs my design handles the 3 "dimensions" the following way:
- display dimensions are parameters of the display class constructor,
- controller is an enum, and passed as parameter to the init method,
- io is handled by subclassing a general io base class, and passing a reference to the chosen instance as parameter to the display class constructor.

With this io sublassing approach, a wide range of io connections and methods can be handled.
The SPI connection is one of them, maybe the most general, so it could be handled in the base class.

As my display class is "work in progress", this is the third approach, I refrain from posting a preliminary version.

Jean-Marc
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Feb 24, 2017, 07:03 pm
Hi Jean-Marc,

OK, all good stuff. Attached is a view on what the library pipeline structure could look like when/if completed.

As summer approaches the weather improves and much less time is spent tinkering with software so perhaps this is next winters project  :)
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Feb 24, 2017, 07:49 pm
Hi Stan,

As far as I can tell the sketch should accept the following:

Code: [Select]
const String WUNDERGROUND_COUNTRY = "FL US";
const String WUNDERGROUND_CITY = "Boca Raton";


However it seems the sketch does not handle or send spaces correctly if they are either in the country command string or in the city name.  I guess I have been lucky that these rules do not apply and similarly for the original author of the sketch who lives near Zurich.

I will investigate further and see if I can fix this bug. I note that Adafruit produced a variant of the weather station sketch so I will look to see if they fixed it (as Adafruit are based in the USA too).
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Feb 24, 2017, 08:04 pm
Ah hah!  This is the format needed:

Code: [Select]
const String WUNDERGRROUND_LANGUAGE = "EN";
const String WUNDERGROUND_COUNTRY = "US";
const String WUNDERGROUND_CITY = "FL/Boca_Raton";
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: Stan_S on Feb 25, 2017, 07:41 am
Hi,
I found that at Adafruit yesterday and tried it but it doesn't work. I have spent several hours trying to get this working but success still eludes me.

Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Feb 25, 2017, 12:29 pm
Hi Stan,

I tested the exact setup in post #70 and it worked fine so I am at a loss as to what to suggest other than the following:

The forward sloping slash / is important (don't use back slash \ ) and spaces in the city name must be replaced with the underscore _ character, (not a - sign).

Does it still work for the UK?
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Feb 25, 2017, 10:57 pm
In the Github respository (https://github.com/Bodmer/TFT_eSPI) all the library examples have been tested and updated to remove legacy text etc.

A new "weather station" example has been added, see this post (https://forum.arduino.cc/index.php?topic=443787.msg3130925#msg3130925), this requires 3Mbytes of FLASH set aside for SPIFFS as the sketch will use a WiFi connection to download the required images (weather icons, Moon phase images etc) from the internet and a total of more than 1 Mbyte of image files will be saved. That sketch also needs some other libraries including the JPEGDecoder.

The "uncannyEyes" example runs on a display of either type (ILI9341 or ST7735), the others are tailored for a particular display resolution (160 x 128 for ST7735 and 320 x 240 for ILI9341).
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Feb 26, 2017, 04:04 pm
Two more drivers have been added, the library now supports the ILI9341, ILI9163, ST7735 and S6D02A1 based TFT displays with an SPI interface.

Supporting higher resolution Raspberry Pi targeted serial interface displays is planned, but adding those is not so easy and will take some time.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: Stan_S on Feb 26, 2017, 11:02 pm
Hi,
I finally got this to work. My mistake was so stupid it is painful. When I put in my API key, I didn't delete the < & > in the quotes. After removing them it worked. I found the information on Adafruits web page a couple of days ago and tried it, but it didn't work. I went back today and compared their input to mine & realized the mistake with the API Key.
Thank you for all your help with this , I can't thank you enough.
Best Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Feb 28, 2017, 11:39 pm
The TFT_eSPI library (https://github.com/Bodmer/TFT_eSPI) has been updated to add a screen shot viewer client called "Screenshot_client (https://github.com/Bodmer/TFT_eSPI/tree/master/Tools/Screenshot_client)" in the Tools folder.  This is a Processing sketch and it runs under Processing 3.3 (https://processing.org/download/).

Processing is an image processing tool that has an Ardiono-like IDE. The Processing sketch can be changed to suit your own preferences.

There is also a new companion sketch called "TFT_Screen_Capture (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/ILI9341/TFT_Screen_Capture)" compatible with the ILI9341 display that acts as a screenshot server and can be uploaded to an ESP8266 with connected display.  This example draws colourful graphics on the screen and then sends a screen screenshot image pulled off the TFT to the Processing client.  It takes about 3.5s to send a 240 x 320 RGB image to the PC at 921600 baud (theoretical minimum is ~2.5s).

Each screenshot is saved automatically as sequentially numbered "png" images. Other image formats are supported (e.g. jpg,tif, bmp) by commenting/uncommenting lines (https://github.com/Bodmer/TFT_eSPI/blob/master/Tools/Screenshot_client/Screenshot_client.pde#L34-L38) in the processing sketch.

At the moment the Processing screen capture client uses the serial port, another version that runs over a Wifi network connection is also in development, this promises much faster screen grabs.

Have fun, report any bugs/suggestions here.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Feb 28, 2017, 11:52 pm
A couple of links to test images grabbed off the ILI9341 TFT screen, 5 pixel back border added by Processing client, png format:

(http://i.imgur.com/9bs0cZ2.png)

(http://i.imgur.com/aSuCa9Q.png)

Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: Stan_S on Mar 04, 2017, 04:34 pm
Hi,
you have been really hard at work with this, the processing looks interesting. I am watching the videos.

I found this video on youtube, it gets weather from a noaa site:
https://www.youtube.com/watch?v=gCJHwWqE9c0

Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 05, 2017, 12:15 am
Thanks for the link Stan, it is another interesting project!
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: Stan_S on Mar 08, 2017, 07:07 pm
Did you ever try the plane spotter sketch?
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 09, 2017, 02:21 am
Hi Stan,

Yes, I put a hacked version here (https://github.com/Bodmer/esp8266-plane-spotter-color) that has some improvements.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bperrybap on Mar 09, 2017, 02:33 am
bodmer,
Could you turn on issue tracking for the color weatherstation project?
https://github.com/Bodmer/esp8266-weather-station-color (https://github.com/Bodmer/esp8266-weather-station-color)
While I could clone it do a fix and then a pull request for an issue, I think it would be useful to enable issue reporting so that users could report issues.
The issue I have (and probably many others) is that  esp8266-weather-station-color.ino does not compile "as is".
The file "ArialRoundedMTBold_14.h" does not exist. The file in the repository is named "ArialRoundedMtBold_14.h"
so non neutered operating systems will not find the header file.
The .ino could be changed to include the actual name of the file but more than likely the real solution is to simply re-name the header file in the repository to what I assume was the intended name that has the upper-case T.

--- bill
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 09, 2017, 08:33 pm
Hi Bill,

Issue reporting has been switched on, the project is still a WIP so some bugs are expected and the ReadMe is not very complete.

I have commented out the #include Arduino.h as that does not seem to be needed and corrected the header file name for the font, it seems that the Windows based Arduino IDE that I use (and the one used by original author - Daniel Eichhorn) is tolerant of file name letter case errors.

Thanks for your feedback.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bperrybap on Mar 09, 2017, 08:57 pm
Hi Bill,

Issue reporting has been switched on, the project is still a WIP so some bugs are expected and the ReadMe is not very complete.
Great. One area that would be nice to get updated in the ReadMe is the Software Requirements/Libraries.
There are a few more than what is listed.


Quote
it seems that the Windows based Arduino IDE that I use (and the one used by original author - Daniel Eichhorn) is tolerant of file name letter case errors.
It isn't the IDE, it is Windows. While NT is fully capable of handling the filename characters properly, Microsoft chose to keep the case insensitivity as a default in filenames that they inherited all the way back from MS DOS which came from CPM.
But even on Windows, there can be issues as some tools, even the Arduino IDE, will sometimes do actual filename matching/comparing without explicitly forcing all the characters in the filename to a particular case before doing the compare.
So getting the actual names correct is a good thing even on Windows.

For me it was an issue, as I rarely ever use Windows, and even when I do run it, I never let it boot or run on real hardware. I only allow Windows to run inside VMs.

--- bill

Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 10, 2017, 05:25 pm
One area that would be nice to get updated in the ReadMe is the Software Requirements/Libraries.
There are a few more than what is listed.
Yes. I'm busy at the moment but will update the ReadMe soon and probably add links to all the libraries required in the main sketch header.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 11, 2017, 01:38 am
The TFT_eSPI library (https://github.com/Bodmer/TFT_eSPI) has been updated on Github.

The main change is that the screenshot client sketch (https://github.com/Bodmer/TFT_eSPI/tree/master/Tools/Screenshot_client) that runs under Processing on a PC and the server sketch (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/ILI9341/TFT_Screen_Capture) that runs on the ESP8266 have been upgraded to support 16 bit or 24 bit colour transfers automatically. The screen dimensions are provided to the client sketch so landscape and portrait orientations are also handled automatically now.

The screenshot capture performance has also improved so that pixels are transferred to the PC at a speed very close to the theoretical serial port limit (e.g. 1.67s for a 320x240 pixel 16 bit colour exchange at 921600 baud, and 2.5s for 24 bit pixels)
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 11, 2017, 12:47 pm
Bill,

The weather station project ReadMe (https://github.com/Bodmer/esp8266-weather-station-color) has been updated to add some more instructions and list the libraries needed.

I have had the sketch lock-up when trying to update the weather but I have not investigated why this happens, I suspect a time-out is needed if the Weather Underground website fails to provide an update on request, but this is just a guess at the moment.

Post an issue on Github if you find and/or track down any issues.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 11, 2017, 01:17 pm
Forgot to mention that the TFT_eSPI library (https://github.com/Bodmer/TFT_eSPI) allows custom fonts to be added more easily. The font files are placed in a custom font folder (https://github.com/Bodmer/TFT_eSPI/tree/master/Fonts/Custom), then added to a User_Custom_Fonts (https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/User_Custom_Fonts.h) file. The new fonts can then be used in a sketch.

Custom fonts in the required "Adafruit" compatible format can be created using the utility here. (https://blog.squix.org/2016/10/font-creator-now-creates-adafruit-gfx-fonts.html).

Edit: I have now added a new example for the custom fonts (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/ILI9341/TFT_Custom_Fonts).
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: Stan_S on Mar 12, 2017, 02:53 pm
Hi Stan,

You will have to wait and see if the DST time is automatically applied on the correct day for your time zone :-)
Hi,
The DST worked, it set itself and the display reads EDT. The sketch has beenrunning for several weeks with no issues.

I have the plane spotter running, it is an awesome project. I live in an active flight area and it shows a lot of activity. It would be nice if it could run on a larger display like a 3.6 or 3.9 display.

The weather station sketch has also been working with no issues for a couple of weeks now.

Thanks for all your great work!!

Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 12, 2017, 03:57 pm
Hi Stan,

All the really hard work was done by Daniel Eichhorn (https://blog.squix.org/about-me).  He has some great projects getting the ESP8266 talking to the web and has produced an online book. He designed the splash screen:

(http://i.imgur.com/tAfLJSf.png)

He is also knows how to use web API's to for example download images and maps, which I failed to get working in the past:

(http://i.imgur.com/Kh3NMid.png)

The weather station code is a great example where the weather icons are fetched from a server.

P.S. You may notice some duff pixels in the images above which were grabbed off the screen. The problem was that reading pixels at 40MHz SPI rate does not work totally reliably.  To be fair though that clock rate is well above the ILI9341 specified limits and thus is "over-clocking" it significantly. So use 27MHz SPI rate if the pixel read functions are going to be used!
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: ZinggJM on Mar 12, 2017, 03:59 pm
It would be nice if it could run on a larger display like a 3.6 or 3.9 display.
Hi Stan,

3.95" SPI displays are mostly targeted at Raspberry Pi. Some can be easily used with ESP8266, if the connector is not an issue. And the 3.3V interface is ok with ESP8266 (UNO needs level converter).

The one from Waveshare should be usable, I use a Waveshare clone.

And then there is the Waveshare 7" display with RA8875 controller, that I just happen to successfully use with Adafruit_RA8875 over SPI with Wemos D1 and Wemos D1 mini, with a small change in the library to use 4Mhz SPI, at least for initial connection.

Jean-Marc
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 12, 2017, 04:07 pm
The TFT_eSPI library has undergone a few tweaks and bug fixes.

It is also now possible to use the MISO line for the Data/Command (DC) or Chip Select (CS) for projects that are pin constrained and where reading from the display is not needed. This means that for some displays it is possible to get down to using just three I/O pins for SCK, MOSI and DC, with CS tied low to GND and RESET connected to the NodeMCU RST pin.

The background is now correctly sized for rendering the Adafruit "Free Fonts" when using the drawString() member function, here extra width padding has been applied to the plotted numbers with the library setTextPadding() member function, this means old numbers get over-written automatically:


(http://i.imgur.com/X90zUFF.png)

Using the print() method does not use background for technical reasons:

(http://i.imgur.com/iHWWVLw.png)

All fonts can be rendered relative to a selected datum, which helps when designing a screen layout:

(http://i.imgur.com/cmRdvk8.png)

Online instructions for using the library and features is "in development" and should be available soon!

Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 12, 2017, 04:12 pm
Hi Jean-Marc,

Support will be provided in the TFT_eSPI library in due course for the serial RPi displays based on this type of interface schematic:

(https://cloud.githubusercontent.com/assets/3693437/4249610/2d25eed4-3a79-11e4-8418-b8439db1cc4f.png)

This will allow larger resolution displays to be used.  I have a ILI9481 based 480 x 320 touch screen display from China that appears to be well made and is being used for development.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: ZinggJM on Mar 12, 2017, 04:33 pm
Hi Bodmer,

These are very welcome news!

Seems we are on a similar track, but I am still a beginner in this field.

My design has evolved a bit:

Code: [Select]
#ifndef _GxIO_H_
#define _GxIO_H_

#include <Arduino.h>
#include <SPI.h>

class GxIO
{
  public:
    GxIO() {};
    const char* name = "GxIO";
    virtual void reset();
    virtual void init();
    virtual uint8_t transferTransaction(uint8_t d);
    virtual uint16_t transfer16Transaction(uint16_t d);
    virtual uint8_t readDataTransaction()
    {
      return 0;
    };
    virtual uint16_t readData16Transaction()
    {
      return 0;
    };
    virtual void writeCommandTransaction(uint8_t c);
    virtual void writeDataTransaction(uint8_t d);
    virtual void writeData16Transaction(uint16_t d, uint32_t num = 1);
    virtual void writeCommand(uint8_t c);
    virtual void writeData(uint8_t d);
    virtual void writeData(uint8_t* d, uint32_t num);
    virtual void writeData16(uint16_t d, uint32_t num = 1);
    virtual void writeAddrMSBfirst(uint16_t d);
    virtual void startTransaction();
    virtual void endTransaction();
    virtual void setBackLight(bool lit);
};

#if defined(__AVR) || defined(ESP8266)

class GxIO_SPI : public GxIO
{
  public:
    GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
    const char* name = "GxIO_SPI";
    void reset();
    void init();
    uint8_t transferTransaction(uint8_t d);
    uint16_t transfer16Transaction(uint16_t d);
    uint8_t readDataTransaction();
    uint16_t readData16Transaction();
    void writeCommandTransaction(uint8_t c);
    void writeDataTransaction(uint8_t d);
    void writeData16Transaction(uint16_t d, uint32_t num = 1);
    void writeCommand(uint8_t c);
    void writeData(uint8_t d);
    void writeData(uint8_t* d, uint32_t num);
    void writeData16(uint16_t d, uint32_t num = 1);
    void writeAddrMSBfirst(uint16_t d);
    void startTransaction();
    void endTransaction();
    void setBackLight(bool lit);
  protected:
    SPIClass& _SPI;
    int8_t _cs, _dc, _rst, _bl; // Control lines
};

class GxIO_SPI3W : public GxIO
{
  public:
    GxIO_SPI3W(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1,
               // defaults are for RA8875
               uint8_t cmd_read = 0xC0, uint8_t data_read = 0x40, uint8_t cmd_write = 0x80, uint8_t data_write = 0x00);
    const char* name = "GxIO_SPI3W";
    void reset();
    void init();
    uint8_t transferTransaction(uint8_t d);
    uint16_t transfer16Transaction(uint16_t d);
    uint8_t readDataTransaction();
    uint16_t readData16Transaction();
    void writeCommandTransaction(uint8_t c);
    void writeDataTransaction(uint8_t d);
    void writeData16Transaction(uint16_t d, uint32_t num = 1);
    void writeCommand(uint8_t c);
    void writeData(uint8_t d);
    void writeData(uint8_t* d, uint32_t num);
    void writeData16(uint16_t d, uint32_t num = 1);
    void writeAddrMSBfirst(uint16_t d);
    void startTransaction();
    void endTransaction();
    void setBackLight(bool lit);
  protected:
    SPIClass& _SPI;
    uint8_t _cmd_read, _data_read, _cmd_write, _data_write;
    int8_t _cs, _dc, _rst, _bl; // Control lines
};


and

Code: [Select]
// GxCTRL.h

#ifndef _GxCTRL_H_
#define _GxCTRL_H_
#include "GxIO.h"

class GxCTRL
{
  public:
    GxCTRL(GxIO& io) : IO(io) {};
    const char* name = "GxCTRL";
    virtual void init();
    virtual void setWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
    virtual void setRotation(uint8_t r);
    virtual void invertDisplay(boolean i) {IO.writeCommandTransaction(i ? 0x21 : 0x20);};
  protected:
    GxIO& IO;
};



But for RA8875 the separation of display class and controller class not really makes sense.

Jean-Marc
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: ZinggJM on Mar 12, 2017, 04:56 pm
Btw, your schematics corresponds to the display I know as Waveshare clone/knock off, marked "3.5 inch RPI LCD V3.0 HVGA 480X320". I use it with my "second version" of IO class and display class. It is on the way to be used with my third version.

Jean-Marc
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 12, 2017, 05:33 pm
Hi Jean-Marc,

My RPi display is off eBay (http://www.ebay.co.uk/itm/3-5-TFT-LCD-Touch-Screen-Module-320-x-480-SPI-RGB-Display-For-Raspberry-Pi-B-B-/141932024322), typical cost is about $15. There seems to be write a few different TFT interface designs out there for the RPi, but the one in post #93 is really convenient for the ESP8266 to drive.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: ZinggJM on Mar 12, 2017, 06:07 pm
Hi Bodmer,

It's the same that I have. I bought 2 from 2 different shops:

https://www.aliexpress.com/item/New-26-pin-3-5-inch-Raspberry-Pi-LCD-TFT-Touchscreen-Display-kit-RPI-Touch-Shield/32526486667.html (https://www.aliexpress.com/item/New-26-pin-3-5-inch-Raspberry-Pi-LCD-TFT-Touchscreen-Display-kit-RPI-Touch-Shield/32526486667.html)

https://www.aliexpress.com/item/3-5-TFT-LCD-Touch-Screen-Module-320-x-480-SPI-RGB-Display-For-Raspberry-Pi/32661117216.html (https://www.aliexpress.com/item/3-5-TFT-LCD-Touch-Screen-Module-320-x-480-SPI-RGB-Display-For-Raspberry-Pi/32661117216.html)

and there are more sellers for these on AliExpress.

Avoid the 3.5" tfts marked KeDei, it uses 3 wire SPI, and no schematics can be found.

My attempts to use it with Arduino failed; I have some idea from observing on Raspi with logic analyzer, and may give it another try with my new IO class. Controller is unknown, polarity is reversed, etc.

Jean-Marc
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 25, 2017, 12:37 am
The library has been updated to support Raspberry Pi 480 x 320 displays based on the ILI9486 TFT driver and with a 16 bit interface.

This is an example of the compatible display (http://www.ebay.co.uk/itm/3-5-TFT-LCD-Touch-Screen-Module-320-x-480-SPI-RGB-Display-For-Raspberry-Pi-B-B-/141932024322).

The display must be of the same interface design comprising 74HC04, 74HC4040 and 2 off 74HC4094 devices. These are commonly 3.5" TFTs compatible with the Waveshare design.

See also Jean-Marc's web links and post #93.

Since 16 bits has to be sent for every transaction there is a small overhead and thus the display draw performance is constrained.

The performance is reasonable, the TFT interface built onto the back of the TFT will only support a 20MHz rate unless modifications are made. This is a limit of the display interface design.

The UTFT Demo runs in 3s

Typical 480 x 320 results at 20MHz SPI for the GFX graphicstest sketch are:

Code: [Select]

TFT_eSPI library test!
Benchmark                Time (microseconds)
Screen fill              625771
Text                     37269
Lines                    502658
Horiz/Vert Lines         58450
Rectangles (outline)     32978
Rectangles (filled)      1511987
Circles (filled)         359877
Circles (outline)        290419
Triangles (outline)      104101
Triangles (filled)       599591
Rounded rects (outline)  132635
Rounded rects (filled)   1726473
Done!


For a 320 x 240 display the equivalent results would be:

Code: [Select]

TFT_eSPI library test!
Benchmark                Time (microseconds)
Screen fill              312986
Text                     24360
Lines                    150932
Horiz/Vert Lines         28403
Rectangles (outline)     18591
Rectangles (filled)      641954
Circles (filled)         137072
Circles (outline)        88468
Triangles (outline)      36436
Triangles (filled)       251335
Rounded rects (outline)  47381
Rounded rects (filled)   734838
Done!



Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 27, 2017, 03:28 am
The library has been updated to add support for a Raspberry Pi ILI9486 480x320 display with a modification made to the circuit that adds a directly controlled write strobe:

(http://i.imgur.com/wPT0iQO.png)

This allows fast writing of blocks of repeated colour pixels.  The complete 480x320 screen can then be cleared in 23ms and the Run Length Encoded fonts render very fast too (1.2ms for a 72 pixel high digit).  Other graphics functions that write sequences of the same colour to the screen are also speeded up significantly.

The 480x320 adapted "UTFT" graphics test sketch now runs in 1.6s and the Adafruit GFX style graphicstest runs 3x faster at 1.95s:

Code: [Select]
Benchmark                Time (microseconds)
Screen fill              115291
Text                     28714
Lines                    393270
Horiz/Vert Lines         11581
Rectangles (outline)     8164
Rectangles (filled)      279258
Circles (filled)         186516
Circles (outline)        240076
Triangles (outline)      78149
Triangles (filled)       167982
Rounded rects (outline)  94215
Rounded rects (filled)   348198
Done!
Total = 1.9496


Update:  The diode must be a low capacitance type, so power diodes are not suitable for the mod circuit.  A 1N4148 diode works fine and has been tested at 27MHz SPI clock rate without problems. However I have replaced it with a lower Voltage drop BAT85 schottky diode, this achieves a lower logic "0" voltage when the TFT_WR line is pulled low by the NodeMCU.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: Stan_S on Mar 29, 2017, 04:41 pm
Hi Bodmer,
looks like you have another great library, I just ordered a 3.5" display to try out. The plane spotter sketch as well as the META weather one.
Thanks for all  your efforts.
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Mar 29, 2017, 11:54 pm
Hi Stan,

The larger 480 x 320 screen is great, but it is the most expensive TFT I have in a project at $15. I have not tried to use the touch screen yet and may not bother as I find these resistance based touch screens scratch very easily.

I have combined the weather and clock sketches into one so each occupies half the screen and that works well. When you have your screen up and running then I can make a copy available if you are interested. The only issue is that the clock seconds hand freezes every 10 minutes for about 10s when the weather update information is fetched  from the web, so I may remove that or blank out the second hand it during updates.

I hope to get the Plane Spotter sketch running full screen on 480x320 too but I am going to be very busy with paid work for a few weeks so that will have to wait.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Apr 07, 2017, 03:19 pm
A new RPi 4" "WaveShare" 480x320 screen arrived today. This is destined for a RPi project  but I have connected it the the ESP8266 NodeMCU board and the TFT_eSPI library runs fine with it.

In case anyone is interested in using this larger screen then here is a link to the eBay page. (http://www.ebay.co.uk/itm/332146394227?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT) Note the postal charge! There are other advertisers that sell these displays at a slightly lower cost.

As is often the case with displays from China the images in the advert do not correspond exactly with the delivered screen but it works fine, it does have the WaveShare logo and is marked "4 inch RPi LCD (A)".


Due to the very restrictive PCB track and PCB pad access it would be much trickier to add the speed enhancing mod detailed in post #99  (http://forum.arduino.cc/index.php?topic=443787.msg3194490#msg3194490), but the drawing performance is still very good even with no modifications.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Apr 24, 2017, 04:37 am
In response to a PM, here are the connections for the RPi display with the TFT_eSPI library:

(http://i.imgur.com/QB1ph8s.png)
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: Stan_S on Apr 24, 2017, 08:21 pm
Hi Bodmer,
I just got my display today, thanks for posting the pin out as it is not marked.
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: tsjim on Apr 30, 2017, 03:25 am

Hello Bodmer!

Thank you SO MUCH for all your work on this stuff.  My project is going to ROCK because of you.

Can you or anyone tell me why I'm getting these artifacts when I try to display JPG images with your libraries?

(http://i67.tinypic.com/5349hv.jpg)

(http://i64.tinypic.com/288cvh2.jpg)

(http://i66.tinypic.com/25jwnk0.jpg)

(http://i63.tinypic.com/j0hfk2.jpg)



Here's my code (based on your NodeMCU_Jpeg example sketch):

Code: [Select]


#define FS_NO_GLOBALS
#define TFT_BLACK 0
#include <FS.h>
#include <JPEGDecoder.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();

void setup()
{
  Serial.begin(9600); // Used for messages and the C array generator
  delay(10);
  Serial.println("NodeMCU decoder test!");
  tft.begin();
  tft.setRotation(0);  // 0 & 2 Portrait. 1 & 3 landscape
  tft.fillScreen(TFT_BLACK);
  if (!SPIFFS.begin()) {
    Serial.println("SPIFFS initialisation failed!");
    while (1) yield(); // Stay here twiddling thumbs waiting
  }
  Serial.println("\r\nInitialization done.");
  listFiles(); // Lists the files so you can see what is in the SPIFFS
}

void loop()
{
  tft.setRotation(0);  // portrait
 
  // Display Gear Image
  tft.fillScreen(TFT_BLACK);
  drawJpeg("/t5_gear.jpg", 0, 0);
  delay(2000);

  //Display Water Day image
  tft.fillScreen(TFT_BLACK);
  drawJpeg("/waterday.jpg", 0, 0);
  delay(2000);
}



I have attached both of the original 240x320 JPG image files to this message...maybe there's something wrong with how they are encoded?  I cannot figure this out.

Thank you so much for your help!

Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on Apr 30, 2017, 03:20 pm
Hi tsjim,

Assuming the library example images display OK, then I suspect the encoding format is the problem.

It looks like the MCU size is 8x8 whereas the examples I have tested are 16x16.

It looks like you have used Photoshop to encode the jpeg, perhaps try a different image edit program and try that.

I do not have access to my Arduino stuff at the moment so cannot test. If there is a bug in the 8x8 decoding then I will see if I can track it down.  The other possibility is that the SPI clock frequency is too high for the display. Try 27MHz if you think that may be the case.

Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on May 04, 2017, 12:47 am
Hi tsjim,

I checked the JPEGDecoder library with you files and get the same results on a NodeMCU and a Mega with a different graphics library so the problem must be in the JPEGDecoder library somewhere. The images are encoded as 8x8 MCU blocks and it looks like the decoder does not like this.  I used IrfanView to re-saved one of the files and this turned it into a 16x16 MCU size and this renders fine.  It also renders faster.  See attached.

I have not managed to track down this bug so the only work-around is to use jpeg files encoded in 16x16 MCU blocks.  I will post this as an issue on Github.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: bodmer on May 05, 2017, 02:50 am
Hi tsjim,

I have tracked down the bug and corrected it in the picojpeg.c code.

Download the latest JPEGDecoder library via the IDE Library manager (now at 1.7.7). It may take a day for the IDE to see the latest version.  Or download a copy direct from Github (https://github.com/Bodmer/JPEGDecoder).

The 8x8 MCU sized jpegs should render OK now.

Tip: The original Jpeg was 80kbytes, if you reduce the quality to make it 20kbytes then it will render faster when loading from SPIFFS.
Title: Re: New graphics library for NodeMCU (ESP8266) and SPI based TFT displays
Post by: tsjim on May 08, 2017, 10:51 pm

Hi Bodmer...

That was it!  It works perfectly now.  Awesome.

Thank you very much!
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on May 20, 2017, 03:23 am
I have added Espressif ESP32 processor support to the TFT_eSPI library (https://github.com/Bodmer/TFT_eSPI).

So far this has been tested with an ILI9341 based display.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Stan_S on May 29, 2017, 12:11 am
Hello Bodmer,
I got one of the raspberry pi displays working with the demo code but am having a problem getting the Plane spotter to work, have you gotten it to work on one of these displays? I is using the ILI9486 #5 driver.
Regards,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 09, 2017, 08:46 pm
I happen to have one of those Kedei screens (two actually) so if I can be to any help that would be awesome. One works on my Pi, I want to use the other for Planespotter and Weatherstation.

I read that it uses 3 pin SPI ( Someone mentioned that here) and afaik they all have the same markings but only the signals and display controllers change with almost every iteration. I know that there are a few guys that already connected some version (V5,4,3,2,1 if I am not mistaken) of these tft's to an Arduino and found out by scope what the timings are. That's a start I guess.

Anyway, what do we not know to make it work? 


3 pins SPI


Markings

On the back there are 2 connectors. One has 4 pins, 2 for 5 Vdc and 2 NC.

The other one has 8 pins:
L_CS   T_CS   IRQ   GND
GND   CLK   MISO   MOSI

This guy  (https://www.raspberrypi.org/forums/viewtopic.php?p=1019562#p1019562)already interfaced (v5) with the ESp8266 and worked out the init for that version.

Mine is V6.3 so I think we need the Init for it (Maybe use working version on Raspberry for testing?) or I have to find out what controller is on the display and hope someone wrote the init part already. Right?

Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Stan_S on Jun 09, 2017, 11:35 pm
https://github.com/wdim0/esp8266_with_KeDei_lcd_module

Check the link above Mac
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 12, 2017, 09:26 am
Thanx for the link!

I decided to keep the Kedei screen for the Pi and next time stay away when I see Kedei.
It is not worth the time or the money for me to make it compatible.
I ordered one as described in this topic .
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 13, 2017, 08:56 am
Bodmer,

I want to merge Planespotter and the Weather Station so I can switch between them.

I guess for a start is that I merge settings and libraries.
Then write some code so that both "programs" are simultaneous running (in the background I would say).
Then write some code to switch the display to show PS or WS.   
Could be by using on-screen button, could be swiping.

Do you think that the esp8266 is capable of executing that or would it be too slow?

 
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 14, 2017, 09:28 pm
Full pinout of the Waveshare/knockof. If someone wants to make a Waveshare<>ESP pinout that would be awesome. I had to make a lot of guesses today and it's not working (Sometimes with some ocassional flickering and gibberish on the serial).  So if you want a free beer (or two) please tell me how to wire this puppy up.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jun 17, 2017, 12:50 am
Hello Bodmer,
I got one of the raspberry pi displays working with the demo code but am having a problem getting the Plane spotter to work, have you gotten it to work on one of these displays? I is using the ILI9486 #5 driver.
Regards,
Stan
Try the attached version. It is not perfect (some text position issues) but it should work OK. It is for a 480x320 screen.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jun 17, 2017, 12:53 am
Do you think that the esp8266 is capable of executing that or would it be too slow?
 
It should run just as fast as only one screen needs to be handled at a time.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jun 17, 2017, 01:04 am
Full pinout of the Waveshare/knockof. If someone wants to make a Waveshare<>ESP pinout that would be awesome. I had to make a lot of guesses today and it's not working (Sometimes with some ocassional flickering and gibberish on the serial).  So if you want a free beer (or two) please tell me how to wire this puppy up.
The image attached appears to be corrupted so is not much use.

With reference to the image in post #103 (http://forum.arduino.cc/index.php?topic=443787.msg3233073#msg3233073) and assuming a ESP8266 NodeMCU is used:

+5V =>Vin (5V)
GND => GND

MOSI => pin D7
SCK  => pin D5
DC  => pin D3
CS => pin D8
RST => pin D4
TP_CS => 3.3V (Touch screen disabled)

Run with SPI rate at 20MHz, so for example call up:

#include <User_Setups/Setup5_RPi_ILI9486.h>

in the "User_Setup_Select.h" file within the library.



Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Stan_S on Jun 18, 2017, 12:32 am
Try the attached version. It is not perfect (some text position issues) but it should work OK. It is for a 480x320 screen.

Hi Bodmer,
It works great! Your the best!

Thanks,
Stan
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 18, 2017, 01:22 pm
After figuring out the wiring (Thanx) and using your planespotter repo (and did the same modifications actually) to make it work with your graphics repo driver the display works.

Then I found out that Daniel silently updated his Planespotter repo and added touch.
Tested it, no modifications, works and ofcourse no screen but that wasn't important for testing
So I did some modifications to the Graphics library (Added some missing functions Planespotter uses like getTextBounds and a few others, lazy copied from Adafruit ) modified the sketch to make use of the Graphics library, changed some code like getWidth > widt and getHeight > height and compiled.
It compiles but when started it reboots due to some stack error.

So I took Bodmer repo, hacked in the touch part from Daniel,
That works but when touched it restarts. (TP_CS on D2 and without T_IRQ connected)
So, wired T_IRQ to D4 but didn't made any difference.


I think it's related to the touch screen since testing with only touch examples fails.
(XPT2046 touch screen according to the PCB)

To be continued
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jun 18, 2017, 04:42 pm
I think it's related to the touch screen since testing with only touch examples fails.
(XPT2046 touch screen according to the PCB)

I had not noticed Daniel's update to use the touch screen, so that is interesting.

I have a screen with a XPT2046 connected so I tried Paul's library here (https://github.com/PaulStoffregen/XPT2046_Touchscreen). The example worked fine on an ESP8266 (NodeMCU) without problems when the pins are setup. Here is the sketch I used:

Code: [Select]

#include <XPT2046_Touchscreen.h>
#include <SPI.h>

// These are the pins for all ESP8266 boards
#define PIN_D0 16
#define PIN_D1  5
#define PIN_D2  4
#define PIN_D3  0
#define PIN_D4  2
#define PIN_D5 14 // SCLK
#define PIN_D6 12 // MISO
#define PIN_D7 13 // MOSI
#define PIN_D8 15
#define PIN_D9  3
#define PIN_D10 1

#define CS_PIN  PIN_D1 // XPT2046 chip select
#define TFT_CS  PIN_D8 // TFT chip select

XPT2046_Touchscreen ts(CS_PIN);

void setup() {
  Serial.begin(38400);
  digitalWrite(TFT_CS, 1); // Disable TFT for test only
  ts.begin();
  while (!Serial && (millis() <= 1000));
}

void loopB() {
  TS_Point p = ts.getPoint();
  Serial.print("Pressure = ");
  Serial.print(p.z);
  if (ts.touched()) {
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.print(p.y);
  }
  Serial.println();
  //  delay(100);
  delay(30);
}

void loop() {
  if (ts.touched()) {
    TS_Point p = ts.getPoint();
    Serial.print("Pressure = ");
    Serial.print(p.z);
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.print(p.y);
    delay(30);
    Serial.println();
  }
}



Note that MISO needs to be connected up as well as MOSI.  To play safe for the test I have made sure the TFT cannot respond and upset the MISO data by setting TFT chip select high in setup. Don't try amd use the touch IRQ line as that will not work with an ESP8266.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 18, 2017, 07:25 pm
Yes! Touch is working!

Now, with your Planespotter when pressed, I see a menu and it's no longer crashing.
And now it also know more about coding Arduino sketches so it wasn't a waste of time
It seems no commands are defined so I going to dive into the world of buttons and touch and commands.
Let's see if I can merge PS and WS together.

 


Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jun 19, 2017, 02:04 am
Yes! Touch is working!

Now, with your Planespotter when pressed, I see a menu and it's no longer crashing.
And now it also know more about coding Arduino sketches so it wasn't a waste of time
It seems no commands are defined so I going to dive into the world of buttons and touch and commands.
Let's see if I can merge PS and WS together.

OK, good to hear it is working.  I had a look a Daniel's code and it is a "work in progress" as there the touch response code is incomplete and commented out.

The WS code uses a lot of SPIFFS memory (more than 1 Mbyte) so allocate 3 MBytes.

The output of the touch library could be calibrated and scaled into pixel units, that would help identify different screen areas.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 19, 2017, 11:15 am
Does that mean that we cannot use something like this or wouldn't that only be inaccurate?

Code: [Select]

if ((pt.x>=420) && (pt.x<=480) && (pt.y>=0) && (pt.y<=40)) {


I already created a menu with up down, left right and zoom + - on the right upper side.
The part works, short press brings that menu up, longer press brings up MainMenu.


The commands for Zoom in and zoom out are quite easy to create I think. It requires to grab the currentzoomlevel and do a i++ or i--  for every touch, download that map and display that map.


I was thinking of something like this:
Code: [Select]

if ((pt.x>=420) && (pt.x<=480) && (pt.y>=0) && (pt.y<=40)) {
if (currentPage == '0'){
// Page 0 PanAndZoom, page 1 MainMenu, Page 2  manual update, based on presstime
         tft.fillScreen(TFT_BLACK);
Serial.println("Zoom IN pressed") ;
currentZoomlevel =  geoMap.getCurrentZoomlevel(); //added in geomap.h
 for (int i =  currentZoomlevel; i++;){
    delay(500);
  geoMap.downloadMap(mapCenter, i, _downloadCallback);
  geoMap.convertToCoordinates({0,0});
  geoMap.convertToCoordinates({MAP_WIDTH, MAP_HEIGHT});
  tft.fillRect(0, geoMap.getMapHeight(), tft.width(), tft.height() - geoMap.getMapHeight(), TFT_BLACK);


You can find the (probably not compiling version due to missing brackets to close the loop) code here
https://github.com/Ierlandfan/esp8266-plane-spotter-color
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jun 19, 2017, 01:50 pm
Does that mean that we cannot use something like this or wouldn't that only be inaccurate?
If you run the code in post #122 you will see in the Serial Monitor window that the coordinates are in raw ADC values. These could be used but are likely to be in the range 0 - 4095. Also the coordinate origin of the touch screen may not be in the same place as the origin of the screen.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 19, 2017, 10:21 pm
How hard would it be to write (just for debug purposes) an Adafruit compatible driver using ILI9431 as a template. Tried myself but cannot get the init to work (Used your init and notro's init, screen stays white)
Any idea's?



Nevermind, it wasn't that :o.  After setting a few print statements I saw that it crashed on setFreeFont
Setting it to setTextFont(2); worked.

Have to change a few settings to make it fit the 480*320. It even works on 160MHZ.


I had to use the JPEGDecoder version from FredericPlante. Yours gave me everything but no Google Maps background.  
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Stan_S on Jun 20, 2017, 11:20 pm
Mac_Che were you able to get the latest plane spotter working? if so what did you do?
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 21, 2017, 01:03 am
Hi Stan, yes I am.

it takes a few changes. (I'll save you the trouble, i'll upload a working sketch) I made a few changes to a few libraries so it's easier to upload it and attach it here since Github is kinda new. (TODO, upload to Github)
I changed a lot to make it fit my screen (320*240) and my wishes. Still working on the touch,  I am close.
It sometimes reset and lines (heading) aren't drawn, which it dit initially, have to look in to that.
I want bigger font and more space between the text but hey, I came this far :-)

I took me a while to figure it all out but I managed. Experience in c++ or Arduino code is still below any average. It took a steap learning curve and mostly some time,coffee & perseverance
As always, it wasn't that hard if you know what you're doing (I have some clues what I am doing) but I liked the leaning course. I tried to make as much comments as possible while changing things.

I also included the library's I modified (TFT_eSPi)  in the next post (Due to upload size). Read the original readme by Daniel for the others)
fredericplante's Jpegdecoder changed names due to recovery and is now called JPEG_CODEC, old one will work also.
You can find it here (https://github.com/fredericplante/JPEG_CODEC)
Huge thanx to Bodmer for the liTFT brary and the responses!

By the way, you need this for touch: XPT2046_Touchscreen PaulStoffregen (https://codeload.github.com/PaulStoffregen/XPT2046_Touchscreen/zip/master)
And ofcourse credits to Daniel Eichhorn who made the whole Planespotter sketch in the first place.
See blog (https://blog.squix.org/2017/01/esp8266-planespotter-color.html)
His Github for Planespotter: esp8266-plane-spotter-color (https://github.com/squix78/esp8266-plane-spotter-color)

The sketch is as is, I did not gave myself credits in this one. Free to use.
If you cannot open the zip, it's actually a renamed rar file  (due to forum limitations)
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 21, 2017, 01:39 am
Modified TFT_eSPI (Added some functions)
Only cpp and .h are modified, Download Bodmer original library here (https://github.com/Bodmer/TFT_eSPI) and copy them over.
(Forum limitations and things like that)
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 22, 2017, 12:34 am
Nailed the code for touch and Zoom (working), now need to calibrate the screen because touch seems reversed
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: afox on Jun 26, 2017, 07:14 am
sorrry I am new to this....I am using a st7735 display and a nodemcu esp32

I modified the User_Setup.h file and uncommented the following lines:

#define ST7735_DRIVER
#define TFT_WIDTH 128
#define TFT_HEIGHT 160
#define ST7735_INITB
#define TFT_CS PIN_D5 // Chip select control pin
#define TFT_DC PIN_D2 // Data Command control pin
#define TFT_RST PIN_D4 // Reset pin (could connect to RST pin)
#define SPI_FREQUENCY 27000000

and connected:
CS pin on the st7735 to NODEMCU pin D5
DC on the st7735 to NODEMCU pin D2
RST on the st7735 to NODEMCU pin D4

and ran one of the examples but the display is blank !

what am I doing wrong ?

(http://nylink.com/testesp32/esp32%20sp7735.png)
(http://nylink.com/testesp32/PastedGraphic-1.png)
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jun 26, 2017, 06:15 pm
sorrry I am new to this....I am using a st7735 display and a nodemcu esp32

You need to use numeric numbers for the I/O pins with an ESP32, for example use:

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS    15  // Chip select control pin
#define TFT_DC    2  // Data Command control pin
#define TFT_RST   4  // Reset pin (could connect to RST pin)

On an ESP32 the hardware SPI port can be mapped to almost any pin, but those are the ones I use and work fine.

Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: afox on Jun 26, 2017, 09:04 pm
thanks so much it finally worked !!!

I used the following pins:

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS    5
#define TFT_DC    2
#define TFT_RST   4

even if MISO to pin 19 is not connected !

(http://nylink.com/testesp32/Messages%20Image(2673731618).png)
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jun 26, 2017, 11:45 pm
thanks so much it finally worked !!!

It looks like red and blue are swapped so try a different "TAB" option in the setup file if this is the case.

Good luck with your project.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jun 27, 2017, 07:54 pm
Is there an easy way to download (6Kb) bmp (from a/my internal server) and throw them out of memory when no longer needed?
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jul 03, 2017, 01:50 am
Is there an easy way to download (6Kb) bmp (from a/my internal server) and throw them out of memory when no longer needed?
The simplest method if the server handles http GET commands is to use a method like this example (https://github.com/Bodmer/TFT_eSPI/blob/master/examples/320%20x%20240/weather-station-v8/WebResource.cpp).  However as the image is small, and I assume frequently fetched and erased, then the image can be stored in a RAM array otherwise you could wear out the FLASH memory.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jul 03, 2017, 03:37 pm
What I assume (Please verify) is that it is not possible to write to SPIFFS during runtime, only during setup phase.

Since i can't store the 1500+ images directly to SPIFFS since it's total size is more than 5MB, i was thinking that I simply download the images I need while they're being seen (silhouettes of the airplane) and store them on SPIFFS. I don't think I will ever see all the 1500+ Airplanes on the device so that's not a problem.

Everyime I download the images during runtime it resets and throws a stack trace on the serial interface.
The images are ok since storing (a few ofcourse) of them to SPIFFS directly and show them on the display works.


I am ok with storing them into ram but well, i can't find any examples for it.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jul 04, 2017, 12:20 am
What I assume (Please verify) is that it is not possible to write to SPIFFS during runtime, only during setup phase.

Since i can't store the 1500+ images directly to SPIFFS since it's total size is more than 5MB, i was thinking that I simply download the images I need while they're being seen (silhouettes of the airplane) and store them on SPIFFS. I don't think I will ever see all the 1500+ Airplanes on the device so that's not a problem.

Everyime I download the images during runtime it resets and throws a stack trace on the serial interface.
The images are ok since storing (a few ofcourse) of them to SPIFFS directly and show them on the display works.


I am ok with storing them into ram but well, i can't find any examples for it.
SPIFFS is a FLASH based filing system so files can be created and erased during runtime. The main problem is that the FLASH will eventually wear our after maybe less than 1 million write cycles.

There are many reasons why the ESP8266 throws an exception (stack trace), the common reason is the watchdog reset, in this case calling yield() frequently (more than once per second) fixes it. Another reason is using too much RAM or writing past the end of an array.

Unfortunately it will be difficult for me to help you with your project due to the many unknowns in your setup and sketch.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jul 04, 2017, 02:58 pm
Fixed! Changed the delay from 1 to 1500..than I saw the serial slowly doing it's job..so I played with the value and between 50 and 100 seems ok.

I updated my dev branch accordingly for anyone who's interested.

https://github.com/Ierlandfan/esp8266-plane-spotter-color

If any credits are not where they should be, please let me know.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jul 15, 2017, 08:39 pm
The TFT_eSPI library has been updated on Github to support the SPI overlap mode with the ESP8266.

This means that a SPI based TFT can share the MOSI, MISO and SCK pins with the program FLASH and thus frees up at least 2 GPIO pins for other uses.

To use this capability the latest Github version of the ESP8266 board package must be used in the IDE, as it is not a formal release yet this must be obtained direct from Github. The board package was updated in May 2017 to support the overlap mode. If readers are unsure how update the board package manually then it would be best to wait for the next board package version to be released.

Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Jul 27, 2017, 03:25 pm
Can someone with more knowledge of arduino IDE help me porting
https://github.com/Links2004/arduinoVNC
to this  library?

What I can deduct it's a script with the functions separated from the driver.
Like: VNCScripts>Framebuffer (function calls for the TFT drver...sort of a wrapper)>TFT driver
So it seems like we need to substitue some references to eTFT. When I tried it gave me a lot of errors
(mostly init related errors with the tft driver) I can't figure out what or how to proceed.
IT would be a nice add-on to use it with this driver.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Jul 29, 2017, 12:47 am
@Mac_che

Looks like an interesting library...  I will take a look.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: johnnyfrx on Aug 05, 2017, 07:02 pm
I came across the complete pin mappings for this 3.5" RPi TFT display buried in the aliexpress site. Just in case anyone needs them:

Interface Definition:
PIN NO.                                            SYMBOL                                          DESCRIPTION
1, 17                                                   3.3V                                  Power positive (3.3V power input)
2, 4                                                      5V                                    Power positive (5V power input)
3, 5, 7, 8, 10, 12, 13, 15, 16            NC                                                     NC
6, 9, 14, 20, 25                                GND                                                  Ground
11                                                    TP_IRQ                              Touch Panel interrupt, low level while
                                                                                                 the Touch Panel detects touching
18                                                    LCD_RS                             Instruction/Data Register selection
19                                                    LCD_SI / TP_SI                 SPI data input of LCD/Touch Panel
21                                                   TP_SO                                 SPI data output of Touch Panel
22                                                   RST                                                        Reset
23                                                   LCD_SCK / TP_SCK         SPI clock of LCD/Touch Panel
24                                                   LCD_CS                               LCD chip selection, low active
26                                                  TP_CS                                   Touch Panel chip selection, low active
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: whyzzie on Aug 18, 2017, 01:44 am
Hi all,

need some help, got a elegoo tft, any chance to use this display with a nodemcu ?

If so, need to know, how to connect the shield.

Or any other lib

https://www.elegoo.com/product/elegoo-uno-r3-2-8-inches-tft-touch-screen/

Many thanks

Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: joshferg on Aug 30, 2017, 11:48 pm
I have a 3.5" 8-bit ILI9488 touch screen that I am trying to use with an ESP32.

It states its an SPI device and has MISO, MOSI, CS, and pins, but not DC.

Here are the pins it has:

T_CS
CLK
PEN
F_CS
MISO
MOSI
GND (x3)
5V
VDD (x2)
BL
DB0-DB14
RST
WR
RD
CS
RS

There is an onboard SD card slot as well.

My first question is which pins are for the TFT so that I can ignore the SD and touch portions.

Second question is can I make this work without a DC pin, or is one of the pins an alternative for DC?

Thanks!
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: david_prentice on Aug 31, 2017, 08:28 am
Please post a link to the actual  display that you are using.

RS (register select) is another name for DC (data/command)

Since you appear to have DB0-DB14 it seems rather unusual
8080-16;would need DB0-DB15
8080-18 would need DB0-DB17
8080-8 would need DB0-DB7 or DB8-DB15

The quality of any reply depends on the quality of your question.

David.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: joshferg on Aug 31, 2017, 08:49 pm
Thanks David.

I received some documentation on the board last night. I've attached it.

On my ESP32 I'm getting a white screen.

Here's the config I have enabled in user_select.h

#define RPI_ILI9486_DRIVER

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS    17  // Chip select control pin
#define TFT_DC    16  // Data Command control pin
//#define TFT_RST   5  // Reset pin (could connect to RST pin)
#define TFT_RST  -1  // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST

 #define SPI_FREQUENCY  20000000
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: david_prentice on Aug 31, 2017, 09:22 pm
The schematic shows a 8080-16 interface.
Bodmer's library is for SPI displays.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: Mac_che on Sep 06, 2017, 07:01 pm
Most of those displays with 34 pins have multiple connections.
Most of them can be connected through spi as well as parallel so it should work. But ymmv.
(According to Google that is, my similar display was killed during transport, cannot confirm personally)

Are you sure about the ILI9486 driver?
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: txkennedys on Sep 18, 2017, 07:53 pm
Hi all -

I'm trying to get my ST7735R display to work with my NodeMCU ESP8266 development board.
  Display: https://www.adafruit.com/product/2088
  NodeMCU: https://www.amazon.com/HiLetgo-Version-NodeMCU-Internet-Development/dp/B010O1G1ES
 
I've looked at scores of sites and tried multiple approaches - nothing has worked. The support I've seen on this thread seems promising, so I'm hoping someone can help a noob out here.

What I've done:
1. Firmware -  https://nodemcu-build.com/
   I have updated it from master branch, using modules: bit, file, gpio, net, node, spi, tmr, uart, ucg, wifi
   Following th update, I can communicates with the chip from ESPlorer
   Once I upload code from Arduino editor, ESPlorer no longer communicates (see below)

2. Ardurino editor - ...you probably know the site since it hosts this forum! :)
   In preferences, I have identified http://arduino.esp8266.com/stable/package_esp8266com_index.json as the source of additional boards. From this, I am able to select "NodeMCU 1.0 (ESP-12E Module)" as the board
      Details: CPU Frequency: 80 Mhz, Flash Size: 4M (3M SPIFFS), Upload Speed: 115200, Port: COM 5
      Board Info: BN: Unknown board, VID: 10C4, PID: EA60, SN: Upload any sketch to obtain it
      Programmer: AVRISP mkll

   My .ino Code:
   #include <TFT_eSPI.h> // Hardware-specific library
   #include <SPI.h>

   TFT_eSPI tft = TFT_eSPI();  // Invoke library, pins defined in User_Setup.h

   void setup(void) {
      tft.init();
      tft.setRotation(1);
   }

   void loop() {
      tft.fillScreen(TFT_WHITE);
      delay(500);
      tft.fillScreen(TFT_BLACK);
      delay(500);
   }

3. TFT_eSPI library
  User_Setup.h //(I am only showing active code)
   #define ST7735_DRIVER
   #define TFT_WIDTH  128
   #define TFT_HEIGHT 128
   #define ST7735_GREENTAB128 // For 128 x 128 display
   #define TFT_CS  PIN_D8 // NOTE: I have also tried: 15
   #define TFT_DC  PIN_D3 // NOTE: I have also tried: 0, PIN_D2, 4, PIN_D4, 2, and 1 // Data Command control pin
   #define TFT_RST  -1  // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
   #define TFT_MOSI PIN_D7 //  NOTE: I have also tried: 13, and leaving undefined
   #define TFT_SCLK PIN_D5 //  NOTE: I have also tried: 14, and leaving undefined
   
   #define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
   #define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
   #define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
   #define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
   #define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
   #define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
   #define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
   #define SPI_FREQUENCY  27000000 // Actually sets it to 26.67MHz = 80/3
   
  TFT_Drivers\ST7735_Defines.h
  LINE 7:
     #define TFT_HEIGHT 128 // NOTE: I have also tried the default: 160
    
4. Physical Connections:
   Display      NodeMCU
   Vin         3.3V // (one by flash button in corner, same side as all other connections except RST)
               // NOTE: I have also tried leaving this disconnected and just using LITE
   3V3         Not connected // This is identified as an "output" in documentation... I have tried it - doesn't work
   Gnd         GND // Right next to 3.3V listed 2 lines above
   SCK         D5
   MISO      Not connected // Don't need to "read" screen
   MOSI      D7
   TFT_CS      D8
   RESET      RST // (other side of board, 3rd pin from RST button).
               // NOTE: I have also tried D4 (changing User_Setup.h to PIN_D4 and 2))
   D/C         D3 // NOTE: I have also tried D2, D4, and TX
   CARD_CS      Not connected
   LITE      3.3V // NOTE: I have also tried leaving this disconnected and just using Vin

Thanks in advance for your help. ...I really have put lots of work into this trying to avoid bothering you with this, but I'm stuck and would appreciate it if you could help a brother out.

Best
CK
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: kenybalboa on Oct 04, 2017, 02:21 pm
Hi i have error :

Code: [Select]
C:\Program Files (x86)\Arduino\libraries\TFT_ILI9341_ESP-master/Fonts/glcdfont.c:6:22: fatal error: pgmspace.h: No such file or directory

This pgmspace.h is my trouble

After add pgmspace.h from

Code: [Select]
https://github.com/mikalhart/galileo-Pgmspace.h

or
 
Code: [Select]
https://github.com/01org/corelibs-arduino101



i have alot errors.Please help.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: kenybalboa on Oct 06, 2017, 11:11 am
identify lcd :

3.5 inch RPi LCD V3.0 HVGA 480X320. There is a XPT2046, 74HC04D, 74HC4040D, and 2 74HC4094D chips on the back

WaveShare SpotPear 3.5" ili9341

https://github.com/notro/fbtft/issues/215

Photo add in attachment

From GIT hub i must add this library to my arduino 1.8.2 software:

AVR-LIBC-master

Code: [Select]
https://github.com/vancegroup-mirrors/avr-libc

ARDUINO-ESP32-master

Code: [Select]
https://github.com/espressif/arduino-esp32

ESP-IDF-master

Code: [Select]
https://github.com/espressif/esp-idf


Arduino software do alot errors.Cant upload to arduino nano :/

WHY?

Thank you for all answers.
Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Oct 13, 2017, 12:53 am
@kenybalboa

So many questions... so many problems!

The latest library is the TFT_eSPI (https://github.com/Bodmer/TFT_eSPI).

It is not clear whether you are using an ESP8266 and ESP32 Board. Make sure the board support packages for the boards used are loaded and seen by the IDE.  Try and compile and uploadsome simple examples first for the ESP8266 or EP32 (blink etc). Once that is working error free then move on to use the TFT library.

#include <pgmspace.h>

Should be accepted by the compiler.

If the correct board is selected, eg. Nano etc, then the IDE examples should compile without error.

If you select the ESP32 or ESP8266 boards in the IDE then the TFT_eSPI examples should compile OK. Once this has been achieved with no error configure the library for your TFT by editing the User_Setup.h file inside the library folder.

Title: Re: New graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Oct 13, 2017, 01:13 am
@txkennedys

I see no obvious mistake. Try a different driver by using:

#define ST7735_BLACKTAB

instead of:

#define ST7735_GREENTAB128

If that does not work then try each of the other drivers.

If that does not work use an Adafruit website tutorial and library to make sure the display is working OK.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Oct 17, 2017, 01:49 am
The XPT2046 touch screen controller is supported. The SPI bus for the touch controller is shared with the TFT and only an additional chip select line is needed.

Example is included for 480x320 RPi display "Touch_Controller_Demo", the screen calibration data is stored in the SPIFFS.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Oct 23, 2017, 03:52 pm
Library update:

I have added the Button display and handling class from Adafruit_GFX. This is enhanced in that any font can be used for the button labels.

The touch screen functions built into the TFT_eSPI library (XPT2046 supported) have also been updated to improve touch detection reliability.

A simple on/off switch example has been added that tests the touch screen, this does not use the Button class.

A keypad example a for 240x320 TFT has also been added which demonstrates use of the Button class:

(https://i.imgur.com/SS3B3Uz.png)

The touch screen handler saves the screen x,y calibration data in a SPIFFS file, so at the moment the touch screen only works with the ESP8266. Although SPIFFS support has recently been added to the ESP32 board package I have not tried it yet.

Report any issues here or raise an issue for the TFT_eSPI library on Github (https://github.com/Bodmer/TFT_eSPI).
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Oct 23, 2017, 04:04 pm
The touch and button class work fine with the RPi "Waveshare" style 320x480 display. The connection image in the library tools folder (https://github.com/Bodmer/TFT_eSPI/blob/master/Tools/RPi_TFT_Connections.png) has been updated to show the MISO pin (to read the XPT2046 touch controller) and the chip select line connections.

Note: the library expects the touch controller and the TFT to share the same SPI lines. Different chip select lines are used and defined in the User_Setup.h (https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setup.h#L87) file.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Oct 25, 2017, 03:04 am
More updates:

1. A new sketch (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Generic/Touch_calibrate) has been added purely for touch screen calibration and test. This one does not need SPIFFS, the calibration code is posted to the Serial Monitor for easy cutting and pasting into a sketch.

2. The touch screen detection handling functions in the library have been updated to improve the touch detection reliability and positional accuracy.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Nov 15, 2017, 09:57 pm
The most exciting update for a while.. ?

If you hate the screen flicker when updating graphics on the screen then the latest edition of TFT_eSPI (https://github.com/Bodmer/TFT_eSPI) may be of interest.

I have added a "Sprite" class, this allows images to be created using graphics functions (drawLine() etc etc) from the sketch, the sprite (aka bitmap image) can then be pushed to anywhere on the screen very quickly.

The good news is very smooth flicker free screen updates are possible, the bad news is that large sprites consume a lot of RAM, this means that for the ESP8266 you are limited to a sprite of about 160x128 pixels which consumes 40Kbytes of RAM. I may make 8 bit pixels an option next to halve the RAM need.

Drawing graphics into a RAM based sprite (effectively a mini RAM screen) is very fast, the complete Adafruit graphicstest runs in less than 27 milliseconds in a 160x128 sprite.

Here is a quick demo (https://i.imgur.com/ONleJ1C.mp4) where a 240x30 pixel sprite is generated, graphics drawn into it + text, and then pushed onto the TFT. By moving the text 1 pixel at a time for each push to screen the text scrolls across smoothly.

In the demo large "Adafruit GFX" style font digits are  also drawn into a sprite with some background graphics, then pushed to screen. This eliminates flicker and allows complex graphics backgrounds (shading etc) behind changing numbers.

Sprites can be created. pasted to screen then deleted to recover RAM. This means sprites can be created at will with different sizes to update particular areas of the screen.

At the moment I have created 4 examples (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Sprite) to show how to use sprites.

Report any bugs here or on Github.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Nov 22, 2017, 12:08 am
I have added support for sprites with 8 bit colour depth (3 bits red, 3 bits green, 2 bits blue), this halves the RAM required compared to a 16 bit colour sprite but reduces the colours available for graphics operations within the sprite.

Here are screen shots using 16 bit colours (65536 different colours):

(https://i.imgur.com/vkq2S9O.png)

(https://i.imgur.com/Ooj9y5J.png)

8 bit colours in comparison have only 256 as follows:

(https://i.imgur.com/uqP4aK7.png)

(https://i.imgur.com/bmGep38.png)

A new example  (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Sprite/Sprite_scroll_8bit)has been added to demonstrate.

By default sprites are 16 bits. The colour depth can be specified before creating a sprite byt the function:

Code: [Select]

spr.setColorDepth(8);


Where the depth can be 8 or 16 bits. The sprite must be deleted and created again if the colour depth is to be changed after creation.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: vivien16 on Nov 26, 2017, 12:03 pm
Hello,
I face a strange problem.
Two months ago I compiled the examples in 480x320 pixels for ESP 32 and it worked perfectly but now when I complicate again I get the following errors:

C:\Users\Lienard Vivien\Documents\Arduino\libraries\TFT_eSPI-master\TFT_eSPI.cpp:1334:83: error: array subscript has type 'char' [-Werror=char-subscripts]
         GFXglyph *glyph  = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[uniCode]);

C:\Users\Lienard Vivien\Documents\Arduino\libraries\TFT_eSPI-master\TFT_eSPI.cpp:4421:20: error: 'yo16' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     int16_t  xo16, yo16;
C:\Users\Lienard Vivien\Documents\Arduino\libraries\TFT_eSPI-master\TFT_eSPI.cpp:4421:14: error: 'xo16' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     int16_t  xo16, yo16;
C:\Users\Lienard Vivien\Documents\Arduino\libraries\TFT_eSPI-master\TFT_eSPI.cpp:1512:20: error: 'yo16' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     int16_t  xo16, yo16;
C:\Users\Lienard Vivien\Documents\Arduino\libraries\TFT_eSPI-master\TFT_eSPI.cpp:1512:14: error: 'xo16' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     int16_t  xo16, yo16;


I can not understand why, Help would be welcome
Thanks in advance.
Vivien16
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Nov 26, 2017, 01:52 pm
@vivien16

The ERC32 compile process imposes stricter rules on the source code, so maybe the compiler options have been updated?

I have fixed this in the library on Github, so download and use the latest TFT_eSPI and the warning should go away.

I see this has also been corrected in the Adafruit_GFX library where this snippet of code came from, so all should be good now.

Thanks for reporting this.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Dec 11, 2017, 12:52 am
A few updates have been made to the library:

1. Sprites can now be scrolled, there is a new demo example (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Sprite/Sprite_scroll) showing a smoothly scrolling graph and text
2. fillSprite() & sprite fillRect() performance improvement using memcpy() function


The "fill" performance boost means the entire Adafruit graphicstest runs within a 160x128 sprite in 15ms for 8 bit colours, or 18ms for 16 bit colours (was 28ms).  This indicates how fast graphics rendering can be inside a sprite.

Please report any issues on Github, or as a post on this forum.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Dec 12, 2017, 01:08 am
Attached is a seasonal sketch, created just for fun!

It is tested on a NodeMCU (ESP8266) board with the latest TFT_eSPI library.

The "snow" falling is animated, here is a screenshot for those that do not have the required setup.

(https://i.imgur.com/Rcq3tKG.png)

P.S. It is left as an exercise to add the missing apostrophe :-)
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: TFTLCDCyg on Dec 12, 2017, 02:21 am
THX bodmer great library, effort colossal!

Happy Christmas and prosperous 2018!

(http://www.mediafire.com/convkey/9c36/aajwdiqf1ljmdjqzg.jpg)
ESP32 Dev Module + ILI9341 2.8" + IDE 1.9.0-beta
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Dec 12, 2017, 11:03 pm

@TFTLCDCyg

Nice to know it works on an ESP32 and it looks better in landscape mode!

The array then needs to be 16 bits otherwise the "flakes" are only drawn in the first 256 pixels in the x direction:

Code: [Select]

uint16_t flake[NUMFLAKES][3];



Enjoy!
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: stdr on Jan 30, 2018, 07:53 pm
Hi,

great job. I use this library for an ILI9341 display and the RPi display. It works fine.

I just wonder how to control the backlight of the RPi display. Some websites suggest that a PWM signal could be provided to gpio18 (Raspberry header). That would correspond to pin 12 on the display connector.

I tried that approach without success.

Has anyone managed to dim the backlight?

Thanks in advance.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Feb 03, 2018, 12:44 am
The Waveshare style displays compatible with the library do not have a backlight control pin :-(
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Feb 03, 2018, 12:49 am
I had a look at my display and it appears that resistor R5 is the one that supplies the backlight LEDs. If you are into board hacking then you could but the track and add a transistor switch. At your own risk...
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Feb 23, 2018, 11:30 pm
I have added anti-aliased fonts to  the TFT_eSPI library (https://github.com/Bodmer/TFT_eSPI).

Fonts with configurable size and containing any arbitrary characters, or range of characters, from the Unicode 16bit character set (i.e. Basic Multilingual Plane) can be included using a Processing sketch in the Tools folder of the library. The source font files can be from your PC or selected TrueType (*.ttf and *.otf) files.

Fonts are stored in the ESP8266 or ESP32 SPIFFS FLASH memory.

New examples have been added to demonstrate. At the moment these use the print class. Drawing characters with background over-write and printing in sprites is also supported but I have not included any examples yet.

Screenshots from the examples below:

(https://i.imgur.com/xJF0Oz7.png)

(https://i.imgur.com/qEFzf5z.png)

(https://i.imgur.com/vUuluNH.png)

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Feb 24, 2018, 09:53 pm
Latest anti-aliased test with an elegant Japanese font shows the benefits of smooth font rendering on a TFT screen. This is a 48pt font:

(https://i.imgur.com/OTi3HI4.png)


(https://i.imgur.com/NcS89Xj.png)
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: david_prentice on Feb 25, 2018, 06:06 pm
The Smooth Fonts are impressive.    Especially for your investigation of the VLW format.

I was thinking in terms of a 4-level or 16-level Grayscale for the bitmaps.    Effectively 2x or 4x size of monochrome bitmaps.    I will see what your rendering looks like with a "coarser" colour blend.

My general conclusion is that the glyph overhead and bitmap size makes anti-aliasing impractical for a Uno.   Not impossible for Zero, Due,  Teensy, ...

If I was Japanese,   I would appreciate your example in #172.
Being a Brit,   I am more interested in attractive fonts like Helvetica/Arial.   Less so for the Final-Frontier.

I will let you know the result of my "coarse" GrayScale experiments.
There is always going to be a trade-off between Flash usage and rendering speed.   The typical 240x320 or 320x480 screen is unlikely to need fonts in scalable pitch.  Or more than 2 or 3 fonts in one application.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Feb 26, 2018, 01:06 am
Hi David,

The 2 bit greyscale helps with font appearance but it is noticeably worse on smaller characters.  4 bit is good with little noticeable difference, the 565 16 bit encoding of colours limits the greyscale resolution anyway. You have probably figured out this is easy to test this by adapting the alphaBlend() function.

You will probably also notice that small or fine (single pixel line) fonts look less attractive than simple bitmaps, using larger or bold fonts works well. Italic fonts seem to render well even in small sizes.

Run length encoding is also very effective at reducing the font file size, as is omitting characters that are not needed!

SPIFFS seems to be smart and buffers the font in ~24kbyte blocks so file seeks are fast for each character until a new block of memory has to be loaded, then there is a ~30ms overhead for the next character. Thus it is good to keep the font file size down if fast rendering is needed.

If you use UTF8 encoded characters out of the normal ASCII range, then there is  "gotcha" that puzzled me for a while, the Arduino IDE has a bug where UTF8 characters in the sketch do not get encoded in the compiled code unless the sketch is saved before upload!
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays
Post by: bodmer on Feb 26, 2018, 04:19 pm
I have tested a GNU Free Font (https://www.gnu.org/software/freefont/), these are the same source fonts that are used by the Adafruit fonts.

To generate the same size character on the screen the point size used in the "Create Font" Processing sketch must be twice the point size used in the Adafruit font name. So to reproduce the Adafruit font size of 12 the point size used in the Processing sketch would be 24. This is all to do with scaling of font point sizes to pixels. The fact that is a nice integer multiplier is handy.

Here is the Adafruit "FreeSans12pt" compared to the same font in 24 point size in the anti-aliased font:

(https://i.imgur.com/gYxSZsf.png)

The image is "zoomed in" to exaggerate the anti-aliased greyscale pixels use to smooth the characters.

This is thee equivalent x1 scale:

(https://i.imgur.com/gAeDPFY.png)
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial or paralle TFT displays
Post by: bodmer on Mar 11, 2018, 12:50 pm
The library (https://github.com/Bodmer/TFT_eSPI) now supports 8 bit parallel TFTs with an ESP32. For example UNO style TFT displays made by mcufriend.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Phaedra on Mar 12, 2018, 08:28 pm
Just tested the updated lib with an Uno Board ESP32 parallel ILI9488 and parallel HX8357D (I had to tweak the init/defines) and all is working well.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 14, 2018, 01:49 pm
@ Phaedra

Great, thanks for testing.

If you share the changes you made I can update the library!
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Mar 23, 2018, 04:43 am
Hi Stan,

The Weather Station code has been updated on Github (https://github.com/Bodmer/esp8266-weather-station-color) and is ready for tests.

Some 2.8" ILI9341 displays turned up today and are working fine, It is nice to have a bigger display so it can be seen at a distance.

Hi Bodmer! I have installed all libraries but it is showing the following:

Arduino: 1.8.5 (Windows 10), Placa:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from C:\Users\Daniel\Documents\Arduino\libraries\SD\src/utility/Sd2Card.h:26:0,

                 from C:\Users\Daniel\Documents\Arduino\libraries\SD\src/utility/SdFat.h:29,

                 from C:\Users\Daniel\Documents\Arduino\libraries\SD\src/SD.h:20,

                 from C:\Users\Daniel\Documents\Arduino\libraries\JPEGDecoder/JPEGDecoder.h:53,

                 from sketch\GfxUi.h:33,

                 from D:\Arduino\Displays TFT\ILI9341\TFT_ILI9341_ESP by Bodmer\esp8266 Weather Station Color by Bodmer\esp8266-weather-station-color-updated\esp8266-weather-station-color\esp8266-weather-station-color.ino:41:

C:\Users\Daniel\Documents\Arduino\libraries\SD\src/utility/Sd2PinMap.h:510:2: error: #error Architecture or board not supported.

 #error Architecture or board not supported.

  ^

In file included from D:\Arduino\Displays TFT\ILI9341\TFT_ILI9341_ESP by Bodmer\esp8266 Weather Station Color by Bodmer\esp8266-weather-station-color-updated\esp8266-weather-station-color\esp8266-weather-station-color.ino:63:0:

C:\Users\Daniel\Documents\Arduino\libraries\TimeClient/TimeClient.h:27:21: fatal error: ESPWiFi.h: No such file or directory

 #include <ESPWiFi.h>

                     ^

compilation terminated.

exit status 1
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Mar 26, 2018, 10:02 pm
And the TFT_Clock_NTP_DST code shows the following:

Arduino: 1.8.5 (Windows 10), Placa:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP/Fonts/glcdfont.c:6:0,

                 from C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.h:28,

                 from C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.cpp:19:

C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.cpp: In member function 'virtual size_t TFT_ILI9341_ESP::write(uint8_t)':

C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.cpp:2112:89: error: invalid conversion from 'unsigned int' to 'const void*' [-fpermissive]

       width = pgm_read_byte( pgm_read_dword( &(fontdata[textfont].widthtbl ) ) + uniCode-32 );

                                                                                         ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:115:51: note: in definition of macro 'pgm_read_byte'

 #define pgm_read_byte(addr) pgm_read_byte_inlined(addr)

                                                   ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:101:23: error:   initializing argument 1 of 'uint8_t pgm_read_byte_inlined(const void*)' [-fpermissive]

 static inline uint8_t pgm_read_byte_inlined(const void* addr) {

                       ^

C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.cpp: In member function 'int16_t TFT_ILI9341_ESP::drawChar(unsigned int, int, int, int)':

C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.cpp:2259:76: error: invalid conversion from 'unsigned int' to 'const void*' [-fpermissive]

       width = pgm_read_byte( pgm_read_dword( &(fontdata[font].widthtbl ) ) + uniCode );

                                                                            ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:115:51: note: in definition of macro 'pgm_read_byte'

 #define pgm_read_byte(addr) pgm_read_byte_inlined(addr)

                                                   ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:101:23: error:   initializing argument 1 of 'uint8_t pgm_read_byte_inlined(const void*)' [-fpermissive]

 static inline uint8_t pgm_read_byte_inlined(const void* addr) {

                       ^

C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.cpp:2284:54: error: invalid conversion from 'uint32_t {aka unsigned int}' to 'const void*' [-fpermissive]

           line = pgm_read_byte(flash_address + w * i + k);

                                                      ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:115:51: note: in definition of macro 'pgm_read_byte'

 #define pgm_read_byte(addr) pgm_read_byte_inlined(addr)

                                                   ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:101:23: error:   initializing argument 1 of 'uint8_t pgm_read_byte_inlined(const void*)' [-fpermissive]

 static inline uint8_t pgm_read_byte_inlined(const void* addr) {

                       ^

C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.cpp:2324:54: error: invalid conversion from 'uint32_t {aka unsigned int}' to 'const void*' [-fpermissive]

           line = pgm_read_byte(flash_address + w * i + k);

                                                      ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:115:51: note: in definition of macro 'pgm_read_byte'

 #define pgm_read_byte(addr) pgm_read_byte_inlined(addr)

                                                   ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:101:23: error:   initializing argument 1 of 'uint8_t pgm_read_byte_inlined(const void*)' [-fpermissive]

 static inline uint8_t pgm_read_byte_inlined(const void* addr) {

                       ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:115:55: error: invalid conversion from 'uint32_t {aka unsigned int}' to 'const void*' [-fpermissive]

 #define pgm_read_byte(addr) pgm_read_byte_inlined(addr)

                                                       ^

C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.cpp:2368:16: note: in expansion of macro 'pgm_read_byte'

         line = pgm_read_byte(flash_address);

                ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:101:23: error:   initializing argument 1 of 'uint8_t pgm_read_byte_inlined(const void*)' [-fpermissive]

 static inline uint8_t pgm_read_byte_inlined(const void* addr) {

                       ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:115:55: error: invalid conversion from 'uint32_t {aka unsigned int}' to 'const void*' [-fpermissive]

 #define pgm_read_byte(addr) pgm_read_byte_inlined(addr)

                                                       ^

C:\Users\Daniel\Documents\Arduino\libraries\TFT_ILI9341_ESP\TFT_ILI9341_ESP.cpp:2424:16: note: in expansion of macro 'pgm_read_byte'

         line = pgm_read_byte(flash_address++); // 8 bytes smaller when incrementing here

                ^

C:\Users\Daniel\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:101:23: error:   initializing argument 1 of 'uint8_t pgm_read_byte_inlined(const void*)' [-fpermissive]

 static inline uint8_t pgm_read_byte_inlined(const void* addr) {

                       ^

exit status 1
Erro compilando para a placa NodeMCU 1.0 (ESP-12E Module)
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 27, 2018, 12:23 am
@Dancopy

The library was developed using version 2.3.0 of the ESP8266 Board Support Package, this was more tolerant of the types assigned to program pgm_read_xxxx(*) memory pointers. The TFT_ILI9341_ESP library will generate the errors you describe under later board support packages and I see you are using the latest 2.4.1.

Regress to version 2.3.0 and all should be OK.

The TFT_ILI9341_ESP has been superceded by the more capable but compatible TFT_eSPI library (https://github.com/Bodmer/TFT_eSPI) which compiles fine under 2.4.1, but of course the particular examples you cite do not call up that library and thus would need to be adapted.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bperrybap on Mar 27, 2018, 12:33 am
@Dancopy

The library was developed using version 2.3.0 of the ESP8266 Board Support Package, this was more tolerant of the types assigned to program pgm_read_xxxx(*) memory pointers. The TFT_ILI9341_ESP library will generate the errors you describe under later board support packages and I see you are using the latest 2.4.1.
Coincidentally, I filed a bug report on this earlier today:
https://github.com/esp8266/Arduino/issues/4572 (https://github.com/esp8266/Arduino/issues/4572)

Until they fix the issue, it is a simple two line fix to their pgmspace.h header file that you can make yourself.

--- bill
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 27, 2018, 12:36 am
The TFT_eSPI library has been updated to support 1 bit per pixel Sprites, this means that full screen buffers can be kept in the ESP8266 or ESP32 memory by using:

img.setColorDepth(1);

The two 16bit equivalent colours for this 2 colour "bitmap" buffer can be specified with a new command:

img.setBitmapColor(foreground_color, background);

One of these colours can optionally be set as "transparent" when rendering to screen.

Example:
Code: [Select]


/*
  Sketch to show creation of a sprite with a transparent
  background, then plot it on the TFT.

  Example for library:
  https://github.com/Bodmer/TFT_eSPI

  A Sprite is notionally an invisible graphics screen that is
  kept in the processors RAM. Graphics can be drawn into the
  Sprite just as it can be drawn directly to the screen. Once
  the Sprite is completed it can be plotted onto the screen in
  any position. If there is sufficient RAM then the Sprite can
  be the same size as the screen and used as a frame buffer.

  A 1 bit Sprite occupies (width * height)/8 bytes in RAM. So,
  for example, a 320 x 240 pixel Sprite occupies 9600 bytes.
*/
//  A new setBitmapColor(fg_color, bg_color) allows any 2 colours
//  to be used for the 1 bit sprite. One colour can also be
//  defined as transparent when rendering to the screen.


#include <TFT_eSPI.h>                 // Include the graphics library (this includes the sprite functions)

TFT_eSPI    tft = TFT_eSPI();         // Create object "tft"

TFT_eSprite img = TFT_eSprite(&tft);  // Create Sprite object "img" with pointer to "tft" object
                                      // the pointer is used by pushSprite() to push it onto the TFT

void setup(void) {
  Serial.begin(250000);

  tft.init();

  tft.setRotation(0);
}

void loop() {

  tft.fillScreen(TFT_NAVY);

  // Draw 10 sprites containing a "transparent" colour
  for (int i = 0; i < 10; i++)
  {
    int x = random(240-70);
    int y = random(320-80);
    int c = random(0x10000); // Random colour
    drawStar(x, y, c);
  }

  delay(2000);

  uint32_t dt = millis();

  // Now go bananas and draw 500 nore
  for (int i = 0; i < 500; i++)
  {
    int x = random(240-70);
    int y = random(320-80);
    int c = random(0x10000); // Random colour
    drawStar(x, y, c);
    yield(); // Stop watchdog reset
  }

  // Show time in milliseconds to draw and then push 1 sprite to TFT screen
  numberBox( 10, 10, (millis()-dt)/500.0 );

  delay(2000);

}

// #########################################################################
// Create sprite, plot graphics in it, plot to screen, then delete sprite
// #########################################################################
void drawStar(int x, int y, int star_color)
{
  
  // Create an 1 bit (2 colour) sprite 70x80 pixels (uses 70*80/8 = 700 bytes of RAM)
  // Colour depths of 8 bits per pixel and 16 bits are also supported.
  img.setColorDepth(1);      // Set colour depth before creating the Sprite
  img.createSprite(70, 80);  // Create the sprite
  img.setBitmapColor(star_color, TFT_BLACK); // Set the 2 pixel colours
  
  // Fill Sprite with the colour that will be defined later as "transparent"
  // We could also fill with any colour as transparent, and later specify that
  // same colour when we push the Sprite onto the display screen.
  img.fillSprite(TFT_BLACK);

  // Draw 2 triangles to create a filled in star
  img.fillTriangle(35, 0, 0,59, 69,59, star_color);
  img.fillTriangle(35,79, 0,20, 69,20, star_color);

  // Punch a star shaped hole in the middle with a smaller "transparent" star
  img.fillTriangle(35, 7, 6,56, 63,56, TFT_BLACK);
  img.fillTriangle(35,73, 6,24, 63,24, TFT_BLACK);

  // Push sprite to TFT screen CGRAM at coordinate x,y (top left corner)
  // Specify what colour is to be treated as transparent (black in this example).
  img.pushSprite(x, y, TFT_BLACK);

  // Delete Sprite to free memory, creating and deleting takes very little time.
  img.deleteSprite();
 
}

// #########################################################################
// Draw a number in a rounded rectangle with some transparent pixels
// #########################################################################
void numberBox(int x, int y, float num )
{

  // Size of sprite
  #define IWIDTH  80
  #define IHEIGHT 35

  // Create a 8 bit sprite 80 pixels wide, 35 high (2800 bytes of RAM needed)
  // this gives 256 colours per pixel, this example uses 3 colours,
  // "transparent", red and white
  img.setColorDepth(8);
  img.createSprite(IWIDTH, IHEIGHT);

  // Fill it with black (this will be the transparent colour)
  img.fillSprite(TFT_BLACK);

  // Draw a background for the numbers
  img.fillRoundRect(  0, 0,  80, 35, 15, TFT_RED);
  img.drawRoundRect(  0, 0,  80, 35, 15, TFT_WHITE);

  // Set the font parameters
  img.setTextSize(1);           // Font size scaling is x1
  img.setTextColor(TFT_WHITE);  // White text, no background colour

  // Set text coordinate datum to middle right
  img.setTextDatum(MR_DATUM);

  // Draw the number to 3 decimal places at 70,20 in sprite using font 4
  img.drawFloat(num, 3, 70, 20, 4);

  // Push sprite to TFT screen at coordinate x,y (top left corner)
  // All black pixels will not be drawn hence will show as "transparent"
  img.pushSprite(x, y, TFT_BLACK);

  // Delete sprite to free up the RAM
  img.deleteSprite();
}




The motivation for this update is to permit full screen image buffering and also as a first step to supporting 2 and 3 colour ePaper displays.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 27, 2018, 12:42 am
@bperrybap Thanks for pointing out the bug report!

@Dancopy, if you follow the bperrybap link in post #182 to the Github report you can see the changes that can be made to get the latest 2.4.1 board support package to work.

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Mar 27, 2018, 12:57 am
And for a "beginner" like me (why not say a layman yet!), What should be done? Or, do you intend to adapt the library? Thank you
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 27, 2018, 01:01 am
@Dancopy

The esp8266-weather-station-color sketch works fine [Edit almost works] with the newer TFT_eSPI library  :) .

Search and replace

_ILI9341_ESP

with:

_eSPI


The sketch files to search and replace within are "esp8266-weather-station-color.ini", "GfxUI.cpp" and "GfxUI.h" files.

I will update the Github copy tomorrow [edit: with a few tweaks]

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Mar 27, 2018, 01:05 am
Sorry, I had not seen the answer! I will try!
Thanks to you and the bperrybap.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Mar 27, 2018, 01:23 am
OK, and after replacing in the libraries, I go to the sketch header and replace the #include <TFT_ILI9341_ESP.h> with <TFT_eSPI.h> ?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bperrybap on Mar 27, 2018, 01:27 am
And for a "beginner" like me (why not say a layman yet!), What should be done? Or, do you intend to adapt the library? Thank you
The problem is in the esp8266 core code supplied by the esp8266 guys.
You have to edit the pgmspace.h file in the esp8266 core to actually fix it.
You seem to be using Windows, so sorry I can't help as to where the 3rd party cores are stored.

The esp guys are pretty good about fixing bugs, but it can take a while for the fixes to work their way out to a new release.

@bodmer
Switching to the eSPI library was quick and easy and "just worked". Great!
(@Dancopy, it is more than just changing the header file, as you must also change all the class references)

I'm playing with the older weather sketch as I'm getting ready to do some updates to make it easier to use.
I'll be adding timezoneapi.io support to automatically fetch location and timezone information as well as DST setting.
This will allow it to be more automated. It will re-check every day for a DST change.
The user will be able to override the location by entering it in from the WifiManager or through a web page which will then again use  timezoneapi.io to fetch all the needed information.
By default it will use your IP address to determine your location.
i.e. a blank/unspecified location means "use the WAN IP address" to determine location and timezone information.



--- bill
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 27, 2018, 01:34 am
@Dancopy

I suggest you wait for an update on Github, I will try and do this within 24 hours. The TFT_ESP seems to introduce some screen rotations to some of the text, so more extensive changes than anticipated are needed!
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 27, 2018, 10:45 pm
@Dancopy

The copy on Github has been updated.

It turned out that the weird behavior of rotated text was because I had resized the SPIFFS filing system to only 1Mbyte and had filled it up!  I guess that corrupted SPIFFS and upset the filing system library somehow.

So the lesson is to allocate 3M to SPIFFS before running the sketch!

Post back if you have problems.

@bperrybap

Those improvements sound good, can you create a pull request of Github at some point?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bperrybap on Mar 27, 2018, 10:52 pm
@bperrybap

Those improvements sound good, can you create a pull request of Github at some point?
Sure. Also, there are a few other things like the weather underground API key that I want to move away from the code and into a WEB page setting. That way nothing that is unique/specific to the users environment is in the actual code.

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Mar 30, 2018, 11:44 pm
Hi Bodmer! Now the 'esp8266-weather-station-color' screen has opened rather strange; I've attached an image for you to see. Is this related to the SPIFFS of esp8266?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 31, 2018, 02:24 pm
@Dancopy

Make sure you have put yor WeatherUnderground API key in the settings.h file in the sketch and that your ESP8266 is connecting to your WiFi router and the internet. Open the IDE Serial Monitor at 250000 baud to see the status messages.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Mar 31, 2018, 06:18 pm
It is connecting to the WiFi router and the Internet because the time is showing correct;

Serial Monitor at 250000 baud:

Found /mini/sleet.bmp
Found /mini/snow.bmp
Found /mini/sunny.bmp
Found /mini/tstorms.bmp
Found /mini/unknown.bmp
Found /moon0.bmp
Found /moon1.bmp
Found /moon2.bmp
Found /moon3.bmp
Found /moon4.bmp
Found /moon5.bmp
Found /moon6.bmp
Found /moon7.bmp
Found /moon8.bmp
Found /moon9.bmp
Found /moon10.bmp
Found /moon11.bmp
Found /moon12.bmp
Found /moon13.bmp
Found /moon14.bmp
Found /moon15.bmp
Found /moon16.bmp
Found /moon17.bmp
Found /moon18.bmp
Found /moon19.bmp
Found /moon20.bmp
Found /moon21.bmp
Found /moon22.bmp
Found /moon23.bmp
===========================
Drawing file: /WU.jpg
===========================
===============
JPEG image info
===============
Width      :240
Height     :143
Components :1
MCU / row  :15
MCU / col  :9
Scan type  :4
MCU width  :16
MCU height :16
===============

Total render time was    : 183 ms
=====================================
.
16:13:56
16:13:56
58436
Requesting URL: /api/<11a6d2e9527abc4d>/conditions/lang:BR/q/BR/Governador_Celso_Ramos.json
start document
Requesting URL: /api/<11a6d2e9527abc4d>/forecast10day/lang:BR/q/BR/Governador_Celso_Ramos.json
start document
Requesting URL: /api/<11a6d2e9527abc4d>/astronomy/lang:BR/q/BR/Governador_Celso_Ramos.json
start document
unknown.bmp
/mini/unknown.bmp
/mini/unknown.bmp
/mini/unknown.bmp
/moon0.bmp
*WM: freeing allocated params!


An observation:
I had already used NodeMCU's SPIFFS to insert images from a 'date' folder with another sketch. Should I clean SPIFFS?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bperrybap on Mar 31, 2018, 07:49 pm
The latest code is working ok for me. I'm using a Wemos D1 mini.
--- bill
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Mar 31, 2018, 08:24 pm
The latest code is working ok for me. I'm using a Wemos D1 mini.
--- bill
But, you can see that according to the attached image, the screen is opening normally but the icons are strange and are missing weather information.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 31, 2018, 10:40 pm
@Dancopy

You are nearly there, the Weather Underground is not responding.

You need to remove the < > around your API KEY. So the URL request will then look like this:

Requesting URL: /api/11a6d2e9527abc4d/conditions/lang:BR/q/BR/Governador_Celso_Ramos.json

The use of <> is a coding convention for where to insert user information, I think I will remove them in the next version!
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Apr 12, 2018, 07:15 pm
Hi Bodmer! I wonder what these Ghosts are! (attached image)
I'm using display 2.8 "+ NodeMCU + Portable charger 5.1V = 0.7A.
But, interestingly it was working properly for a few days.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bperrybap on Apr 12, 2018, 07:27 pm
The pgm_read_xxx() issues in pgmspace.h in the esp8266 core have been resolved and will be in the next released version of the esp8266 core.
issue: https://github.com/esp8266/Arduino/issues/4572 (https://github.com/esp8266/Arduino/issues/4572)
There was quite a bit of discussion on the issue as well as a few other issues related to pgmspace.h compatibility with the AVR version.

The final result is a little bit of a compromise given the nature of issue and is better at providing AVR compatibility:
<avr/pgmspace.h> can now be used for the location.
The obsolete prog_char types  are no longer available by default just like the AVR version
If you want/need the old prog_char types as well as the no type checking for argument types in pgm_read_xxx() functions you must define  __PROG_TYPES_COMPAT__ before including pgmspace.h

While this last one doesn't provide 100% compatibility with what used to work in the esp8266 core in the past by default., overall, It seems pretty good and moving forward should help catch some accidental programming issues when using the functions.
And it does provide a simple way to re-enable the old prog_char types and behavior.

--- bill
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Apr 12, 2018, 07:50 pm
Hi bperrybap! What should I do then? Thank you
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bperrybap on Apr 12, 2018, 07:56 pm
for pgmspace compatibility issues, none of this new pgmspace.h stuff is available yet.
For the time being you must patch the 2.4.1 core as I explained earlier and to avoid losing compatibility in a future release,
turn on the compatibility define.
However, none of this really matters, as I think bodmer already updated the code to work with the newer esp8266 core.

--- bill
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Apr 12, 2018, 11:23 pm
@Dancopy,

Bill is correct, I updated the core to correct the types used to be compatible with the latest board package.

I suspect you problems are caused by setting SPIFFS too small, this causes odd effects. Set it to 3Mbytes:

(https://i.imgur.com/Qn6gqII.png)

Report back if this does not fix the problem.

I will see if it is possible for the sketch to check the SPIFFS size at runtime.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: lightcalamar on Apr 27, 2018, 09:24 am
Hello @bodmer

Recently you have put in your repository an example with microSD reader, this link; https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Generic/ESP32_SDcard_jpeg (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Generic/ESP32_SDcard_jpeg)
Can you put the reader's pinout?

Thank you.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Apr 28, 2018, 01:52 am
@lightcalamar

This is the configuration I use for that sketch:

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS   15
#define TFT_DC    2
#define TFT_RST   4

#define TOUCH_CS 22     // Chip select pin (T_CS) of touch screen

The sketch assigns the SD Card chip select to digital pin 5, so the SD card is wired up to the ESP32 SPI pins as follows:

SD MISO > 19
SD MOSI > 23
SD SCLK > 18
SD CS    > 5
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: lightcalamar on Apr 30, 2018, 03:59 pm
Thanks @bodmer

This is my doubt.
It is used for TFT, HSPI and for SD reader using VSPI.

One more question. You use this type of shield?

(https://halckemy.s3.amazonaws.com/uploads/attachments/405963/ili9341_2_2y4dfyF8GR.jpg)

Best regards.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Apr 30, 2018, 11:28 pm
@lightcalamar

Yes, you can use an UNO shield with an UNO format ESP32 board providing the TFT driver is one that is supported. Drivers for other TFT controllers can be added to the library if you know what driver is fitted.

I advise against trying to wire an ESP32 using jumper wires to the display as you really need a ground plane to handle the high speed signals (to avoid ground bounce and edge glitches).
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Jul 07, 2018, 11:59 pm
The library has been updated to add support for:



Please report any bugs on Github (https://github.com/Bodmer/TFT_eSPI).
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Aug 14, 2018, 09:00 pm
Hi Bodmer,

if I have a text with changing size, how should I use the "textpadding" function to erase the previous text?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Aug 15, 2018, 11:47 pm
Set the test colours:


tft.setTextColor(TFT_WHITE, TFT_BLACK);


Set the text datum, e.g.

tft.setTextDatum(TL_DATUM);


Set the total padding width in pixels:


tft.setTextPadding(100);


Then print the text:

tft.drawString("Hello", xpos, ypos);
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Aug 21, 2018, 07:21 pm
Hi Bodmer,

thanx for that.

Nvm the the other question, I made a typo in there.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: oneis on Aug 23, 2018, 11:53 pm
I was wondering if someone could possibly suggest link(s) to purchase 3.5inch SPI TFT display that works with the ESP32 and Bodmer's TFT_eSPI library. It does not need to be a UNO/MEGA shield. But I would like to be able to control the backlight - example there is a surface mount backlight current limiting resistor that can be accessed or better a backlight control pin.
There are plenty of RPI SPI displays out there - are they suitable? RPI ad's don't specifiy the controller type.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Aug 26, 2018, 04:27 pm
@oneis
The choice depends on how much hand wiring you want to do and which ESP32 board you have. The options for SPI serial interface screens of a large size is somewhat limited.

The RPi screen I use is this one (https://www.ebay.co.uk/itm/raspberry-pi-3-5-inch-tft-lcd-Module-For-Raspberry-Pi-2-Model-B-RPI-B-ra-D8J1/283029759094?hash=item41e5e36476:g:nWwAAOSwbPJbNJfq). If you buy from another vendor make sure the back of the screen is identical as the library supports RPi displays with a specific interface circuit. Th RPi display also has a touch screen.

If you have an UNO format ESP32 there are 8 bit parallel displays like this with ILI9481 controllers (https://www.ebay.co.uk/itm/3-5inch-TFT-Color-Screen-Module-320X480-Ultra-HD-LCD-Shield-for-Arduino-UNO-FT/112790945520?hash=item1a42dd3ef0:m:miQ_f6oi8m3Qb6KK72-o1Mg). Display updates are faster on an 8 bit parallel screen but you do use up a lot of IO pins.

I have also used this display (https://www.buydisplay.com/default/arduino-3-5-tft-lcd-touch-shield-serial-spi-example-for-mega-due) which works fine, it uses the ILI9488 controller and has options for populating with a touch controller.

The TFT_eSPI library does support resistive screens that use the XPT2046 controller.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: ccadic on Aug 26, 2018, 06:42 pm
Hope I post in the correct forum
If been trying to use ESP32 and TFT_eSPI with a ILI9486 display 
(https://fr.aliexpress.com/item/maithoga-3-5-inch-40P-SPI-TFT-LCD-Screen-with-Touch-Panel-ILI9486-ILI9486L-IC-8/32553877063.html)

With no sucess. I've been turning around for 12 hours now with no idea, even thinking of changing to another driver and another screen to save hours.

SPI display IM0 IM1 and IM2 set to SPI 4  wires

TFT_eSPI up to date:

The UserSetup.h seems to be ok with

#define ILI9486_DRIVER

and

// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP   ######

// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS    5  // Chip select control pin
#define TFT_DC    14  // Data Command control pin
#define TFT_RST   27  // Reset pin (could connect to RST pin)
//#define TFT_RST  -1  // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST


Rechecked several time
The display lights up


The Graph2 example compiles with no errors
with this in it

#include <TFT_eSPI.h> // Hardware-specific library
#include <SPI.h>
#include <User_Setup.h>

TFT_eSPI tft = TFT_eSPI();                   // Invoke custom library with default width and height




But there is nothing on screen

I'm not sure the SPI mode on ESP32 + ILI9486 is working or still experimental. After numerous searchs
Anyone made ESP32 TFT_eSPI ILI9486 work all together ? Any tutorial ? would probably save me


Photo here : https://scontent-cdt1-1.xx.fbcdn.net/v/t1.0-9/40116322_10217290724449841_6821176092099870720_n.jpg?_nc_cat=0&oh=087ae0352cf38d1d6a558861a80ab02e&oe=5BF089DA




Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Aug 26, 2018, 07:11 pm
Are you serious?

Your photo shows a rats' nest of wires with no schematic or description of how you have set the IM# lines.

Bodmer supports 8080-8 with ESP32
Bodmer supports the RPi shift register abortion
Bodmer supports SPI-4wire with ESP8266 / ESP32 but only for ILI9341 / ST7735.

My experience of 8080-8 with ESP32 is that it is ok with a pcb shield and ESP32 TTGO board.
It is flaky with hand-wired 8080-8 and ESP32 module.

Personally,   I would choose SPI-4wire with the IM# lines.
And use a library compatible with the EastRising ILI9488 board in Bodmer's link.

Most ILI9341 SPI code uses 16-bit data write for pixels.    However you can select either 24 or 16 bit writes with the ILI9341.

Note that the ILI9486/ILI9488 can only use 24-bit data write for pixels.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: ccadic on Aug 26, 2018, 07:58 pm
After many attempts , I was able to make the TFT work.
Impossible to use with the gived ILI9486 drivers (RPI or Normal) - I'm lost
I was able to load ILI9488 driver

But I have a very strange behaviour , probably because of the driver which is probbaly related to a wrong driver All examples are producing green results. I have 2 displays and swapped them , same result. The white cannot be displayed. Looks like it comes from the wrong driver
 

(https://scontent-cdt1-1.xx.fbcdn.net/v/t1.0-9/40187742_10217291020937253_6891214793810640896_o.jpg?_nc_cat=0&oh=b19df2156eb5707f39b934606ee8ea79&oe=5BF1DFD2)

(https://scontent-cdt1-1.xx.fbcdn.net/v/t1.0-9/40072201_10217291023337313_8119943828401553408_o.jpg?_nc_cat=0&oh=951a92b975238231413394493190b799&oe=5C3228A0)

Do you think I can edit  something in
C:\Users\<user>\Documents\Arduino\libraries\TFT_eSPI\TFT_Drivers
to recover the good colors ?
I'm pretty sure we can edit driver parameters. I do not know where to start from.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: oneis on Aug 27, 2018, 02:21 am
Bodmer, many thanks for your complete reply.

I had been using ESP32 DevkitV1 with handwired (female SIL headers+flat cable < 3") with identical 8bit display as your link (https://www.ebay.co.uk/itm/3-5inch-TFT-Color-Screen-Module-320X480-Ultra-HD-LCD-Shield-for-Arduino-UNO-FT/112790945520?hash=item1a42dd3ef0:m:miQ_f6oi8m3Qb6KK72-o1Mg). Backlight controlled with PNP transistor in series with surface mount R1. This proved perfectly stable.

Unfortunately ran out of GPIO pins, hence the SPI TFT question.

I will order the RPI display you mention (https://www.ebay.co.uk/itm/raspberry-pi-3-5-inch-tft-lcd-Module-For-Raspberry-Pi-2-Model-B-RPI-B-ra-D8J1/283029759094?hash=item41e5e36476:g:nWwAAOSwbPJbNJfq) but don't see a pin header legend or touch controller type - does its touch work with TFT_eSPI? Also is the backlight controllable?

Subsequently and possibly of interest I came across this display (https://www.buydisplay.com/default/lcd-3-5-inch-320x480-tft-display-module-optl-touch-screen-w-breakout-board). I find their website selection of TFT interface type rather confusing since some links to breakout boards seem to come with all listed interface options - presumably one just wires-up what is needed.

Update: Does this screen (https://www.ebay.com.au/itm/3-5-inch-LCD-Touch-Screen-Display-Module-Board-320x480-RGB-For-Raspberry-Pi-E6T4-/183298192906?_trksid=p2349526.m4383.l4275.c10#viTabs_0) look workable?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Aug 27, 2018, 10:14 pm
@oneis

You need a screen that looks exactly like this one (https://www.ebay.co.uk/itm/raspberry-pi-3-5-inch-tft-lcd-Module-For-Raspberry-Pi-2-Model-B-RPI-B-ra-D8J1/283029759094?hash=item41e5e36476:g:nWwAAOSwbPJbNJfq), otherwise you are taking a chance that the circuit and TFT controller is not compatible.

Yes, it has a XPT2046 touch controller and this is supported by TFT_eSPI.

No it does not have a backlight control pin.

This one (https://www.buydisplay.com/default/lcd-3-5-inch-320x480-tft-display-module-optl-touch-screen-w-breakout-board) has a backlight control pin, you need to configure it for 4 wire SPI. It has a touch controller but it is NOT supported by TFT_eSPI.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Aug 27, 2018, 10:23 pm
@ccadic

You are close to getting the board working, the odd colours are due to the driver init code being different.

The ILI9486 is supported as a SPI RPi board only and as David says the controller needs 18 bit colours just like the ILI9488.

I think you will be able to trick the library into using 18bit colours on the ILI9486 if you do this:

Define both the ILI9488 and ILI9486 controllers in the setup file:

Code: [Select]


#define ILI9486_DRIVER
#define ILI9488_DRIVER



The ILI9486 init code will then take preference but the 18 bit mode will be invoked for the library.

Then in your sketch setup() after tft.init() add these two lines to put the display into 18 bit mode:

Code: [Select]


tft.writecommand(0x3A); // Pixel Interface Format

tft.writedata(0x66);  // 18 bit colour for SPI



Post back if this does/does not work.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: oneis on Aug 28, 2018, 04:37 am
Your replies have been very useful in clarifing suitable displays. I have to study how touch screens and touch controllers work as I sense the buydisplays are good quality and it's a bonus they reply to questions.

Thanks again Bodmer.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Sep 12, 2018, 11:58 am
Hi Bodmer,

is transparancy supported without using sprites? (Bitmaps for example)
Or if not, what would be the best way to draw a few bitmap (16x16) on a static background image?

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Sep 12, 2018, 09:28 pm
Yes, drawBitmap() and drawXBitmap() support transparency,  they take the same parameters the only difference being the bit order in each byte. See drawXBitmap example.

pushImage() also supports a defined colour as transparent, use for 8 or 16 bits per pixel images.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Sep 13, 2018, 02:25 pm
I forgot to mention that it was the drawBmp function (Bitmap from Spiffs) , that probably needs some small modifications I guess to also handle the transparancy?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Sep 13, 2018, 04:24 pm
In that case replace:
Code: [Select]
tft.pushImage(x, y--, w, 1, (uint16_t*)lineBuffer);

With:
tft.pushImage(x, y--, w, 1, (uint16_t*)lineBuffer,  COLOUR);


Where COLOUR is the colour you want to be transparent.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Oct 16, 2018, 12:07 am
The Weather Underground website no longer supports free user accounts. This means the Weather example of the TFT_eSPI library will cease to work.

To rectify this situation I have created a new library that fetches weather by using the Dark Sky API. The library can be found here:

https://github.com/Bodmer/DarkSkyWeather (https://github.com/Bodmer/DarkSkyWeather)


I have included a TFT screen example plus another one that just sends weather data as text to the Serial port.

The TFT example uses anti-aliased (smooth) fonts and I have created brand new weather icons, so all images are then anti-aliased too.  This gives the impression of a much higher resolution screen.  The example is intended for the ESP8266 only and a minimum screen resolution of 240 x 320 (eg ILI9341). It will work on 320 x 480 screens to but will not fill the screen completely.

Example screenshot grabbed direct from an ILI9341 TFT:

(https://i.imgur.com/ORovwNY.png)

The weather example in the TFT_eSPI library will shortly be replaced by that Dark Sky example.

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: zoomx on Oct 17, 2018, 08:49 am
I had to find time to test this one!

Thanks bodmer!
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Oct 22, 2018, 10:19 pm
ESP32 boards are now available with SPIRAM (https://www.ebay.com/itm/TTGO-T8-V1-1-ESP32-4MB-PSRAM-TF-CARD-3D-Antenna-WiFi-Buletooth-Module/283040490899?hash=item41e6872593:g:0MEAAOSwBUpbPR6a:rk:5:pf:0) (aka PSRAM) which adds a huge 4 MBytes or more to the available RAM.  This extra RAM is ideal for handling Sprites (screen image buffers) so I have adapted the TFT_eSPI library (https://github.com/Bodmer/TFT_eSPI) to use this new resource by default if it is available on your ESP32 board and it is enabled in the Arduino IDE by the menu option.

The use of PSRAM means it is possible to have full screen frame buffers even on large displays, for example 4MBytes is enough for at least 12 x 480 x 320 full screen 16 bi t colour buffers...


The new "3D" antenna on these ESP32 boards also increases the WiFi range significantly, and there is a built in Lipo charger too.

The plan is to add the facility to move the anit-aliased fonts into the PSRAM at some point in the future. This should boost the font rendering performance significantly by eliminating the long "seek" time that is inherent with SPIFFS.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Oct 22, 2018, 11:37 pm
The Dark Sky weather library (https://github.com/Bodmer/DarkSkyWeather) has been updated and now supports the ESP32 as well as the ESP8266 with TFT screens.

The new "ESP32_TFT_eSPI_weather" example is compatible with the ESP32. The display output is identical to the ESP8266 variant posted earlier (https://forum.arduino.cc/index.php?topic=443787.msg3908054#msg3908054).
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: mirko78 on Oct 29, 2018, 04:08 pm
Hi everyone,i try to connect kuman 3.5 tft display the same in this page (https://www.hackster.io/112938/kuman-tft-3-5-retropie-2018-a9b0c8) with wemos d1 without result...my goal is to make a color weather station with the device i have at home,i'm not able to run it,and i don't know if this is possible,can anyone upload a sketch with wiring?thanks a lot!
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Oct 30, 2018, 01:42 am
Library here (https://github.com/Bodmer/TFT_eSPI).

Connections here (https://github.com/Bodmer/TFT_eSPI/blob/master/Tools/RPi_TFT_Connections.png) and pins to use are:

Display T_CS to Wemos  pin D1
Display SDO/MISO to Wemos pin D6 (or leave disconnected if not reading TFT)
Display LED to Wemos pin VIN (or 5V)
Display SCK to Wemos pin D5
Display SDI/MOSI to Wemos pin D7
Display DC (RS/AO) to Wemos pin D3
Display RESET to Wemos pin D4
Display CS to Wemos pin D8
Display GND to Wemos pin GND (0V)
Display VCC to Wemos 5V or 3.3V

Add // at start of this line (https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setup_Select.h#L22) to comment out that setup.

Uncomment (remove//) on this line "Setup10_RPi_touch_ILI9486.h (https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setup_Select.h#L33)" in the library "User_Setup_Select.h"

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: trik125 on Dec 16, 2018, 10:07 pm
Hi Bodmer,
congratulations for Your fantastic work with the library TFT eSPI, now I can finally use my rpi display  :)

I have a problem to show small BMP image, I see yor example "flash_bitmap" that show very nice image.
but i need to show different one. I tried different conversion methods (export fro GIMP in .xbm, conversion with "lcd-image-converter" and  "lcd assistant" with vaious formats (32x32, 64x64, 8bit / 16bit, colour / monochrome... etc) but the image is always bad (the best result show 2 image side by side).

could you explain how to covert an image (to be used with ProgMem, not from SD), which software to use and with which parameters? thank you so much.


THI IS THE CODE and below one of .h file  exported

Code: [Select]

// Demo using arcFill to draw ellipses and a segmented elipse
#include <TFT_eSPI.h> // Hardware-specific library
//#include <Adafruit_GFX.h>

#include <SPI.h>
#include <ESP8266WiFi.h>
#include "Alert.h"
#include "sole2.h"
TFT_eSPI tft = TFT_eSPI();       // Invoke custom library

//http://henrysbench.capnfatz.com/henrys-bench/arduino-adafruit-gfx-library-user-guide/arduino-16-bit-tft-rgb565-color-basics-and-selection/
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define DEG2RAD 0.0174532925
#define LOOP_DELAY 10 // Loop delay to slow things down
boolean range_error = 0; // eliminare se non usato
byte inc = 0;
unsigned int col = 0;
byte red = 31; // Red is the top 5 bits of a 16 bit colour value
byte green = 0;// Green is the middle 6 bits
byte blue = 0; // Blue is the bottom 5 bits
byte state = 0;

void setup(void)
{
  tft.begin();
  tft.setRotation(0); // 0 / 90 / 180 o 270
  tft.fillScreen(TFT_BLACK);
  Serial.begin(115200);


  // -------------------------------------------------------************----------------------------------------
  drawIcon(alert, 40, 80, alertWidth, alertHeight);
  //drawIcon(info, 210, 80, infoWidth, infoHeight);
  drawIcon(sole2, 210, 80, sole2Width, sole2Height);
   
  tft.drawLine(10, 330, 300, 330, red);
  tft.drawLine(10, 335, 300, 335, BLUE);
 
  delay(200);
}


void loop()
{



}// fine main loop





// To speed up rendering we use a 64 pixel buffer
#define BUFF_SIZE 64
// Draw array "icon" of defined width and height at coordinate x,y
// Maximum icon size is 255x255 pixels to avoid integer overflow
void drawIcon(const unsigned short* icon, int16_t x, int16_t y, int8_t width, int8_t height)
{
  uint16_t  pix_buffer[BUFF_SIZE];   // Pixel buffer (16 bits per pixel)
  // Set up a window the right size to stream pixels into
  tft.setWindow(x, y, x + width - 1, y + height - 1);
  // Work out the number whole buffers to send
  uint16_t nb = ((uint16_t)height * width) / BUFF_SIZE;
  // Fill and send "nb" buffers to TFT
  for (int i = 0; i < nb; i++)
  {
    for (int j = 0; j < BUFF_SIZE; j++)
    {
      pix_buffer[j] = pgm_read_word(&icon[i * BUFF_SIZE + j]);
    }
    tft.pushColors(pix_buffer, BUFF_SIZE);
  }

  // Work out number of pixels not yet sent
  uint16_t np = ((uint16_t)height * width) % BUFF_SIZE;
  // Send any partial buffer left over
  if (np)
  {
    for (int i = 0; i < np; i++) pix_buffer[i] = pgm_read_word(&icon[nb * BUFF_SIZE + i]);
    tft.pushColors(pix_buffer, np);
  }
}
 // ------------------------------------------------------------------------------





Code: [Select]


// We need this header file to use FLASH as storage with PROGMEM directive:
#include <pgmspace.h>
// Icon width and height
const uint8_t sole2Width  = 64;
const uint8_t sole2Height = 64;

const unsigned short  sole2[1024] PROGMEM={
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00,
0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xE0, 0xC0, 0x80, 0x81, 0x83, 0x87, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x7F, 0x7E, 0x7E,
0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x87, 0x83, 0x81, 0x80, 0xC0, 0xE0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x81, 0xC1, 0xE0, 0xE0, 0xF0, 0xF0, 0xF8, 0xF8, 0xF8, 0xF8,
0xF8, 0xF8, 0xF8, 0xF8, 0xF0, 0xF0, 0xE0, 0xE0, 0xC1, 0x81, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x7F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07,
0x00, 0x00, 0x00, 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, 0x00, 0x00, 0x00,
0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x7F,
0xFE, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0,
0x00, 0x00, 0x00, 0x0F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x0F, 0x00, 0x00, 0x00,
0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFE,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x81, 0x83, 0x07, 0x07, 0x0F, 0x0F, 0x1F, 0x1F, 0x1F, 0x1F,
0x1F, 0x1F, 0x1F, 0x1F, 0x0F, 0x0F, 0x07, 0x07, 0x83, 0x81, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x07, 0x03, 0x01, 0x81, 0xC1, 0xE1, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0x7E, 0x7E,
0x7E, 0x7E, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xE1, 0xC1, 0x81, 0x01, 0x03, 0x07, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00,
0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Dec 17, 2018, 01:07 am
Your "bitmap" was written for a KS0108 style controller.   i.e. each byte draws 8 pixels down the screen.
This "W x 8" rectangle is called a page.

I have changed your definition:
Code: [Select]

//const unsigned short  sole2[1024] PROGMEM = {
const uint8_t  sole2[512] PROGMEM = {


and this is a function to draw it:
Code: [Select]

void show_ks0108(int x, int y, const uint8_t *bmp, int w, int h, uint16_t color, uint16_t bg, uint8_t pad = 7)
{
    for (int page = 0; page < h / 8; page++) {
        uint8_t mask = 0, c;
        for (int col = 0; col < w; col++) {
            for (int row = 0; row < 8; row++) {
                if (mask == 0) {
                    c = pgm_read_byte(bmp + page * w + col);
                    mask = 0x01;
                }
                tft.drawPixel(x + col, y + row + page * 8, (c & mask) ? color : bg);
                mask <<= 1;
            }
        }
    }
}

called like this:
Code: [Select]

    show_ks0108(x, y, sole2, 64, 64, BLUE, BLACK);


David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: trik125 on Dec 17, 2018, 05:43 pm
Your "bitmap" was written for a KS0108 style controller.   i.e. each byte draws 8 pixels down the screen.
....

David.
Many thanks David, now I go to try.
:)
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Dec 17, 2018, 08:29 pm
@trik125
David's approach should work fine. There is another option, the TFT_eSPI has a function to draw X bitmap format files. There is an example included in the "Generic" folder here (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Generic/drawXBitmap).
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Dec 17, 2018, 09:26 pm
tools that create bitmaps from JPEG or PNG images can use different formats.

The KS0108 "8-bit vertical" style is used on monochrome displays like SSD1306 (and KS0108)

"8-bit horizontal" style is used for fonts and other purposes.   It is easy to picture binary constants.
Especially when they are used with MSB on the left.    This is used by Adafruit "drawBitmap()" method.

The "8-bit horizontal" style is also used as XBM format.   It is like the Adafruit but with the LSB on the left.    This makes any human representation indecipherable.

When you convert your favourite JPEG into a data for your GLCD, TFT, OLED, ...,  remember to select the most suitable format.

Most of the world will use the Adafruit MSB-left 8-bit horizontal style.
Olikraus's U8g2lib favours XBM style.

David. 
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: trik125 on Dec 17, 2018, 10:02 pm

Bodmer, David, thank you so much for the explanation.
I have tried both methods and they work great!
:)

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Dec 22, 2018, 11:37 pm
Hi Bodmer, I saw you made a extension (TFT_eFX) to TFT_eSPI. That's awesome! No need to manually update or include the .cpp and .h files of TFT-eSPi to insert some function that is to our needs only (or for others)

Got me thinking. Let's say I want to create a function using TFT_eFX and use it in a sprite.
I use img.function now (for Sprites) but what if I want to call a TFT_eFX function and use that in a sprite?)
Would that be img.eFX.function?
(For example I want to add drawBMP in TFT_eFX to use it in a Sprite)
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Dec 23, 2018, 02:35 am
Hi Mac_che,

The easiest method I think is to include a pointer to the Sprite as a parameter with the other function call variables. For example the prototype in the library TFT_eFX.h file might be:

void myGraphicsFunction(int32_t x, int32_t y, uint16_t color, TFT_eSprite *spr);

Then in the library TFT_eFX.cpp file the function would be:

void TFT_eFX::myGraphicsFunction(int32_t x, int32_t y, uint16_t color, TFT_eSprite *spr)
{
 // This is just an example that draws a 3x3 pixel block centered on x,y in a Sprite
 spr->fillRect(x-1, y-1, 3, 3, color);
}


The call in your sketch would then look like:

efx.myGraphicsFunction(10, 10, TFT_RED, &img);

where img is the Sprite class instance.

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Dec 24, 2018, 07:06 pm
Merry Christmas to everybody!! I hope you all can enjoy the free time with the ones you love or at least enjoy the free days. Or if your job doesn't allow you to be free, all the best wishes and a quiet ride.


Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Dec 25, 2018, 07:07 pm
Hi Bodmer,

I am trying to use your bitmap drawing function as a sprite and trying to store the function in TFT_eFX.
Using the drawbmp function just as is (substitute tft_-> for _tft->) inside TFT_eFX does compile but it's not showing anything on the screen (black screen) 

I can ofcourse copy the function in my code to work around that but what would I change to make it work inside Sprites? Since it relies already on buffers I am not so sure what to change.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Dec 26, 2018, 08:43 pm
@Mac_che

If you have a Github account then clone the TFT_eFX library, make your changes and push back to Github.

Then I can have a look at you code and hopefully identify where the problem lies!

Alternatively post a zip file here.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Dec 26, 2018, 11:29 pm
Works: TFT_eSPI >Generic>TFT_SPIFFS_BMP

Github:
https://github.com/Ierlandfan/TFT_eFX
Same code in eFX.. Does not compile.
https://github.com/Ierlandfan/TFT_eFX/blob/master/examples/TFT_eFX_Draw_Bitmap_from_SPIFFS.ino


Can you check it out?

Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Dec 27, 2018, 01:38 am
@Mac_che,

You need to include the namespace TFT_eFX:: in the cpp file before each function name:

void TFT_eFX::drawBMP(String filename, int16_t x, int16_t y) {



Note: soon there will be an update to the TFT_eSPI library that adds bounds checking and cropping to the Sprite pushImage() member function. This will be needed to allow bitmap files that would overlap the edges of the Sprite to be pushed, cropped and rendered correctly in a Sprite.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Dec 27, 2018, 05:45 pm
Hi Bodmer,

I missed that one in the copy/paste. I updated the library.
I meant to say that it says "file not found" on the serial with the (now compiling) code.
File is there since the TFT_SPIFFS_BMP works like a charm.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Dec 28, 2018, 12:05 pm
In the sketch you need to load FS.h and use SPIFFS.begin() in setup(). See original working sketch.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 09, 2019, 10:33 pm
Hi Bodmer,
very good library,
but I had to use adafruii,
because in the project with two displays on ESP32
could not find the solution in your library.
In adafruii I made so:
//display low
#define TFT_CLK 18  
#define TFT_MOSI 23  
#define TFT_CS     5
#define TFT_RST    0
#define TFT_DC    22
#define TFT_MISO  19
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
//display hi
Adafruit_ILI9341 tft_h = Adafruit_ILI9341(15, 2, 13, 14, 0, 12);
can as it is possible to repeat it in TFT_eSPI,
there is my video https://youtu.be/tELTZO0xmik
thanks.
excuse for my English
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Jan 10, 2019, 12:43 am
It is not possible to create two instances of the library with different pins due to the way the pins are defined in the setup file.

One option is to not defined TFT_CS at all in the setup file and to control each display chip select in the sketch, depending on which display you want to update.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Jan 10, 2019, 01:55 am
The TFT_eSPI library has been updated.

Sprites can now by pushed to the screen (or another Sprite) with a rotation angle. The new function is pushRotated(). Three new examples (Rotate_Sprite_1/2/3) have been added to show how the functions can be used to rotate text, images and to draw animated dials with moving needles.

As a lot of floating point calculations are involved, the ESP32 provides a much faster drawing speed.

(https://i.imgur.com/79z73po.png)

(https://i.imgur.com/6PwKAov.png)

(https://i.imgur.com/u9B6F3i.png)
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 10, 2019, 09:33 am
One option is to not defined TFT_CS at all in the setup file and to control each display chip select in the sketch, depending on which display you want to update.

thanks for prompt reply,
if it is possible write a small example,
and a question on ILI9481_Parallel.h, tft.setRotation,
correctly shows only a landscape 1.3 (equally, does not overturn)
the portrait (0.4) shows everything specularly,
it can be corrected?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Jan 11, 2019, 01:26 am
@krutoy1961

It looks like you do not have an ILI9481 display, maybe it is an ILI9486.

Post a web link to the display sellers page.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 11, 2019, 10:08 am
@krutoy1961


Post a web link to the display sellers page.

https://www.ebay.com/itm/3-5-inch-TFT-LCD-Touch-Screen-Display-Module-480X320-fr-Arduino-Mega-2560-UBS/372495625182?epid=8009037594&hash=item56ba782bde:g:CfYAAOSwg8taA-~N:rk:1:pf:0
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 11, 2019, 10:33 am
You have a regular Mcufriend Uno shield.    The clue is in the printed text on the pcb.

It looks as if it has the crap new pcb design without AMS1117 regulator.
So it probably takes massive current, overheats and destroys your Arduino's wimpy 3.3V regulator.

The Zero and Due have better 3.3V regulators but the pcb design is still crap.

MCUFRIEND_kbv library should detect the controller and perform everything correctly in software (until the hardware overheats and fails).

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 11, 2019, 10:57 am
MCUFRIEND_kbv library should detect the controller and perform everything correctly in software (until the hardware overheats and fails).

David.
David,
yes I noticed that esp32 is strongly heated,
at me directly the display is connected to a payment,
I will separately give 5v.
I have several projects on TFT_ESPI therefore it would not be desirable to involve one more library.
thanks for the hint.
Andrey.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 11, 2019, 11:27 am
If you are using the TTGO ESP32 board the 3.3V regulator should be reasonable.
The ESP32 draws a lot of current for the Wireless with or without a display.

I know that the RM68140 version of your shield draws a massive backlight current.
It would be interesting to know what ILI9481, ILI9486, ILI9488, ... versions are like.

I just use a cheap "USB charger ammeter" dongle in the USB cable.
Using a DMM is a better way to measure current.

If you don't have a DMM,   just plug the shield into a Uno.   Touch your wrist to the bottom of the screen.
Warm is ok.   Hot is BAD.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Jan 11, 2019, 11:47 am
According to the text it says touch, according to the screenshots it has a resistive display but I am missing the xpt2046 or touch IC in general, let alone the touch cs pin to drive it. Can you confirm yours has touch?
I like those screens (whith proper AMS1117 that is) buttmost of them are lacking touch.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 11, 2019, 12:35 pm
Go on.   There is a Mcufriend display with link from krutoy1961 in #251

Then we have a post from Mac_che about an unrelated display.
Please post a link or quote a message #.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Jan 11, 2019, 12:39 pm
Quote
https://www.ebay.com/itm/3-5-inch-TFT-LCD-Touch-Screen-Display-Module-480X320-fr-Arduino-Mega-2560-UBS/372495625182?epid=8009037594&hash=item56ba782bde:g:CfYAAOSwg8taA-~N:rk:1:pf:0
That's the screen we are talking about. Post #251.

Read the description: 3-5-inch-TFT-LCD-Touch-Screen-Display. Cannot make it clearer.


According to the text it says touch, according to the screenshots it has a resistive display but I am missing the xpt2046 or touch IC in general, let alone the touch cs pin to drive it. Can you confirm yours has touch?
I like those screens (whith proper AMS1117 that is) but most of them are lacking touch.

This is just to prevent a "touch screen is not working" question in a while.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 11, 2019, 01:31 pm
The Mcufriend Uno shields have a Touch panel.   Just look at the photos.

No,  there is no Touch Controller i.c.   It is just the bare resistive panel with the four XP, XM, YP, YM connections.

The TouchScreen library has to read the Resistive panel with the Arduino ADC.
It performs exactly the same tasks in software as the XPT2046 i.c. does in hardware.   i.e. apply voltages and read ADC.

The biggest problem is that Mcufriend make no attempt to restrict the backlight current and abuse the Arduino 3.3V regulator mercilessly.
The earlier Mcufriend pcbs were not perfect.    (100% fine with 3.3V GPIO but "worked" with 5V GPIO)
 
David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 11, 2019, 02:00 pm
Touch your wrist to the bottom of the screen.
Warm is ok.   Hot is BAD.

David.
esp32 the simplest for $4 with aliexpress,
the display is not heated, heated the stabilizer on esp32,
probably illumination loads, but this temporary solution only for testing
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 12, 2019, 10:23 am
MCUFRIEND_kbv library should detect the controller and perform everything correctly in software (until the hardware overheats and fails).

David.
David,
tried to start esp32 on MCUFRIEND_kbv,
the white screen (on UNO everything is normal),
everything rewrote pins as were on Tft_espi,
tried so:
#define LCD_RST 32
#define LCD_CS 33
#define LCD_RS 21

#define LCD_WR 22
#define LCD_RD 23

#define LCD_D0 13
#define LCD_D1 12
#define LCD_D2 14
#define LCD_D3 27
#define LCD_D4 26
#define LCD_D5 25
#define LCD_D6 2
#define LCD_D7 4

UTFTGLUE myGLCD(LCD_CS, LCD_RS, LCD_WR, LCD_RD, LCD_RST);
UTFTGLUE myGLCD(0x8357,LCD_CS, LCD_RS, LCD_WR, LCD_RD, LCD_RST);
UTFTGLUE myGLCD(0x9481,LCD_CS, LCD_RS, LCD_WR, LCD_RD, LCD_RST);

LCD_ID_readnew file
do not prompt where a mistake?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 12, 2019, 11:12 am
I strongly suggest that you use the TTGO wiring i.e.
from mcufriend_kbv/utility/mcufriend_shield.h
Code: [Select]

#elif defined(ESP32)       //regular UNO shield on TTGO D1 R32 (ESP32)
#define LCD_RD  2  //LED
#define LCD_WR  4
#define LCD_RS 15  //hard-wired to A2 (GPIO35)
#define LCD_CS 33  //hard-wired to A3 (GPIO34)
#define LCD_RST 32 //hard-wired to A4 (GPIO36)

#define LCD_D0 12
#define LCD_D1 13
#define LCD_D2 26
#define LCD_D3 25
#define LCD_D4 17
#define LCD_D5 16
#define LCD_D6 27
#define LCD_D7 14

Note that Bodmer and I use the same ESP32 wiring.    

Which controller do you have?
The RM68140 controller has slightly different timing to the Ilitek controllers.   The Beta should be fine.   The regular v2.9.8 Release might not be happy with RM68140

Note that your readreg report is returning rubbish.   So the defines that you quoted in your message obviously do not match your wiring.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Jan 12, 2019, 03:27 pm
It is possible to use the resistive only (i.e.no touch controller chip like XPT2046) screen with the mcufriend shields and ESP32 UNO style boards.

There is a modified touch library here (https://github.com/s60sc/Adafruit_TouchScreen), but I have not tried it myself.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 12, 2019, 04:56 pm
I strongly
Which controller do you have?
David,
inserted the display into UNO, works normally,
LCD_ID_readreg, copied in the file
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 12, 2019, 05:11 pm
Yes,  you have a Raydium RM68140
Code: [Select]

reg(0x00BF) FF FF 68 14 00 FF ILI9481, HX8357-B


As I said earlier,  there are timing problems with fast Arduinos e.g. Cortex-M3, Cortex-M4, ESP32, ...

Delete your current library installation directory and install the Beta from GitHub ZIP.

This particular shield takes a massive backlight current.   The panel will feel very warm.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 12, 2019, 08:12 pm
Delete your current library installation directory and install the Beta from GitHub ZIP.
David, perhaps I do something not so,
established Beta,
but at me is not present in arduino ide TTGO I choose Esp32 dev,
(too tried others, ESP32 is costed by the last), opened LCD_ID_readreg.ino
but the compiler does not use mcufriend_shield.h (I renamed the file).
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 13, 2019, 12:15 pm
It is always wise to start with the recommended wiring and library examples.

If you can not get the examples working there is little point in you inventing your own versions.

You will find that Authors will be keen to help with any problem that is due to their library code or example.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Jan 13, 2019, 09:57 pm
I came across this site  (https://blog.squix.org/2017/01/esp8266-planespotter-color.html)recently and have been impressed at what a ESP8266 based NodeMCU can be persuaded to do.

The sketch set uses a WiFi Locator to work out your location and download a jpeg map off the internet (e.g. Google maps).  It then checks what planes are in the area and plots their location on the map, with info displayed on the nearest plane.  How cool is that!

I have forked the project here (https://github.com/Bodmer/esp8266-plane-spotter-color) and adapted it to be compatible with the latest TFT_ILI9341_ESP library (https://github.com/Bodmer/TFT_ILI9341_ESP) and the latest JPEGDecoder library (https://github.com/Bodmer/JPEGDecoder).

So, if you have the TFT_ILI9341_ESP library running with a display it should be straightforward to download the entire project sketch folder and get it up and running.



Hi Bodmer!
Have your sketches here that were made with the TFT_ILI9341_ESP library also work with the ILI9488 library for 3.5 Inch (320x480) screens? I say this because, for example, your "esp8266-plane-spotter-color" project would of course be better viewed on a larger screen (such as https://www.ebay.com/itm/3-5-inch-TFT-LCD-Touch-Screen-Display-Module-480X320-fr-Arduino-Mega-2560-UBS/372495625182), just as your "esp8266 Weather Station Color" project and your other projects could also benefit with screens larger than 320x240.
Hugs from Brazil
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Jan 14, 2019, 01:37 am
Try the attached version. It is not perfect (some text position issues) but it should work OK. It is for a 480x320 screen.

Bodmer
It can be with this screen and esp8266 (Nodemcu): https://www.ebay.com/itm/3-5-inch-TFT-LCD-Touch-Screen-Display-Module-480X320-fr-Arduino-Mega-2560-UBS/372495625182
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Jan 14, 2019, 10:21 am
@Dancopy
The link you provide is for an 8 bit parallel display, the TFT_eSPI library only supports displays of this type when using an ESP32.

The eBay advert indicates that one of many controllers could be fitted and thus you may end up getting a screen that is incompatible with the current version of the library.

I do not have any plans at the moment to migrate the Plane Spotter or weather sketches to a 320x480 display. In principle you could do this yourself. The plane and weather sketches that exist will run with a 320x480 display, they just won't fill it and the icons etc may end up looking smaller due to a smaller pixel size.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 14, 2019, 01:54 pm
It is always wise to start with the recommended wiring and library examples.

David.
David,
thanks for the help,
your library perfectly works with UNO and MEGA,
if there is no such display on hands of course difficult to help,
once again thanks.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 14, 2019, 02:06 pm
Bodmer
It can be with this screen and esp8266 (Nodemcu): https://www.ebay.com/itm/3-5-inch-TFT-LCD-Touch-Screen-Display-Module-480X320-fr-Arduino-Mega-2560-UBS/372495625182
I have the same display, it normally works,
the truth only in one orientation,
here I did small video
https://youtu.be/56BZ-v4ings
there are 3.5 more display it blue color,
it has problems about the image bmp and jpg
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 14, 2019, 02:33 pm
It is quite straightforward.   You connect your Mcufriend Uno shield to ESP32 according to my (and Bodmer's) wiring plan.

You run all the examples.   They should work.

Do this first.   Show evidence.
Connect your custom wiring.   Show evidence from LCD_ID_readreg.

Then I (or Bodmer) will show you how to adapt the respective libraries.

Seriously.   The TTGO board is cheap.   It is easy to do the hardware mod.   The Shield plugs in and goes.

David.

Edit.   Just looked at your video.   You must be using Bodmer's TFT_eSPI library and the wiring is correct.
Which means that you can run MCUFRIEND_kbv examples straight out of the box.
This will tell you whether you really have an ILI9481 or some other controller.

I support more controllers than Bodmer.   But quite honestly,  ILI9481 and ILI9486 are the most common controllers.   Bodmer supports both.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Jan 14, 2019, 06:06 pm
@Dancopy
The link you provide is for an 8 bit parallel display, the TFT_eSPI library only supports displays of this type when using an ESP32.

The eBay advert indicates that one of many controllers could be fitted and thus you may end up getting a screen that is incompatible with the current version of the library.

I do not have any plans at the moment to migrate the Plane Spotter or weather sketches to a 320x480 display. In principle you could do this yourself. The plane and weather sketches that exist will run with a 320x480 display, they just won't fill it and the icons etc may end up looking smaller due to a smaller pixel size.
Hi Bodmer!
What is the maximum display size for esp8266 or Uno that your library supports and with which driver (without or with shield and touch);
I would like to use a larger display for Plane Spotter and Weather;
Thank you
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 14, 2019, 07:44 pm
Just looked at your video.  
David,
on TFT_ESPI only ILI9481 showed correctly (on other controllers or colors or the sizes were incorrectly),
I just took and wrote down all pins in mcufriend_shield.h,
compiled on ESP32 dev (as on TFT_ESPI),
also it did not turn out,
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 14, 2019, 08:27 pm
Bodmer does not provide a readID() method.   
But since you have a Mcufriend Uno shield,  you can just plug it into a Uno and see what MCUFRIEND_kbv says.

It is a very bad idea (tm) to guess the controller.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 14, 2019, 08:45 pm
It is a very bad idea (tm) to guess the controller.

David.
David I have 2 displays 3.5 320_480 for UNO
both perfectly work with your library
red
https://www.ebay.com/itm/3-5-inch-TFT-LCD-Touch-Screen-Display-Module-480X320-fr-Arduino-Mega-2560-UBS/372495625182?epid=8009037594&hash=item56ba782bde:g:CfYAAOSwg8taA-~N:rk:1:pf:0
reg(0x00BF) FF FF 68 14 00 FF ILI9481, HX8357-B
blue
reg(0x00BF) 00 02 04 94 81 FF ILI9481, HX8357-B
https://www.ebay.com/itm/3-5-TFT-Touch-LCD-Screen-Module-480x320-for-Arduino-Mega2560-Board/302900181082?epid=25024242244&hash=item468641f85a:g:oD4AAOSwaG1brJ6n:rk:12:pf:0
but unfortunately were not started on ESP
, once again thanks for the help
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Jan 14, 2019, 09:05 pm
The Red board has a Raydium RM68140.   It is not supported by Bodmer.
The Blue board has an Ilitek ILI9481.   It should work 100% with Bodmer's TFT_eSPI library.

There are considerable differences between the two controllers.
RM68140 is nearer to ILI9486 but the MADCTL register behaves differently.   (rotations will not behave)

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: krutoy1961 on Jan 15, 2019, 03:55 pm
The Red board has a Raydium RM68140.   It is not supported by Bodmer.
The Blue board has an Ilitek ILI9481.   It should work 100% with Bodmer's TFT_eSPI library.

There are considerable differences between the two controllers.
RM68140 is nearer to ILI9486 but the MADCTL register behaves differently.   (rotations will not behave)

David.
David,
understood,
thanks
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: eberhardpohl on Jan 25, 2019, 01:24 pm
Ich habe ein https://eckstein-shop.de/Waveshare-4-inch-480x320-Resistive-Touch-TFT-LCD-Shield-Arduino-Display-ILI9486-SPI 480x320 4" TFT mit ILI9486 direkt an einem ESP12 mit der TFT_eSPI Library.
Das läuft leider überhaupt nicht.Habe schon Stunden damit zugebracht.
Kann mir jemand die richtigen Verkabelung beschreiben bzw. welche Einstellungen im Setup zu beachten sind.
Habe nach Vorgabe eigentlich richtig verkabelt.

Gruß aus Harztor
Eberhard

I have a https://eckstein-shop.de/Waveshare-4-inch-480x320-Resistive-Touch-TFT-LCD-Shield-Arduino-Display-ILI9486-SPI 480x320 4" TFT mit ILI9486 directly connected with an ESP12 with the TFT_eSPI Library. It doesn`t work. I`ve tried so many things. Can somebody give me the correct pin-connection between the display and ESP12.
In the User_Setup i call up the driver file    #define ILI9486_DRIVER, but in the User_Select_Setup i found only  #include <User_Setups/Setup5_RPi_ILI9486.h>  or  #include <User_Setups/Setup10_RPi_touch_ILI9486.h>    but no Setup like <User_Setups/Setupxx_ILI9486.h>.
What`s wrong ?

Regards from Harztor (Germany)
Eberhard
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Feb 08, 2019, 08:09 pm
Note sure what an ESP12 is, please elaborate.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Feb 08, 2019, 08:22 pm
I have updated the TFT_eSPI library so that Adafruit_GFX compatible custom fonts with characters in the range 32-255 can be used.

(https://i.imgur.com/tGh8rzv.png)

Note that the later versions of the Arduino IDE encode special characters like the accented ones above as UTF-8. So I have added a UTF-8 decoder to the font rendering functions.

A new example (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Generic/Local_Custom_Fonts) has been added, this references a YouTube tutorial for producing the new font files.

The command line for generating a 24 point high font was:
Code: [Select]

fontconvert C:\Windows\Fonts\arialbd.ttf 24 32 255 > arial_black_32.h


Note the code range is 32 - 255. Most online Adafruit_GFX font generators only encode the character range 32-127. This is because the Adafruit_GFX library as currently written does not handle the required UTF-8 decoding to be compatible with the way the IDE encodes strings.

Only the latest versions of the IDE encode the strings as UTF-8.

For characters outside of the range 32-255 the TFT_eSPI library anti-aliased font capability must be used.


New font files can be attached directly to the sketch, see library example.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 10, 2019, 02:28 pm
Hello bodmer. Whether your library can be used for display WAVESHARE 3.5inch RPi LCD (B), 480x320, IPS V2.0
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Feb 11, 2019, 01:02 am
@homer2009

I do not have one of those displays so cannot say whether it will work.

The display I have tested is this one (https://github.com/Bodmer/TFT_eSPI/blob/master/Tools/RPi_TFT_Connections.png) which is ILI9486 based and a cheap Chinese board. This appears to use a Waveshare circuit design.

Due to the large number of variants of these Raspi displays it would be a better option to stick with a standard SPI based display.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 16, 2019, 11:13 am
I started the waveshare display but I have such a picture. Which may be the reason https://www.fotosik.pl/zdjecie/usun/giRSnaCIThgthJS_KX00KWTJVKKFFS
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Feb 16, 2019, 11:24 am
Call tft.invertDisplay(1);
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 16, 2019, 07:14 pm
He did it when you wrote and I received such a picture of me in the first picture. On the second photo is the initial image. And on the third one as it should be. What can be wrong
https://www.fotosik.pl/zdjecie/usun/P1CxX_pfSbU41Qv_qwat0WQ5PdZQDJ
https://www.fotosik.pl/zdjecie/usun/6CiUYWRECqOdeeTouIcDu~MZ3lF58S
https://www.fotosik.pl/zdjecie/usun/37bOBx8BgJ8Ew~mnI65cb4SQzBn5lO
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Feb 16, 2019, 08:11 pm
I explained.  You should call invertDisplay()
Inverted colours mean:
BLACK shows WHITE
GREEN shows MAGENTA
RED shows as CYAN
BLUE shows as YELLOW

That is why your picture looks strange.

All TFT controllers can render both types of TFT panel.   It is a standard MIPI command.   But you can also configure the panel characteristics via Manufacturer registers.    It is a single bit in one of the registers.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 17, 2019, 10:47 am
how to do it
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Feb 17, 2019, 11:11 am
In setup()
Code: [Select]

    tft.begin();
    tft.invertDisplay(1);


Bodmer has no control over which hardware display that you buy.
He can only test on his own display(s)

If my suggestion solves your problem,   please say.    Then Bodmer or I can show you how to edit the library to suit your display.    But it would make every other owner's display fail.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 17, 2019, 12:40 pm

I typed these commands into the setup. The colors are not correct. Please show me how to edit the library to match my display
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Feb 17, 2019, 01:21 pm
In which case please try:
Code: [Select]

    tft.begin();
    tft.invertDisplay(0);


Have you configured "User_Setup_Select.h" or "User_Setup.h" in TFT_eSPI correctly?
The current TFT_eSPI library on GitHub is version v1.4.5 which was released 2 days ago.

What version are you using?
The Library Manager will tell you.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 17, 2019, 02:23 pm

It did not improve. I have versions 1.45
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Feb 17, 2019, 02:34 pm
Please run the examples that come with the library.

Then report any problems.

Bodmer does not have your display.   He probably would like feedback for your Waveshare display.

If the colours work correctly in Bodmer's examples post your code.

David.

I do not have your display.   Personally,  I have NO interest in the "shift register abortion" that is used in this Waveshare display.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 17, 2019, 04:27 pm
david_prentice Thank you for your help
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Feb 17, 2019, 11:38 pm
Thanks David for helping on this one.

I have added a new colour test example here (https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Test%20and%20diagnostics/Colour_Test).

Correct output is:

(https://i.imgur.com/kqSeNLn.png)
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 18, 2019, 06:35 pm
bodmer My display is like on the pictures
https://www.fotosik.pl/zdjecie/usun/IBQcyynyOwywjUPimtH1xxZsaeFFJ4
https://www.fotosik.pl/zdjecie/usun/TPsyxH0nlDzqgCpc92dIDQ6C6ya_Em.
You can help me somehow
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Feb 18, 2019, 09:24 pm
Run the "Read_User_Setup" and post the results copied from the Serial Monitor window.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Feb 19, 2019, 01:54 am
@homer2009

I see an identical issue has been raised on Github.

A recent change to TFT_eSPI has shown u a bug in the ESP8266 core library. I have added a work-around (https://github.com/Bodmer/TFT_eSPI/blob/master/TFT_eSPI.cpp#L2791-L2792) in the Github version of the TFT_eSPI library here.  Let me know if that fixes the problem for you.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 19, 2019, 05:36 pm
Bodmer Now I have yes
https://www.fotosik.pl/zdjecie/usun/KhLYArKbyxfZiR4ias8s8_Ioyrv1cl
https://www.fotosik.pl/zdjecie/usun/bpnpnvOuhoOQ2C~~WcAE5aSM9IqhYa
https://www.fotosik.pl/zdjecie/usun/fEuaRNGofzB2Q~JEuQ_4e4C4khlP_X
https://www.fotosik.pl/zdjecie/usun/fV0DW7kD5ePh9IDslAqz92xQ1MXeXI
Results  from the Serial Monitor:
 
Code: [Select]

17:21:38.578 -> TFT_eSPI ver = 1.4.5
17:21:38.578 -> Processor    = ESP8266
17:21:38.578 -> Frequency    = 80 MHz
17:21:38.578 -> Voltage      = 3.15 V
17:21:38.578 -> Transactions = No
17:21:38.578 -> Interface    = SPI
17:21:38.578 -> SPI overlap  = No
17:21:38.578 ->
17:21:38.578 -> Display driver = 9486
17:21:38.578 -> Display width  = 320
17:21:38.610 -> Display height = 480
17:21:38.610 ->
17:21:38.610 -> TFT_CS   = D8 (GPIO 15)
17:21:38.610 -> TFT_DC   = D3 (GPIO 0)
17:21:38.610 -> TFT_RST  = D4 (GPIO 2)
17:21:38.610 ->
17:21:38.610 -> Font GLCD   loaded
17:21:38.610 -> Font 2      loaded
17:21:38.610 -> Font 4      loaded
17:21:38.610 -> Font 6      loaded
17:21:38.610 -> Font 7      loaded
17:21:38.610 -> Font 8      loaded
17:21:38.610 -> Smooth font enabled
17:21:38.610 ->
17:21:38.610 -> Display SPI frequency = 15.0 MHz
17:21:38.610 ->
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Feb 19, 2019, 11:50 pm
OK, so you need to add:
Code: [Select]

#define TFT_INVERSION_ON

to the setup file. This corrects the display black/white swap. The examples should then run with the correct colours.

If you see colours in images (jpegs etc) are wrong then you need to add:
Code: [Select]

tft.setSwapBytes(true);

to your sketch. This corrects for the endianess of the byte order.



Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bfksoql on Feb 20, 2019, 06:18 pm
Hello,
I`m also fight with same display. tft.invertDisplay(true) makes all examples work ok :-)
I need to change

#define SPI_FREQUENCY  20000000

to 10000000

and I think this is main homer2009 problem.

But drawJpeg from TFT_eFEX draw bad colors from jpeg :-( Colors are near the truth colors but not the same. Bright red is yellow, darker red is something like magna.

tft.setSwapBytes(true);



Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 20, 2019, 07:00 pm
Thanks for the answer. Tomorrow I will check and let me know if the display works well
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Feb 20, 2019, 09:52 pm
@bfksoql
It sounds like you have a different drive chip in your display and the colour settings loaded during init are not compatible with it.  This is also indicated by the need for the inversion which is not necessary on my ILI9486 based display. Do the rotations look OK on the graphics test?
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: homer2009 on Feb 21, 2019, 05:52 pm
Hello Bodmer.An oath of examples(coulor_test)they work properly.
Example TFT_flash_jpg proceeds incorrectly.
Next it displays bad colors
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Feb 22, 2019, 11:44 am
As your display has a different colour setup try using:

tft.setSwapBytes(true);

and if that does not work try:

tft.setSwapBytes(false);

One of these lines may need to be added in setup() of each sketch if you are handling images in the sketch. This swaps the colour bytes.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on Feb 22, 2019, 12:25 pm
1. If the colours have been corrected by TFT_INVERSION_ON everything else should work.

2. The JPEG programs should read the JPEG file in the byte order on disk and calculate the pixel colours.

3.  Since the pixel colours were fixed in (1),   the JPEG image should be correct.

Most Arduino targets are little-endian
TFT controllers are big-endian.   

If a "raw" image is dumped from TFT Graphics Memory it will read pixels as RGBRGBRGB... on most controllers.
Other controllers will read as 16-bit pixels (5-6-5 format) as HLHLHL... i.e. big-endian

The TFT_eSPI library will know what to do with any published image format like .BMP or .JPG

The byte-order problem will only arise with "RAW" byte dump images.
They might be stored in HLHL... order or in LHLH... order.
Hence you might need to use the setSwapBytes() feature

I do not own any "shift register style" displays.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: 877 on Feb 23, 2019, 12:43 pm
@bodmer I just found your Dark Sky library after searching for an OWM alternative.

I just wanted to say a big thanks for your work!! :)


Also, I only have 128x128 TFT at the moment so have not used your TFT_eSPI library, but I have some larger displays on the way :)
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on Mar 09, 2019, 02:16 am
My appreciation to the excellent works of the Arduino masters such as david_prentice and others here and especially to Master Bodmer. I like a lot of images in tft display like this 'ESP8266_draw_565_image2' but, I also like scrolling text on display, so I wonder if Bodmer or anyone made available here some sketch for Arduino or espodel for text scrolling, vertical in color? Thank you all
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Mac_che on Mar 14, 2019, 09:03 pm
General question related to do touch implementation:

I have some code that reads a physical switch which I want to change to a touch area. It's based on a state machine style coding. (Forgot to mention it's M5Stack-MultiApp-Advanced which display is using the TFT_eSPI driver)

I have an idea about the code but need some pointers if I am on the right track.
Somewhere along the line of this:


Code: [Select]


//define touchArea for button 1
u_int 16 OnScreenBtnP.X = 100
u_int 16 OnScreenBtnP.X1 = 160
u_int16  OnScreenBtnP.Y = 80
u_int16  OnScreenBtnP.Y1 = 140

/*----------------------------------------------------------------------*
* read() returns the state of the on-screen touch button, 1==pressed, 0==released, missed etc.   *
*----------------------------------------------------------------------*/

uint8_t Button::read(void)
{
   
    if (touchController.isTouched(500) && millis() - lastTouchMillis > 1000) {
        TS_Point p = touchController.getPoint();
        lastTouchPoint = p;
        lastTouchMillis = millis();
        if (p.y = > OnScreenBtnP.Y and < OnScreenBtnP.Y1) {
          if (p.x = > OnScreenBtnP.X and < OnScreenBtnP.Y1) {
       _state = 1 // Consider virtual button button1 pressed
}       
 return _state;
    }
    else {
   
            _state = 0; //missed, released, not pressed or wrong area, consider state 0
        }
        return _state;
    }
}

}
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 19, 2019, 09:06 pm
@Dancopy: have a look at the "TFT_Terminal" example. Hardware based scrolling is available in portrait orientation only for full width of screen. For small scrolling areas see Sprite scroll examples.

@Mac_che: see "On_Off_Button" example.


Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: SyedUbaid on Mar 21, 2019, 07:43 am
How to interface 3.2" UTFT ILI9481 with NodeMCU  ???? Kindly Help
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: bodmer on Mar 21, 2019, 10:52 am
Connection details are in the User_Setup.h file.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on May 27, 2019, 11:26 pm
Taking advantage of the opportunity, I would like to suggest to Master Bodmer to adapt his 2 "Digital and Analog Clock" sketches from his old library with his current TFT_eSPI library to a 3.5" ILI9488 display with ESP32 or ESP8266; Thanks
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on May 27, 2019, 11:57 pm
Go on.   There is already a TFT_Clock and TFT_Clock_Digital example for 320x240 and for 160x128.

Surely you can adjust the maths to suit 480x320 or any arbitrary shape or size screen.
Examples are designed to illustrate the methods, show possibilities and give you ideas.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: Dancopy on May 29, 2019, 02:49 am
Thank you David, I'll try!
Although the example comes 'raw'; I'll have to use some RTC to get the time.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: david_prentice on May 29, 2019, 09:20 am
You can test the "look and feel" of a clock by using the Arduino internal system timer e.g. millis()

Replace this with an external RTC after you have the display looking like you want.

Explain in English what you want to do.  e.g. clockface in different location, size, colours, or style.

Readers can only help you with coding when they know what you actually want.

David.
Title: Re: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays
Post by: thasan10 on Jun 10, 2019, 01:14 am
Hi all,

Quite new to Arduino. I think I have a NodeMCU ESP8266 board and a mcufrield.com 3.5" display.

If someone can help out with the connections between the two, it will be greatly appreciated. I am assuming the TFT-eSPI is the correct library but without proper connection, I am sure my display won't work.

Any help will be greatly appreciated.