Index: tests/tx_test_config_tests.py =================================================================== diff -u -r23e83eef3f47218e11d5e19a92fcfc24ae35b843 -rd1073574dd277c429fe6c63ec23819dfc3347850 --- tests/tx_test_config_tests.py (.../tx_test_config_tests.py) (revision 23e83eef3f47218e11d5e19a92fcfc24ae35b843) +++ tests/tx_test_config_tests.py (.../tx_test_config_tests.py) (revision d1073574dd277c429fe6c63ec23819dfc3347850) @@ -4,6 +4,7 @@ from dialin.dg.dialysate_generator import DG from dialin.hd.hemodialysis_device import HD from dialin.dg.load_cells import DGLoadCellNames +from dialin.hd.switches import HDSwitchesNames, HDSwitchStatus from dialin.ui.hd_simulator import HDSimulator from dialin.common.dg_defs import DGHeatDisinfectStates, DGHeatDisinfectUIStates from dialin.dg.heat_disinfect import HeatCancellationModes, NelsonSupportModes @@ -48,20 +49,23 @@ counter = 1 #dg.load_cells.cmd_get_load_cells_tare_values() - # For testing only. Use the get function to get the actual tare values + # For testing only. Use the get function to get the actual tare values during the development of this script and + # the procedure for this dg.load_cells.load_cells_tare_values[DGLoadCellNames.LOAD_CELL_RESERVOIR_1_PRIMARY.name] = 1726.822998046875 dg.load_cells.load_cells_tare_values[DGLoadCellNames.LOAD_CELL_RESERVOIR_1_BACKUP.name] = 1716.2781982421875 dg.load_cells.load_cells_tare_values[DGLoadCellNames.LOAD_CELL_RESERVOIR_2_PRIMARY.name] = 1716.46484375 dg.load_cells.load_cells_tare_values[DGLoadCellNames.LOAD_CELL_RESERVOIR_2_BACKUP.name] = 1712.1719970703125 while True: - if dg.load_cells.load_cells_tare_values[DGLoadCellNames.LOAD_CELL_RESERVOIR_1_PRIMARY.name] != 0.0: + if counter == 1 and \ + dg.load_cells.load_cells_tare_values[DGLoadCellNames.LOAD_CELL_RESERVOIR_1_PRIMARY.name] != 0.0: # Received the load cells tare values from DG. Reset both stacks dg.cmd_dg_software_reset_request() hd.cmd_hd_software_reset_request() + sleep(1) counter += 1 - if counter == 2 and 3 == dg.dg_operation_mode: + if counter == 2 and dg.dg_operation_mode == 3: # After reset log in again dg.cmd_log_in_to_dg() # Wait to make sure the log in really happened @@ -72,7 +76,7 @@ dg.load_cells.cmd_set_load_cells_tare_values() counter += 1 - if counter == 4 and 3 == hd.hd_operation_mode: + if counter == 4 and hd.hd_operation_mode == 3: hd.cmd_log_in_to_hd() # Wait to make sure the log in really happened sleep(1) @@ -83,30 +87,51 @@ hd.cmd_hd_set_operation_mode(4) counter += 1 - if counter == 6 and 4 == hd.hd_operation_mode: + if counter == 6 and hd.hd_operation_mode == 4: # Start DG cannot be when HD is in standby dg.hd_proxy.cmd_start_stop_dg() counter += 1 - if counter == 7: + if counter == 7 and dg.dg_operation_mode == 5 and dg.dg_operation_sub_mode == 1: + # This section is for testing only to make sure we always have fluid in the reservoir. This part is not + # needed in the actual test procedure + dg.hd_proxy.cmd_fill(1600) + sleep(1) + counter += 1 + + if counter == 8: + print(counter) hd.test_configs.cmd_set_test_config(HDTestConfigOptions.TEST_CONFIG_EXPEDITE_PRE_TREATMENT.value) + sleep(1) counter += 1 - sleep(0.5) + if counter == 9: + hd.ui.cmd_set_treatment_parameters() + sleep(1) + counter += 1 + if counter == 10: + hd.ui.cmd_ui_confirm_treatment_parameters() + sleep(1) + counter += 1 + if counter == 11: + hd.ui.cmd_ui_uf_settings_change_confirm() + sleep(1) + counter += 1 + if counter == 12: + hd.switches.cmd_hd_switch_status_override(HDSwitchesNames.FRONT_DOOR.value, HDSwitchStatus.OPEN.value) + sleep(1) + counter += 1 + if counter == 13: + hd.switches.cmd_hd_switch_status_override(HDSwitchesNames.FRONT_DOOR.value, HDSwitchStatus.CLOSED.value) + counter += 1 + sleep(0.5) - - - - - - - if __name__ == "__main__": dg = DG(log_level='DEBUG') dg.cmd_log_in_to_dg()