-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Intermittent Delay while reading Capacitive Touch: heap size related #8692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
My guess is that we're doing a collect when the heap is full to see if we can allocate into it (and we can.) This will happen earlier with split heap than it did with the one big heap. The pauses should be shorter though. |
Raising the starting heap size may give you enough buffer to capture a full finger drag before triggering the GC. You could also try running gc.collect() when a finger isn't active. |
Ok, I'll try those to see if it helps... |
Raising starting heap size did help. Garbage collection didn't help. |
Do we want a larger default heap? This seems like a pretty specific case to change a default for. |
What did you set it to? 128k? We could make it default on PSRAM builds. |
Tested this on latest CP 9 version and 512K seemed to work better than 128K or 256K. |
Thanks for the update! I've moved this to 9.x.x. I'd like to see if any other uses like this crop up before we change the default heap size. Having it in stable should make it clearer. |
CircuitPython version
Code/REPL
See https://github.com/adafruit/Adafruit_CircuitPython_Qualia/blob/main/examples/qualia_paint.py
Behavior
After about every 10 reads or so from the capacitive touch screen, there is a noticeable delay. You can really tell by running the paint program:

Description
Additional information
Switching to CP Alpha 2 fixes the issue. With CP Alpha 4, the problem is there, but you need to make sure the PYSTACK size and such is big enough to run it. My guess is it's related to the split heap stuff.
Using different touch drivers, touch controllers, and optimizing code did not help.
The text was updated successfully, but these errors were encountered: