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

Fixes bug in mux_2024_rev_0_0

No related merge requests found
Showing with 13 additions and 14 deletions
+13 -14
...@@ -13,9 +13,8 @@ rx_module = importlib.import_module(f'OhmPi.hardware_components.{HARDWARE_CONFIG ...@@ -13,9 +13,8 @@ rx_module = importlib.import_module(f'OhmPi.hardware_components.{HARDWARE_CONFIG
MUX_CONFIG = {} MUX_CONFIG = {}
for mux_id, mux_config in HARDWARE_CONFIG['mux']['boards'].items(): for mux_id, mux_config in HARDWARE_CONFIG['mux']['boards'].items():
mux_module = importlib.import_module(f'OhmPi.hardware_components.{mux_config["model"]}') mux_module = importlib.import_module(f'OhmPi.hardware_components.{mux_config["model"]}')
update_dict(MUX_CONFIG[mux_id], mux_module.MUX_CONFIG) MUX_CONFIG[mux_id] = mux_module.MUX_CONFIG
update_dict(MUX_CONFIG, mux_config) MUX_CONFIG.update(mux_config)
update_dict(MUX_CONFIG[mux_id], HARDWARE_CONFIG['mux']['common'])
TX_CONFIG = tx_module.TX_CONFIG TX_CONFIG = tx_module.TX_CONFIG
RX_CONFIG = rx_module.RX_CONFIG RX_CONFIG = rx_module.RX_CONFIG
...@@ -54,11 +53,11 @@ class OhmPiHardware: ...@@ -54,11 +53,11 @@ class OhmPiHardware:
soh_logger=self.soh_logger, soh_logger=self.soh_logger,
controller=self.controller)) controller=self.controller))
self._cabling = kwargs.pop('cabling', default_mux_cabling) self._cabling = kwargs.pop('cabling', default_mux_cabling)
self.mux = kwargs.pop('mux', {'mux_1': mux_module.Mux(exec_logger=self.exec_logger, self.mux_boards = kwargs.pop('mux', {'mux_1': mux_module.Mux(exec_logger=self.exec_logger,
data_logger=self.data_logger, data_logger=self.data_logger,
soh_logger=self.soh_logger, soh_logger=self.soh_logger,
controller=self.controller, controller=self.controller,
cabling = self._cabling)}) cabling = self._cabling)})
self.readings = np.array([]) # time series of acquired data self.readings = np.array([]) # time series of acquired data
self._start_time = None # time of the beginning of a readings acquisition self._start_time = None # time of the beginning of a readings acquisition
...@@ -75,8 +74,8 @@ class OhmPiHardware: ...@@ -75,8 +74,8 @@ class OhmPiHardware:
self.tx_sync.clear() self.tx_sync.clear()
def _set_mux_barrier(self): def _set_mux_barrier(self):
self.mux_barrier = Barrier(len(self.mux)+1) self.mux_barrier = Barrier(len(self.mux_boards) + 1)
for mux in self.mux: for mux in self.mux_boards:
mux.barrier = self.mux_barrier mux.barrier = self.mux_barrier
@property @property
...@@ -276,7 +275,7 @@ class OhmPiHardware: ...@@ -276,7 +275,7 @@ class OhmPiHardware:
for i in range(len(electrodes)): for i in range(len(electrodes)):
elec_dict[roles[i]].append(electrodes[i]) elec_dict[roles[i]].append(electrodes[i])
mux_workers = [] mux_workers = []
for mux in self.mux: for mux in self.mux_boards:
# start a new thread to perform some work # start a new thread to perform some work
mux_workers.append(Thread(target=mux.switch, kwargs={'elec_dict': elec_dict})) mux_workers.append(Thread(target=mux.switch, kwargs={'elec_dict': elec_dict}))
for mux_worker in mux_workers: for mux_worker in mux_workers:
...@@ -347,5 +346,5 @@ class OhmPiHardware: ...@@ -347,5 +346,5 @@ class OhmPiHardware:
""" """
self.exec_logger.debug('Resetting all mux boards ...') self.exec_logger.debug('Resetting all mux boards ...')
for mux in self.mux: for mux in self.mux_boards:
mux.reset() mux.reset()
\ No newline at end of file
...@@ -1039,7 +1039,7 @@ class OhmPi(object): ...@@ -1039,7 +1039,7 @@ class OhmPi(object):
if self.on_pi: if self.on_pi:
# make sure all mux are off to start with # make sure all mux are off to start with
self._hw.mux.reset_mux() self._hw.mux_boards.reset_mux()
# measure all quad of the RS sequence # measure all quad of the RS sequence
for i in range(0, quads.shape[0]): for i in range(0, quads.shape[0]):
...@@ -1157,7 +1157,7 @@ class OhmPi(object): ...@@ -1157,7 +1157,7 @@ class OhmPi(object):
if mux is None: if mux is None:
self._hw.test_mux(activation_time) self._hw.test_mux(activation_time)
else: else:
self._hw.mux[mux].test_mux() self._hw.mux_boards[mux].test_mux()
def reset_mux(self, cmd_id=None): def reset_mux(self, cmd_id=None):
......
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