From 7c81be915618f659dc5b21ad5ceb404cea842f52 Mon Sep 17 00:00:00 2001 From: James Wah Date: Wed, 24 Jun 2020 14:36:17 +1000 Subject: [PATCH] getRawDataBulk: clear the driver's data pointers after use Fixes #149. The driver's GetValuesBulk routine will retrieve data on all channels for which a pointer has been set with SetDataBuffer. This means that calling getDataRawBulk on two different channels will result in the second call writing to the buffer from the first, which may no longer been valid. The fix is to zero these in the driver before returning, just as getDataRaw() does. --- picoscope/picobase.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/picoscope/picobase.py b/picoscope/picobase.py index 4a09166..bb4f667 100644 --- a/picoscope/picobase.py +++ b/picoscope/picobase.py @@ -579,6 +579,10 @@ def getDataRawBulk(self, channel='A', numSamples=0, fromSegment=0, self._lowLevelGetValuesBulk(numSamples, fromSegment, toSegment, downSampleRatio, downSampleMode, overflow) + # don't leave the API thinking these can be written to later + for i, segment in enumerate(range(fromSegment, toSegment + 1)): + self._lowLevelClearDataBuffer(channel, segment) + return (data, numSamples, overflow) def setSigGenBuiltInSimple(self,