Coder Social home page Coder Social logo

Comments (18)

takkaO avatar takkaO commented on June 12, 2024

Hi @buckfast-beekeeper .
Thank you for using this library ๐Ÿ˜„

I need more information to solve the problem.

  • What microcontroller are you using?
  • What development environment and version are you using?
  • Is your program black out? crash and reboot?
  • What is the output to the serial monitor?
  • Have you checked that TFT_eSPI works by itself, i.e., that the drawPixel and drawFastHLine functions work correctly?

Thank you.

from openfontrender.

buckfast-beekeeper avatar buckfast-beekeeper commented on June 12, 2024

Many thanks for your time and librarie.

I use an ESP8266 Wemos 1 Pro.
Arduino IDE 1.8.19 but I can try IDI 2.0.
tft.fillScreen(TFT_WHITE);
Is the last thing that is executed. No reboot,
On the serial monitor nothings happens.
TFT_eSPI works fine. If I take the examples/480 x 320/Demo_3D_Cube or TFT_rainbow480, they works like excepted.

I have try the littleFS examples with .vlw fonts, they worked too.

from openfontrender.

buckfast-beekeeper avatar buckfast-beekeeper commented on June 12, 2024

Update: The program works great with ESP32 DEV board and ILI9486 AND with ILI9341

It seems the problem is with the ESP8266.

from openfontrender.

martinberlin avatar martinberlin commented on June 12, 2024

I would check how much free heap there is. It's ages I don't program one, but I think have some in the deep of my drawer, what I don't have is an ILI9486...But just tell me if I can help debugging something

from openfontrender.

takkaO avatar takkaO commented on June 12, 2024

I don't know if this will solve the problem, but try to add the following code at the beginning of the setup function.

void setup() {
    ...
    render.setSerial(Serial);    // Call after Serial.begin()
    render.setDebugLevel(OFR_DEBUG);    // optional
    ...
}

Then check the serial output.

from openfontrender.

buckfast-beekeeper avatar buckfast-beekeeper commented on June 12, 2024

This is the font setup:

void setupFont() {
  Serial.println("Setup Font");

  ofr.setSerial(Serial);    // Need to print render library message
  ofr.setDebugLevel(OFR_DEBUG);    // optional
  //ofr.showFreeTypeVersion(); // print FreeType version
  //ofr.showCredit();
  ofr.setDrawer(tft);// Link drawing object to tft instance (so font will be rendered on TFT)
  ofr.setFontColor(textColor, backColor);

  //ofr.loadFont(TTF_FONT, sizeof(TTF_FONT));
  if (ofr.loadFont(TTF_FONT, sizeof(TTF_FONT))) {
    Serial.println("Initialise error");
    return;
  }
  ofr.setCursor(10, 200);
  ofr.setFontSize(100);
  tft.println("zon 27 nov 2022");
  ofr.setFontColor(textColor, backColor);
  ofr.cprintf("Hello World\n");
  ofr.seekCursor(0, 10);

  Serial.println("Setup Font OK");
}

This is the Serial output/

10:36:29.374 -> Setup OLED
10:36:30.901 -> Setup Font
10:36:30.901 -> Setup Font OK

After compiling this is the message in the arduino

Bibliotheek TFT_eSPI op versie 2.4.79 in map: E:\Arduino\libraries\TFT_eSPI  wordt gebruikt
Bibliotheek SPI op versie 1.0 in map: C:\Users\gebruiker\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\SPI  wordt gebruikt
Bibliotheek OpenFontRender-master op versie 1.0.0 in map: E:\Arduino\libraries\OpenFontRender-master  wordt gebruikt
De schets gebruikt 414289 bytes (39%)  programma-opslagruimte. Maximum is 1044464 bytes.
Globale variabelen gebruiken 40208 bytes (49%) van het dynamisch geheugen. Resteren 41712 bytes voor lokale variabelen. Maximum is 81920 bytes.
Serial port COM24
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 40:91:51:51:01:3a
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 418448 bytes to 300178...

from openfontrender.

takkaO avatar takkaO commented on June 12, 2024

Still having problems with display?

Sorry, I missed the debugLevel argument ๐Ÿ™‡โ€โ™‚๏ธ.
Please re-try below.

ofr.setDebugLevel(OFR_DEBUG | OFR_INFO | OFR_ERROR);

from openfontrender.

buckfast-beekeeper avatar buckfast-beekeeper commented on June 12, 2024
11:01:54.118 -> Setup Font
11:01:54.118 -> [OFR INFO] Font load required. FaceId: 0x0x3fff13ac
11:01:54.164 -> [OFR INFO] Load from memory.
11:01:54.164 -> [OFR INFO] Font load Success!
11:01:54.164 -> [OFR ERROR] FTC_ImageCache_Lookup error: 0x82
11:01:54.211 -> Setup Font OK

from openfontrender.

takkaO avatar takkaO commented on June 12, 2024

Great ! ๐ŸŽ‰
We've succeeded in finding a source of the problem!

According to the FreeType site, error code 0x82 mean a stack overflow error.

from openfontrender.

buckfast-beekeeper avatar buckfast-beekeeper commented on June 12, 2024

With a Lolin Wemos D1 pro with 16MB flash, same error.

from openfontrender.

martinberlin avatar martinberlin commented on June 12, 2024

Can you check how much Heap RAM left there is exactly before this error?
It might be that ESP8266 has not enough resources at that moment to execute that operation, or I'm thinking in the wrong direction?

from openfontrender.

takkaO avatar takkaO commented on June 12, 2024

I think 16MB mean Flash memory size.
But what we need is RAM size.

According to my lightly researched information, ESP8266 have about 50 kB RAM.
The ESP32 has about 520 kB, the WioTerminal about 192 kB, and the RP2040 about 264 kB of RAM.

Adding an external SRAM to the ESP8266 might work.
(But it would be much more economical and easier to just use the ESP32.)

from openfontrender.

buckfast-beekeeper avatar buckfast-beekeeper commented on June 12, 2024

Can you check how much Heap RAM left there is exactly before this error? It might be that ESP8266 has not enough resources at that moment to execute that operation, or I'm thinking in the wrong direction?

09:35:17.304 -> Setup Font
09:35:17.304 -> Heap size before loading font: 40168
09:35:17.351 -> [OFR INFO] Font load required. FaceId: 0x0x3fff134c
09:35:17.351 -> [OFR INFO] Load from memory.
09:35:17.351 -> [OFR INFO] Font load Success!
09:35:17.397 -> Heap size after loading font: 18656
09:35:17.397 -> Setup Font OK

from openfontrender.

buckfast-beekeeper avatar buckfast-beekeeper commented on June 12, 2024

Adding an external SRAM to the ESP8266 might work.
(But it would be much more economical and easier to just use the ESP32.)

I have multiple ESP32 in stock. That isn't the problem. I was thinking I use only 7 pins, why taking the ESP32 with more pins?

Biggest consequence is remake the PCB and reprint the enclosure.

from openfontrender.

martinberlin avatar martinberlin commented on June 12, 2024

That is the issue then. As @takkaO mentioned the 8266 has around 50 Kb.
And seems after loading the font only 18 Kb are free. Impossible to keep on doing anything with such a low Heap, since the Espressif chips have to do also WiFi stuff on their own, and usually crash quickly having not enough heap RAM.
The best would be to use ESP32. Or if you want to use a MCU that is still recommended for new designs (All esp32 are NRND in their datasheets at this point) then go for a mini ESP32S3.

from openfontrender.

buckfast-beekeeper avatar buckfast-beekeeper commented on June 12, 2024

The heap size is without WiFi started. Only TFT_eSPI and OpenFontRender is loaded.

I have around 20 ESP32 in stock. No direct problems with that and at the moment they are available without problems. I don't make great series. If they are sold out, I can take another, maybe more recently ยตC.

from openfontrender.

Bodmer avatar Bodmer commented on June 12, 2024

Just noticed this post. I will update the ReadMe in TFT_eSPI to reflect this.

from openfontrender.

takkaO avatar takkaO commented on June 12, 2024

@buckfast-beekeeper

We found that the cause of this issue is due to heap memory.
A change in the FreeType version or options, or a code fix in OpenFontRender could improve the problem with ESP8266.
Unfortunately I cannot make any further code corrections because I do not have an ESP8266.
Therefore, I am going to close this issue.

If someone can provide a solution or fix code to this problem, I would welcome it.

from openfontrender.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.