Screen Flicker Caused By CLS

I am building a spreadsheet app on my RP2040 PicoCalc. The main program is one large “DO Loop”. Right in the middle of this loop I “scroll” the screen from left to right and from top to bottom to see various sections of the spreadsheet. As the columns and rows work their way across the screen (using the arrow keys) I need to erase each column or row and then redraw each column or row as they march across. I erase the whole screen with CLS and then redraw the “moved” screen. The problem is the CLS appears as a “flicker”. Any suggestions on how I can avoid or at lest minimize this flicker? Thank you. - Jim

Try drawing a filled box over the screen ?. Hopefully you’re using one of the later builds with a better/faster video driver in there too…

Silly question, but have you tried leaving the CLS out? Not sure what you’re doing, so perhaps this will leave artifacts.

Sending a complete screen of RGB565 takes about 1/80 of a second with a 100 MHz SPI interface. A screen of black followed by a screen of spreadsheet is probably slow enough to cause a visible flicker.

I only program using the C SDK, so not sure how MMBasic interacts with the screen.

clearing and redrawing the entire screen at an action is something that will cause flicker in any unbuffered display

the silver bullet against it is to only erase the part that you are changing and leaving everything that doesn’t change alone

doing that requires keeping track of “dirty” elements on the screen (elements where the logical information and the displayed information are no longer the same) and only redrawing those

however you do that depends heavily on how your program is structured

If you can spare the memory the real solution is to write to a framebuffer and then do a framebuffer copy. Otherwise, I would not do a cls at all and update a cell at a time leaving as much of the screen untouched as possible.

NB: If you changed to a rp2350 you would definitely have the memory to use a framebuffer