From 9039a4f217815e09522503123297e0629bff37d8 Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Wed, 3 May 2023 13:05:00 +0200
Subject: [PATCH] Fix bug in switching in hardware_system

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

diff --git a/hardware_components/abstract_hardware_components.py b/hardware_components/abstract_hardware_components.py
index df80282b..c1889ea3 100644
--- a/hardware_components/abstract_hardware_components.py
+++ b/hardware_components/abstract_hardware_components.py
@@ -76,7 +76,7 @@ class MuxAbstract(ABC):
     def reset(self):
         pass
 
-    def switch(self, elec_dict=None, state='on'): # TODO: generalize for other roles
+    def switch(self, elec_dict=None, state='off'): # TODO: generalize for other roles
         """Switch a given list of electrodes with different roles.
         Electrodes with a value of 0 will be ignored.
 
diff --git a/hardware_system.py b/hardware_system.py
index 6cecf5bf..cc24729f 100644
--- a/hardware_system.py
+++ b/hardware_system.py
@@ -302,7 +302,7 @@ class OhmPiHardware:
                 for idx, mux in enumerate(mux_workers):
                     # Create a new thread to perform some work
                     self.mux_boards[mux].barrier = b
-                    mux_workers[idx] = Thread(target=self.mux_boards[mux].switch, kwargs={'elec_dict': elec_dict})
+                    mux_workers[idx] = Thread(target=self.mux_boards[mux].switch, kwargs={'elec_dict': elec_dict, 'state': state})
                     mux_workers[idx].start()
                 self.mux_barrier.wait()
                 for mux_worker in mux_workers:
diff --git a/ohmpi.py b/ohmpi.py
index c588508c..cf8132f8 100644
--- a/ohmpi.py
+++ b/ohmpi.py
@@ -64,7 +64,7 @@ class OhmPi(object):
             _, onpi = get_platform()
         elif onpi:
             assert get_platform()[1] == True  # Checks that the system actually runs on a pi if onpi is True
-        self.on_pi = onpi  # True if run from the RaspberryPi with the hardware, otherwise False for random data
+        self.on_pi = onpi  # True if runs from the RaspberryPi with the hardware, otherwise False for random data # TODO : replace with dummy hardware?
 
         self._sequence = sequence
         self.nb_samples = 0
-- 
GitLab