Go Down

Topic: Graphics library for NodeMCU (ESP8266), ESP32 and SPI based TFT displays (Read 24048 times) previous topic - next topic

bodmer

Formerly Rowboteer (now a broken user profile!)

bodmer

There is a really cool font converter here 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.


Formerly Rowboteer (now a broken user profile!)

Stan_S

Have you considered doing a sketch with this display to get weather from the web?

bodmer

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.
Formerly Rowboteer (now a broken user profile!)

bodmer

I came across this site 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 and adapted it to be compatible with the latest TFT_ILI9341_ESP library and the latest JPEGDecoder library.

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.


Formerly Rowboteer (now a broken user profile!)

Stan_S

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

Stan_S

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


bodmer

@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.
Formerly Rowboteer (now a broken user profile!)

Stan_S

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

bodmer

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.
Formerly Rowboteer (now a broken user profile!)

bodmer

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 then it should all be working OK now.

Report back if you are still having problems.
Formerly Rowboteer (now a broken user profile!)

bperrybap

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

bodmer

@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.  :)
Formerly Rowboteer (now a broken user profile!)

Stan_S

It works!!! :-)

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

Regards,
Stan

bodmer

Hi Stan,

I have have put s fork of the Squix weather station code here. This is a big multi-file sketch.

You will also need this library 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.
Formerly Rowboteer (now a broken user profile!)

Go Up