Help clearing only part of the screen in u8g2

I have been trying to shorten my code in Arduino to only wright the screen once and clear and draw the needed items. There is only one problem in this. I DONT KNOW the right command to clear the selected part of the screen. (the reason for shortening the code is so that my Arduino has enough memory to decode data from an encoder.

You fill a rectangle with drawBox() Using the background color ( setDrawColor())

this only complicates the code

I just need to clear it because if it can draw just a single pixel then it can erase just one

If this is for text, then write the previous text using the background color before writing the. New text.

If this is just a pixel, the. Just write that pixel with the background color

Not sure exactly what you are saying…

the problem is I have to draw 4 concentric circles for each value

I am not saying your solution is not viable but that is a lot for a mega 2560 to compute

Computation is not a problem. It is simply a bit slow to set all those pixels to background (mostly I/O).

No more than it took to display it in the first place.

Which memory are you running short of, program memory or dynamic memory?

Circles are costly, rectangles a bit less… but then it’s indeed IO cost

Is this the same code you asked about in here:

If so, why are you using software SPI instead of hardware? Software SPI would be more CPU intensive. You can also greatly reduce the ram usage by using a page buffer, but that would require that the full display be rewritten each time.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.