Commit e24ce94e authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Updates hardware_sytem to handle MUX_CONFIG

Showing with 7 additions and 8 deletions
+7 -8
...@@ -20,14 +20,13 @@ ctl_module = importlib.import_module(f'ohmpi.hardware_components.{HARDWARE_CONFI ...@@ -20,14 +20,13 @@ ctl_module = importlib.import_module(f'ohmpi.hardware_components.{HARDWARE_CONFI
pwr_module = importlib.import_module(f'ohmpi.hardware_components.{HARDWARE_CONFIG["pwr"]["model"]}') pwr_module = importlib.import_module(f'ohmpi.hardware_components.{HARDWARE_CONFIG["pwr"]["model"]}')
tx_module = importlib.import_module(f'ohmpi.hardware_components.{HARDWARE_CONFIG["tx"]["model"]}') 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"]}') rx_module = importlib.import_module(f'ohmpi.hardware_components.{HARDWARE_CONFIG["rx"]["model"]}')
MUX_CONFIG = HARDWARE_CONFIG['mux']
# for mux_id, mux_config in HARDWARE_CONFIG['mux']['boards'].items(): MUX_DEFAULT = HARDWARE_CONFIG['mux']['default']
# 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_CONFIG = HARDWARE_CONFIG['mux']['boards'] MUX_CONFIG = HARDWARE_CONFIG['mux']['boards']
for k, v in HARDWARE_CONFIG.items():
MUX_CONFIG[k].update({'id': k})
for k2, v2 in MUX_DEFAULT.items():
MUX_CONFIG[k].update({k2: MUX_CONFIG[k].pop(k2, v2)})
TX_CONFIG = tx_module.TX_CONFIG TX_CONFIG = tx_module.TX_CONFIG
RX_CONFIG = rx_module.RX_CONFIG RX_CONFIG = rx_module.RX_CONFIG
...@@ -100,10 +99,10 @@ class OhmPiHardware: ...@@ -100,10 +99,10 @@ class OhmPiHardware:
self.tx.pwr = self.pwr self.tx.pwr = self.pwr
self._cabling = kwargs.pop('cabling', {}) self._cabling = kwargs.pop('cabling', {})
self.mux_boards = {} self.mux_boards = {}
for mux_id, mux_config in HARDWARE_CONFIG['mux']['boards'].items(): for mux_id, mux_config in MUX_CONFIG.items():
mux_config.update({'exec_logger': self.exec_logger, 'data_logger': self.data_logger, mux_config.update({'exec_logger': self.exec_logger, 'data_logger': self.data_logger,
'soh_logger': self.soh_logger}) 'soh_logger': self.soh_logger})
mux_config.update(**HARDWARE_CONFIG['mux']['boards'][mux_id]) mux_config.update(**MUX_CONFIG[mux_id])
ctl = mux_config.pop({'ctl': self.ctl}) ctl = mux_config.pop({'ctl': self.ctl})
mux_module = importlib.import_module(f'ohmpi.hardware_components.{mux_config["model"]}') mux_module = importlib.import_module(f'ohmpi.hardware_components.{mux_config["model"]}')
if isinstance(ctl, dict): ### TODO: is this needed? if isinstance(ctl, dict): ### TODO: is this needed?
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment