I have a ILI9341 display I am drawing a GUI too, which works ok. But I can see the display refresh(it redrawing the graphs and such).
So I thought of creating a buffer inside the ESP32 to draw too, so I can then directly push all the pixels to the display when the buffer is filled.
This is where the problem is, with the function:
Code: Select all
Serial.print((ESP.getFreeHeap()/1000));
So I did some simple math to calculate how much memory I need, I need one byte per color, so:
320*240*3 should do the job.
Meaning a display of 320*240 with 1 byte per pixel.
This results in 230.4KB of memory needed. Should fit I guess since 291KB is available...
So I try this:
Code: Select all
if (malloc(320*240*3) == 0)
{
Serial.println("FAILED TO ALLOCATE MEM");
while(1){}
}
So my question is, what's up with above? Why doesn't it fit?
Is there a limit on how much memory one can use per task? Is the ESP.getFreeHeap function bugged?
Thanks!