Commit 787b71dd authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Fixes bug related to the mux_barrier in hardware system

No related merge requests found
Showing with 27 additions and 23 deletions
+27 -23
......@@ -5,31 +5,35 @@ change_config('config_mb_2023_mux_2024.py', verbose=False)
from OhmPi.hardware_components.mux_2024_rev_0_0 import Mux, MUX_CONFIG
from OhmPi.hardware_components import raspberry_pi as controller_module
stand_alone_mux = False
part_of_hardware_system = True
# Stand alone mux
MUX_CONFIG['controller'] = controller_module.Controller()
MUX_CONFIG['id'] = 'mux_1'
MUX_CONFIG['default_mux_cabling'] = {(i+8, j) : ('mux_1', i) for j in ['A', 'B', 'M', 'N'] for i in range(1,9)}
mux = Mux(**MUX_CONFIG)
mux.switch_one(elec=9, role='M', state='on')
time.sleep(2)
mux.switch_one(elec=9, role='M', state='off')
mux.switch({'A': [9], 'B': [12], 'M': [10], 'N': [11]}, state='on')
time.sleep(8)
#mux.switch({'A': [1], 'B': [4], 'M': [2], 'N': [3]}, state='off')
mux.reset()
mux.test({'A': [9, 10, 11, 12, 13, 14, 15, 16], 'B': [9, 10, 11, 12, 13, 14, 15, 16],
'M': [9, 10, 11, 12, 13, 14, 15, 16], 'N': [9, 10, 11, 12, 13, 14, 15, 16]}, activation_time=.1)
if stand_alone_mux:
MUX_CONFIG['controller'] = controller_module.Controller()
MUX_CONFIG['id'] = 'mux_1'
MUX_CONFIG['default_mux_cabling'] = {(i+8, j) : ('mux_1', i) for j in ['A', 'B', 'M', 'N'] for i in range(1,9)}
mux = Mux(**MUX_CONFIG)
mux.switch_one(elec=9, role='M', state='on')
time.sleep(2)
mux.switch_one(elec=9, role='M', state='off')
mux.switch({'A': [9], 'B': [12], 'M': [10], 'N': [11]}, state='on')
time.sleep(8)
#mux.switch({'A': [1], 'B': [4], 'M': [2], 'N': [3]}, state='off')
mux.reset()
mux.test({'A': [9, 10, 11, 12, 13, 14, 15, 16], 'B': [9, 10, 11, 12, 13, 14, 15, 16],
'M': [9, 10, 11, 12, 13, 14, 15, 16], 'N': [9, 10, 11, 12, 13, 14, 15, 16]}, activation_time=.1)
# mux as part of a OhmPiHardware system
from OhmPi.hardware_system import OhmPiHardware
print('Starting test of mux as part of a OhmPiHardware system.')
k = OhmPiHardware()
k.exec_logger.setLevel(logging.INFO)
if part_of_hardware_system:
from OhmPi.hardware_system import OhmPiHardware
print('Starting test of mux as part of a OhmPiHardware system.')
k = OhmPiHardware()
k.exec_logger.setLevel(logging.INFO)
# Test mux switching
k.reset_mux()
k.switch_mux(electrodes=[9,10,11,12], roles=['A', 'B', 'M', 'N'], state='on')
time.sleep(1.)
k.switch_mux(electrodes=[9,10,11,12], roles=['A', 'B', 'M', 'N'], state='off')
# Test mux switching
k.reset_mux()
k.switch_mux(electrodes=[9,10,11,12], roles=['A', 'B', 'M', 'N'], state='on')
time.sleep(1.)
k.switch_mux(electrodes=[9,10,11,12], roles=['A', 'B', 'M', 'N'], state='off')
change_config('config_default.py', verbose=False)
\ No newline at end of file
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