Skip to content
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

Save 5% runtime by not waiting for super low values #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexbbrown
Copy link

Context: Reducing full scan time can make room for experimenters to put more logic into control loop. The current scan time is already great for musical use of this device.


Based upon 10-20 high definition runs scanning Z at 1Mhz while switching sensor, observed that while low Z values around 35 sometimes settle high, values which are nearly 0 initially do not.

This patch samples Z immediately after switching sensor and if it's low (<10) will return immediately without waiting for settling. This value could be reduced to (<2) and have nearly the same performance gain.

Alone this reduces full scan by 5%. Combined with the SPI 16-bit patch the full scan now costs 3500ms (17% improvement) when nothing is pressed.

Testing notes: Briefly tested this patch and behaviour seems normal. I will continue to observe for exceptions to this 'rule'.

@alexbbrown
Copy link
Author

Note that if a significant fraction of the surface is above 10, then the result is more sensor reads; so available CPU time for non-scan tasks in cases where a substantial number of buttons are pressed or otherwise having a signal may be reduced slightly due to the increased read (around 20 cycles for each of the 200 buttons) followed by the read after delay.

@gbevin gbevin force-pushed the master branch 3 times, most recently from 9e2f723 to 45afc0e Compare October 8, 2016 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant