From ff245bc66de6c0b72be0d4c75965f33f4a0f3486 Mon Sep 17 00:00:00 2001
From: Arnaud Watlet <arnaud.watlet@umons.ac.be>
Date: Fri, 15 Dec 2023 11:59:24 +0100
Subject: [PATCH] tries to fix vmax issue

---
 ohmpi/hardware_system.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py
index 532026c3..094023a9 100644
--- a/ohmpi/hardware_system.py
+++ b/ohmpi/hardware_system.py
@@ -607,8 +607,8 @@ class OhmPiHardware:
         if self.pwr_state == 'off':
             self.pwr_state = 'on'
             switch_tx_pwr_off = True
-        # if self.tx.pwr.pwr_state == 'off':
-        #     self.tx.pwr.pwr_state = 'on'
+        if self.tx.pwr.pwr_state == 'off':
+             self.tx.pwr.pwr_state = 'on'
         #     switch_pwr_off = True
 
         self._gain_auto(vab=vab)
@@ -624,8 +624,7 @@ class OhmPiHardware:
             polarities = None
         self._vab_pulses(vab, durations, sampling_rate, polarities=polarities,  append=append)
         self.exec_logger.event(f'OhmPiHardware\tvab_square_wave\tend\t{datetime.datetime.utcnow()}')
-        if switch_pwr_off:
-            self.tx.pwr.pwr_state = 'off'
+        self.tx.pwr.pwr_state = 'off'
         if switch_tx_pwr_off:
             self.pwr_state = 'off'
 
@@ -662,7 +661,7 @@ class OhmPiHardware:
         # switches tx pwr on if needed (relays switching dps on and off)
         if self.pwr_state == 'off':
             self.pwr_state = 'on'
-            switch_pwr_off = True
+            switch_tx_pwr_off = True
         n_pulses = len(durations)
         self.exec_logger.debug(f'n_pulses: {n_pulses}')
         if self.tx.pwr.voltage_adjustable:
-- 
GitLab