Skip to content

_lowLevelClear*: clear the correct buffers when downsampling is used#215

Open
abrasive wants to merge 2 commits intocolinoflynn:masterfrom
abrasive:clear-downsample-buffers
Open

_lowLevelClear*: clear the correct buffers when downsampling is used#215
abrasive wants to merge 2 commits intocolinoflynn:masterfrom
abrasive:clear-downsample-buffers

Conversation

@abrasive
Copy link
Contributor

@abrasive abrasive commented Feb 5, 2026

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

James Wah 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.
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