Save 5% runtime by not waiting for super low values #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'.