From b2dfb621349c149079a93b0645a27d679eb3a4f9 Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Tue, 26 Sep 2023 16:09:56 +0200 Subject: [PATCH] Updates hardware_sytem to handle MUX_CONFIG --- ohmpi/hardware_system.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py index 17f15c37..2189c010 100644 --- a/ohmpi/hardware_system.py +++ b/ohmpi/hardware_system.py @@ -103,11 +103,12 @@ class OhmPiHardware: mux_config.update({'exec_logger': self.exec_logger, 'data_logger': self.data_logger, 'soh_logger': self.soh_logger}) mux_config.update(**MUX_CONFIG[mux_id]) - ctl = mux_config.pop('ctl', self.ctl) + mux_config.update(mux_config.pop('ctl', self.ctl)) + mux_module = importlib.import_module(f'ohmpi.hardware_components.{mux_config["model"]}') - if isinstance(ctl, dict): ### TODO: is this needed? + if isinstance(mux_config['ctl'], dict): ### TODO: is this needed? mux_ctl_module = importlib.import_module(f'ohmpi.hardware_components.{mux_config["ctl"]["model"]}') - ctl = mux_ctl_module.Ctl(**self.ctl) + ctl = mux_ctl_module.Ctl(**mux_config['ctl']) # (**self.ctl) assert issubclass(type(mux_config['ctl']), CtlAbstract) io = mux_config.pop('io', ctl.connections[mux_config.pop('connection', 'i2c')]) mux_config.update({'io': io}) -- GitLab