From ba16742d9779ea13508fe9dff131a42fd3970927 Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Wed, 21 Jun 2023 11:40:59 +0200
Subject: [PATCH] Fixes rs-check adding a bypass option to switching

---
 ohmpi/hardware_components/abstract_hardware_components.py | 2 +-
 ohmpi/hardware_system.py                                  | 2 --
 ohmpi/ohmpi.py                                            | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/ohmpi/hardware_components/abstract_hardware_components.py b/ohmpi/hardware_components/abstract_hardware_components.py
index 2f788aad..be4c42c3 100644
--- a/ohmpi/hardware_components/abstract_hardware_components.py
+++ b/ohmpi/hardware_components/abstract_hardware_components.py
@@ -53,7 +53,7 @@ class PwrAbstract(ABC):
         self._state = 'off'
         self._current_min = kwargs.pop('current_min', 0.)
         self._current_max = kwargs.pop('current_max', 0.)
-        self._current_min = kwargs.pop('voltage_min', 0.)
+        self._voltage_min = kwargs.pop('voltage_min', 0.)
         self._voltage_max = kwargs.pop('voltage_max', 0.)
 
     @property
diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py
index e8ec50ab..69967c30 100644
--- a/ohmpi/hardware_system.py
+++ b/ohmpi/hardware_system.py
@@ -21,14 +21,12 @@ pwr_module = importlib.import_module(f'ohmpi.hardware_components.{HARDWARE_CONFI
 tx_module = importlib.import_module(f'ohmpi.hardware_components.{HARDWARE_CONFIG["tx"]["model"]}')
 rx_module = importlib.import_module(f'ohmpi.hardware_components.{HARDWARE_CONFIG["rx"]["model"]}')
 MUX_CONFIG = {}
-# mux_boards = []
 
 for mux_id, mux_config in HARDWARE_CONFIG['mux']['boards'].items():
     mux_module = importlib.import_module(f'ohmpi.hardware_components.{mux_config["model"]}')
     MUX_CONFIG[mux_id] = mux_module.MUX_CONFIG
     MUX_CONFIG[mux_id].update(mux_config)
     MUX_CONFIG[mux_id].update({'id': mux_id})
-    # mux_boards.append(mux_id)
 
 TX_CONFIG = tx_module.TX_CONFIG
 RX_CONFIG = rx_module.RX_CONFIG
diff --git a/ohmpi/ohmpi.py b/ohmpi/ohmpi.py
index 8dce80b4..e7b454eb 100644
--- a/ohmpi/ohmpi.py
+++ b/ohmpi/ohmpi.py
@@ -767,7 +767,7 @@ class OhmPi(object):
             Bypasses checks for A==M or A==M or B==M or B==N (i.e. used for rs-check)
         """
         assert len(quadrupole) == 4
-        if self._hw.tx.voltage > self._hw.rx.max_voltage and bypass_check:
+        if self._hw.tx.pwr.voltage > self._hw.rx.max_voltage and bypass_check:
             self.exec_logger.warning('Cannot bypass checking electrode roles because tx voltage is over rx maximum voltage')
             return False
         else:
-- 
GitLab