I wrote a micro Python script that uses a raspberry pi pico to drive the display pack 2.8. I cannot seem to clear the display buffer when repeating a graphics script that I wrote . After trying many things I noticed the same problem exists for the demo scripts in the repository: github.com/ pimoroni-pico/micropython/examples/gfx_pack. In particular the rainbow_wheel.py. How can I clear the buffer properly and completely without momentarily displaying prior graphics from the previous session?
My script plots a line at various angles starting at 0° ending at 180°. After each line is drawn, I clear the display with the clear display () function listed below.
When I run the script to completion it sequences through all of the plots of lines and stops. When I restart the program there is no residual display of a line from the previous execution of the script. However, when I terminate the program in Thonny, before all the lines are drawn, by issuing the Stop command, the display is as follows when I run the script again. There is a momentary flash of the display and then an image appears momentarily of the last line I drew appears before terminating the prior session. Then the script continues to run properly. I have tried many ways to clear the display. Nothing helps.
Ok. My code as posted clears the buffer that is on the Pico, display.clear() then transfers that empty buffer to display pack display.update(). It looks like you are fighting something left in the actual displays buffer. I didn’t clue into that when I read your original post. Issuing that stop command is leaving things behind in the displays buffer.
Do you do clear display / display update before executing your while true loop?
I tried to do a hard reset via the software command machine.reset(). Then I get the error message:
PROBLEM IN THONNY’S BACK-END: Exception while handling ‘Run’ (ConnectionError: EOF).
See Thonny’s backend.log for more info.
You may need to press “Stop/Restart” or hard-reset your MicroPython device and try again.