_lowLevelClear*: clear the correct buffers when downsampling is used#215
Open
abrasive wants to merge 2 commits intocolinoflynn:masterfrom
Open
_lowLevelClear*: clear the correct buffers when downsampling is used#215abrasive wants to merge 2 commits intocolinoflynn:masterfrom
abrasive wants to merge 2 commits intocolinoflynn:masterfrom
Conversation
added 2 commits
February 6, 2026 09:13
Where downsampling is supported, the PicoScope APIs allow you to set separate buffers for each downsampling mode, so that you can get multiple different outputs from a single acquisition. These buffers are separate from each other and also from the regular/non-downsampled buffer, so they also need to be cleared separately. This patch adds a downsample[Ratio]Mode argument to the _lowLevelClear* functions, and provides appropriate values during the high level getData calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Where downsampling is supported, the PicoScope APIs allow you to set separate buffers for each downsampling mode, so that you can get multiple different outputs from a single acquisition. These buffers are separate from each other and also from the regular/non-downsampled buffer, so they also need to be cleared separately.
The prior implementation always clears the main buffer pointer, even when it should be clearing downsampling buffer pointers, so the driver would happily scribble all over the memory the downsampled buffers had been in and in my case segfault since they'd been deallocated and used for other stuff.
This patch adds a downsample[Ratio]Mode argument to the _lowLevelClear* functions, and provides appropriate values during the high level getData calls.
I'm not sure if this is an issue in terms of breaking API, I'm guessing with the leading _lowLevel you're not expecting users to consume these directly right?
Also slipstreaming a tiny nitpick fix for ps4000, ps4000SetDataBuffer only takes 4 args