Adafruit_GFX and Adafruit_ST7735.h, for Arduino Nano Every or ESP32 - smaller library

This is my first topic post, so I hope that I did this correctly and by the rules.
I'm not sure how to word it perfectly.

While I have a bunch of ST7735 based displays, I pretty much stay away from using them, due to library size.

So I'm wondering if there's a library that is more basic (letters/numbers some symbols) available. I've been searching a lot and can't really find one.

The issue I have with these Libraries for these displays is that they take up so much memory that there's not a lot of space for the sketch.

I've even taken one of the examples and stripped it down a lot just to test.

Yet, when compiled on an Arduino Nano, it takes up 67% of program space!
That leaves only about 10% for a sketch until you hit the bug at around 75% or so that starts causing glitches on the Nano.

So then, I tested on a Nano Every board and even there, the same tiny test sketch takes up a whopping 49% !

Next test is on an ESP32 WROOM DA Module (I have a bunch), the same small test uses up 21% of program space.

So years ago, I did find a tiny version of a library that worked with the ST7735 displays, which didn't chew up program space.

But I can't find it now and it wouldn't work with the Nano Every or ESP32 anyway.

I haven't done any work with modifying libraries, so that idea is out.

I won't bother posting the test sketch, because anyone using these libraries already have it on the "Examples" list.

Ideas?

p.s. (If I didn't do this right, please let me know and I'll delete it).

Thanks

The ESP32 program memory is several times larger than that of the Nano Every, so percentage measurement is hardly a useful comparison.

The Every is a poor choice for a project with a graphics display.

Yes, ESP32 prog mem is much MUCH bigger. That's why, 21% is HUGE for just a library.

The every has more memory than the basic Nano, which is why I went to Every boards before ESP32 boards. And still, 49% of mem used just for this over-bloated library is also not great.

I was hoping to find a "stripped down" version of these libraries that got rid of all the graphics stuff and just had numbers, letters and usual symbols, like * - / & etc).

My way around this has been to use Nextion displays WITHOUT libraries.
Fortunately, this works perfectly on all 3 boards.

The only problem is, for some projects, like this one, the Nextions are a bit overkill. But, I may have to just use one anyway.

So, to sum up, just HOPING that someone knows of a stripped down version of the Adafruit libraries that do work with the 3 boards.

Oh well.

If your application program fits into remaining program memory, there is no problem.

ROFL
If my sketch would fit when using this library, then I would not have made my original post!

I'm hoping that someone with constructive information replies, who perhaps knows of a stripped down version of the libs mentioned.

Maybe I don't have this exactly right, but I believe a library uses only as much memory as the functions you use require - fewer functions employed, less memory. Just text is one thing, text and graphics are more.

GitHub - Bodmer/TFT_ST7735: Arduino graphics library for ST7735 displays with propotional fonts

Ah! I was not aware of that. I'll re-run my test after removing all the draw/graphics calls and only use text.
That being said, I know that another thing that increases memory use a lot is calling the black screen and colors. But those I need.

I'll test with zero graphics.

If that makes little diff., I'll just toss this idea of using these displays and sticking with the Nextion.
I love Nextion as libraries are not needed.

Thanks for that tip! I really appreciate it.

Nextions cost a lot more because they have a microcontroller built into them already. If you took a ST7735 and your Every as a package and communicate with serial that would be about the same thing, just handing everything off to a peripheral controller to work out.

Yes, Nextions have gone crazy with price now.

Fortunately, before the price increases, I bought a whole bunch of them. I have some 7" Enhanced, some basic, and other sizes in Enhanced and basic.

The thing is, I hate using them in an area that will be cold and humid.
But, that's what I'll have to do.

So what do you mean use the St7735 and Every as a "package" and use serial?

I have no clue how to even do that.

Can you post a link to where I find out how to do that?

With a TFT and a "dedicated" ProMini or something - it's not going to do with pushbuttons and servos and all the other stuff. It's just waiting for commands over Serial (or SPI or whatever). Because that's what a nextion has in it - a peripheral controller - whereas without that it's all up to "the Arduino" to do everything.

Why not supply some useful information about your actual project, and explain why it is so big that it won't fit into ESP32 program memory with that comparatively small graphics library?

The project is immaterial as obtaining a smaller library would be for any project, larger or smaller.

My only query is if anyone knows of a smaller footprint of the library in question.

The projects are not important in this case!

Either there's a smaller lib or there's not. Simple!

@BlondieSL you don't really need a library to initialize the ST7735 display you can do that with ~40 lines of code then code whichever functions you need for your application.

Do a google for st7735 driver, I found one with a search that covered all tab variants a couple of years ago. The one I use I trimmed down even more for use solely with the black tab variant.

I think you mentioned the Nano ESP32, that device should have more than enough memory for most applications especially with PS ram enabled. I was able to port the driver over to micro python and use a full screen frame buffer with plenty of room to spare

Thanks. I'll look into that for the Nano and Nano Every.
The ESP32 boards I use are not the Nano version.
These are ESP32 WROOM dev boards.

There is enough memory, of course, it just bugs me that a simple display library, even on that ESP32 takes up 21%. That's just overkill.

At any rate, I've been working on the proj. all afternoon.
To save time, I'm just using a Nextion display.

There's zero overhead as there's no lib needed.

Works a wonder.

Did you ever take a look at the memory used by one of the minimal examples, e.g. blink, on ESP32?
The ESP32 package takes quite a big overhead.

Using over 75% of PROGRAM memory should not cause glitches of any kind, unless you have a modified bootloader that allows writing to flash memory at run-time. Are you referring to dynamic memory (ram)?

Hi David:
Actually, years ago, when I first noticed that "things would go wrong" on a Nano, I did some research about it and found that indeed there's a known bug(s) that can cause "glitching" over 75%. Soemtimes no. I have one that is running just fine and it's 87%.

But before, I had some Nanos that due to using those tiny, but adorable little 0.98" Color displays, also using the overly large libraries, or at that time, using Nextion and using their bloated libraries, would sometimes glitch out. I use the word glitch, but like you say, it's obviously something overwriting flash.

I'm trying to recall and example, but this was a long time ago, which is why, at that time, I searched for better libraries that are smaller. I did in fact find one, but be danged if I can find it on my system now. LOL

That's actually why, now, ALL my projects, on start up, send me the date/time as well as path/filename of where it came from. LOL

This is also when I learned how to use Nextion displays without their libraries. What a difference.

Perhaps part of that over 75% (ish) glitch thing, might be that these boards are all Chinesium knockoffs. I probably only have 2 or 3 actual Arduino boards.

Either way, not an issue in this situation. I've already started this project and I'm using a Nextion. I may also decide, at the last minute, to use an ESP32 so that it can report what's going on inside the greenhouse.... like heater failure, fan failure or something like that.

But anyway, yes, David, I have confirmed this glitchy thing and it is consistent (ish).

I'll ask again, are you referring to 75% of program (flash) memory, or 75% of dynamic (ram) memory?

Hiya Silent.
I did long ago, but honestly, totally forgot about that.

I just ran a NOTHING test. LOL Literally, just void setup() {} and void loop() {} with nothing inside.

It's true, just that and no code at all, still took up 17% (227,065 bytes).

So now, looking at that 21% with the TFT, isn't so bad after all.

Thanks for reminding me of that!