From f1400211af314aa33c5673dc95ee280f898dc889 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Sun, 21 Jul 2024 14:19:05 -0400 Subject: avoid unnesesary Run/Stop state change --- qolab/hardware/scope/rigolds1054z.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/qolab/hardware/scope/rigolds1054z.py b/qolab/hardware/scope/rigolds1054z.py index bf5a6a5..d43752a 100644 --- a/qolab/hardware/scope/rigolds1054z.py +++ b/qolab/hardware/scope/rigolds1054z.py @@ -99,6 +99,13 @@ class RigolDS1054z(ScopeSCPI): return True return False + def setRun(self, val): + """Either enable run or stop.""" + + if val: + self.run() + self.stop() + @BasicInstrument.tsdb_append def getTimeBaseMode(self): """Get he mode of the horizontal timebase. @@ -414,8 +421,9 @@ class RigolDS1054z(ScopeSCPI): def getTrace( self, chNum, availableNpnts=None, maxRequiredPoints=None, decimate=True ): - old_trg_status = self.getTriggerStatus() - self.stop() + old_run_status = self.getRun() + if old_run_status: # avoid unnecessary status change + self.setRun(False) # stop if currently running # to get synchronous channels wfVoltage, rawChanCfg = self.getWaveform( chNum, @@ -428,8 +436,8 @@ class RigolDS1054z(ScopeSCPI): tr.x = t tr.y = wfVoltage # restore scope to the before acquisition mode - if old_trg_status != "STOP": - self.run() + if old_run_status: # avoid unnecessary status change + self.setRun(old_run_status) # start running if it was old run state return tr -- cgit v1.2.3