I printed out a new enclosure that includes a spot for the Adafruit QT gamepad module. I have the mouse controls setup, but mouse movement is very choppy, especially during the 8FPS animations. I believe displayio is taking up too many system resources while changing the default tile and refreshing the display, resulting in the script being bound up until displayio is finished. There are a few things that could remedy this problem.
The easiest would be to split up the display group so that the whole display doesn't refresh. Only the top two quadrants need to be animated, so I can try appending groups only for animations, and have a main static group as the background. My current sprite.bmp is far too large to fit into memory using adafruit_imageload. I can either downsize the one sprite image and use adafruit_imageload, or have a couple separate images that hold only animation frames.
A more complicated approach would be to refactor my code to use asyncio, which I should do anyway. I suspect a full display refresh task would still bind up the program but I'll have to check and see.
The last and possibly most complicated approach would be to port everything to MicroPython. CircuitPython does not support threading but MicroPython does, and the Blinka library allows MicroPython to use CircuitPython libraries. Putting all display effects into their own thread could possibly be the best solution, and would make full use of the dual core mcu. I haven't done much research on MicroPython out of fear, but it could turn out to be easier to get everything working than with using asyncio.
The true solution would be to implement all these things but I have other projects that need attention right now, and my MacroPad is technically in a working state. I won't be using the mouse control constantly so it won't be a huge issue, but it's definitely noticeable. One thing I haven't considered heavily is changing the display bus and CPU clock speeds. I believe the RP2040 can be safely overclocked to around 200Mhz. I just read that the OLED display uses an SPI bus which is faster than I2C, so I'm not sure if this will change anything. I will have to read over the displayio documentation and see if there are any settings or features I can change.


Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.