Skip to content

Commit a54cca0

Browse files
rascustomshmaarrfk
authored andcommitted
Additional support for PicoScope 4444 (#151)
* Ported fix for USB power from ps5000a to ps4000a. Enabled Bandwidth Filtering for PicoScope 4444 * Corrected PEP8 violations
1 parent 4a9c4e1 commit a54cca0

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

picoscope/picobase.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,14 @@ def setChannel(self, channel='A', coupling="AC", VRange=2.0,
247247
if not isinstance(BWLimited, int):
248248
BWLimited = self.BW_LIMITS[BWLimited]
249249

250-
if BWLimited == 2:
251-
BWLimited = 2 # Bandwidth Limiter for PicoScope 6404
250+
if BWLimited == 3:
251+
BWLimited = 3 # 1MHz Bandwidth Limiter for PicoScope 4444
252+
elif BWLimited == 2:
253+
BWLimited = 2 # Bandwidth Limiter for PicoScope 6404,
254+
# 100kHz Bandwidth Limiter for PicoScope 4444
252255
elif BWLimited == 1:
253-
BWLimited = 1 # Bandwidth Limiter for PicoScope 6402/6403
256+
BWLimited = 1 # Bandwidth Limiter for PicoScope 6402/6403,
257+
# 20kHz Bandwidth Limiter for PicoScope 4444
254258
else:
255259
BWLimited = 0
256260

picoscope/ps4000a.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,19 @@ def _lowLevelOpenUnit(self, sn):
145145
serialNullTermStr = None
146146
# Passing None is the same as passing NULL
147147
m = self.lib.ps4000aOpenUnit(byref(c_handle), serialNullTermStr)
148-
self.checkResult(m)
149148
self.handle = c_handle.value
150149

150+
# This will check if the power supply is not connected
151+
# and change the power supply accordingly
152+
# Personally (me = Mark), I don't like this
153+
# since the user should address this immediately, and we
154+
# shouldn't let this go as a soft error
155+
# but I think this should do for now
156+
if m == 0x11A:
157+
self.changePowerSource(m)
158+
else:
159+
self.checkResult(m)
160+
151161
self.model = self.getUnitInfo('VariantInfo')
152162

153163
def _lowLevelOpenUnitAsync(self, sn):
@@ -216,6 +226,11 @@ def _lowLevelSetChannel(self, chNum, enabled, coupling, VRange, VOffset,
216226
c_enum(VRange), c_float(VOffset))
217227
self.checkResult(m)
218228

229+
m = self.lib.ps4000aSetBandwidthFilter(c_int16(self.handle),
230+
c_enum(chNum),
231+
c_enum(BWLimited))
232+
self.checkResult(m)
233+
219234
def _lowLevelStop(self):
220235
m = self.lib.ps4000aStop(c_int16(self.handle))
221236
self.checkResult(m)
@@ -406,6 +421,12 @@ def _lowLevelSetDeviceResolution(self, resolution):
406421
c_enum(resolution))
407422
self.checkResult(m)
408423

424+
def _lowLevelChangePowerSource(self, powerstate):
425+
m = self.lib.ps4000aChangePowerSource(
426+
c_int16(self.handle),
427+
c_enum(powerstate))
428+
self.checkResult(m)
429+
409430
def _lowLevelGetValuesBulk(self, numSamples, fromSegment, toSegment,
410431
downSampleRatio, downSampleMode, overflow):
411432
"""Copy data from several memory segments at once."""

0 commit comments

Comments
 (0)