diff --git a/test_mux_2024.py b/test_mux_2024.py index d125f0f26839e3806328a9e16ff3a5b98f231ebb..9d4931667b5d2a0250dd2779cf18fbde49544a8e 100644 --- a/test_mux_2024.py +++ b/test_mux_2024.py @@ -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