From 5fd17e9994a1c4d3375777c451c2781a28c78f1e Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Sun, 30 Apr 2023 17:37:46 +0200 Subject: [PATCH] Updates hardware_system test_mux --- hardware_system.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/hardware_system.py b/hardware_system.py index fde83694..639eb9ad 100644 --- a/hardware_system.py +++ b/hardware_system.py @@ -310,25 +310,20 @@ class OhmPiHardware: self.reset_mux() if channel is not None: - if channel =='': - electrodes = [1] - roles = ['A'] - else: - try: - channel = channel.lstrip('(').rstrip(')').split(',') - electrodes = [int(channel[0])] - roles = [channel[1]] - except Exception as e: - self.exec_logger.error(f'Unable to parse your answer: {e}') - return + try: + electrodes = [int(channel[0])] + roles = [channel[1]] + except Exception as e: + self.exec_logger.error(f'Unable to parse channel: {e}') + return self.switch_mux(electrodes,roles,state='on') time.sleep(activation_time) self.switch_mux(electrodes,roles, state='off') else: for c in self._cabling.keys(): - self.switch_mux(electrodes=c[0],roles=c[1],state='on') + self.switch_mux(electrodes=[c[0]],roles=[c[1]],state='on') time.sleep(activation_time) - self.switch_mux(electrodes=c[0], roles=c[1], state='off') + self.switch_mux(electrodes=[c[0]], roles=[c[1]], state='off') self.exec_logger.info('Test finished.') def reset_mux(self): -- GitLab