From 4316fc3e5faa7ded0cf139b3714825e1d0e0ae52 Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Thu, 27 Apr 2023 09:20:06 +0200 Subject: [PATCH] Fixes bug in mux_2024_rev_0_0 reset --- hardware_components/abstract_hardware_components.py | 2 +- hardware_components/mux_2024_rev_0_0.py | 2 +- test_mux_2024.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 7ed2d853..c8ca0b37 100644 --- a/hardware_components/abstract_hardware_components.py +++ b/hardware_components/abstract_hardware_components.py @@ -113,7 +113,7 @@ class MuxAbstract(ABC): self.reset() for role in elec_dict.keys(): - for elec in elec_dict['role']: + for elec in elec_dict[role]: self.switch_one(elec, role, 'on') self.exec_logger.debug(f'electrode: {elec} activated.') time.sleep(activation_time) diff --git a/hardware_components/mux_2024_rev_0_0.py b/hardware_components/mux_2024_rev_0_0.py index ed2674f6..6818f03a 100644 --- a/hardware_components/mux_2024_rev_0_0.py +++ b/hardware_components/mux_2024_rev_0_0.py @@ -111,7 +111,7 @@ class Mux(MuxAbstract): def reset(self): self._mcp[0] = MCP23017(self._tca, address=int(self._mcp_addresses[0], 16)) - self._mcp[1] = MCP23017(self._tca, address=int(self._mcp_addresses[0], 16)) + self._mcp[1] = MCP23017(self._tca, address=int(self._mcp_addresses[1], 16)) def switch_one(self, elec=None, role=None, state=None): MuxAbstract.switch_one(self, elec=elec, role=role, state=state) diff --git a/test_mux_2024.py b/test_mux_2024.py index e9b2e182..92185fc7 100644 --- a/test_mux_2024.py +++ b/test_mux_2024.py @@ -13,5 +13,5 @@ mux.switch({'A': [1], 'B': [4], 'M': [2], 'N': [3]}, state='on') time.sleep(8) #mux.switch({'A': [1], 'B': [4], 'M': [2], 'N': [3]}, state='off') mux.reset() -# mux.test({'A': [1, 2, 3, 4], 'B': [4, 5, 6, 7], 'M': [2, 3, 4, 5], 'N': [3, 4, 5, 6]}) +mux.test({'A': [1, 2, 3, 4], 'B': [4, 5, 6, 7], 'M': [2, 3, 4, 5], 'N': [3, 4, 5, 6]}) change_config('config_default.py', verbose=False) -- GitLab