From 3b35b2bc1c8cc3774b45611fceb37305e3a8e420 Mon Sep 17 00:00:00 2001
From: awatlet <arnaud.watlet@umons.ac.be>
Date: Tue, 14 Nov 2023 12:21:30 +0100
Subject: [PATCH] Fixes rs_check

---
 ohmpi/ohmpi.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ohmpi/ohmpi.py b/ohmpi/ohmpi.py
index a1c12751..bd66fe3f 100644
--- a/ohmpi/ohmpi.py
+++ b/ohmpi/ohmpi.py
@@ -817,13 +817,16 @@ class OhmPi(object):
 
         self.reset_mux()
 
+        # turn dps_pwr_on if needed
+        switch_pwr_off = False
+        if self._hw.pwr.pwr_state == 'off':
+            self._hw.pwr.pwr_state = 'on'
+            switch_pwr_off = True
+            
         # measure all quad of the RS sequence
         for i in range(0, quads.shape[0]):
             quad = quads[i, :]  # quadrupole
             self._hw.switch_mux(electrodes=list(quads[i, :2]), roles=['A', 'B'], state='on')
-            if self._hw.pwr.pwr_state == 'off':
-                self._hw.pwr.pwr_state = 'on'
-                switch_pwr_off = True
             self._hw._vab_pulse(duration=0.2, vab=tx_volt)
             current = self._hw.readings[-1, 3]
             vab = self._hw.tx.pwr.voltage
-- 
GitLab