Index: dialin/common/hd_defs.py =================================================================== diff -u -r1fd5bc0ed97d0d90223fa78ec195dd7636712c5b -rb31694e714c45e0678632ab11efbcdcf6dbf6e96 --- dialin/common/hd_defs.py (.../hd_defs.py) (revision 1fd5bc0ed97d0d90223fa78ec195dd7636712c5b) +++ dialin/common/hd_defs.py (.../hd_defs.py) (revision b31694e714c45e0678632ab11efbcdcf6dbf6e96) @@ -28,7 +28,17 @@ MODE_POST = 7 # Post-Treatment mode NUM_OF_MODES = 8 # Number of HD operation modes +@unique +class HDOpSubModes(DialinEnum): + SUBMODE_START = 0 + SUBMODE_WAIT_FOR_TREATMENT = 1 + SUBMODE_WAIT_FOR_DISINFECT = 2 + SUBMODE_DG_FLUSH_IN_PROGRESS = 3 + SUBMODE_DG_HEAT_DISINFECT_IN_PROGRESS = 4 + SUBMODE_DG_CHEMICAL_DISINFECT_IN_PROGRESS = 5 + NUM_OF_MODES = 6 + @unique class PreTreatmentSubModes(DialinEnum): HD_PRE_TREATMENT_START_STATE = 0 Index: dialin/ui/hd_simulator.py =================================================================== diff -u -r0514a69831286e4727429f57e046f71e73e78110 -rb31694e714c45e0678632ab11efbcdcf6dbf6e96 --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 0514a69831286e4727429f57e046f71e73e78110) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision b31694e714c45e0678632ab11efbcdcf6dbf6e96) @@ -1039,17 +1039,19 @@ TXStates.SALINE_BOLUS_STATE_IDLE, TXStates.HEPARIN_STATE_OFF) - def cmd_set_hd_operation_mode_data(self, operation_mode): + def cmd_set_hd_operation_mode_data(self, operation_mode: int, operation_sub_mode: int) -> None: """ The HD Operation Mode Data message setter/sender method | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(U32) | |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: | |0x2500| 0x040 | 7 | 1 Hz | N | HD | All | HD Operation Mode Data | \ref Data::mOpMode | :param operation_mode: (int) Operation Mode - :return: none + :param operation_sub_mode: (int) Operation Sub-Mode + :return: None """ payload = integer_to_bytearray(operation_mode) + payload += integer_to_bytearray(operation_sub_mode) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_sync_broadcast_ch_id, message_id=MsgIds.MSG_ID_HD_OP_MODE.value, Index: tests/peter/test_POST.py =================================================================== diff -u -r33ca5c4128dec6677a0c8bd8e69e439521f6120a -rb31694e714c45e0678632ab11efbcdcf6dbf6e96 --- tests/peter/test_POST.py (.../test_POST.py) (revision 33ca5c4128dec6677a0c8bd8e69e439521f6120a) +++ tests/peter/test_POST.py (.../test_POST.py) (revision b31694e714c45e0678632ab11efbcdcf6dbf6e96) @@ -18,24 +18,22 @@ sys.path.append("../../") from dialin import HDSimulator, DGSimulator from time import sleep +from dialin.common import HDOpModes, HDOpSubModes SUCCESS = 1 FAILURE = 0 NUM_HD_TESTS = 8 NUM_DG_TESTS = 6 -hd_sim = HDSimulator(log_level="DEBUG") -dg_sim = DGSimulator(log_level="DEBUG") +hd_sim = HDSimulator() +dg_sim = DGSimulator() -for test_num in range(NUM_HD_TESTS-1): - hd_sim.cmd_send_hd_post_single_result(SUCCESS, test_num=test_num) - sleep(1) -hd_sim.cmd_send_hd_post_single_result(FAILURE, test_num=7) -hd_sim.cmd_send_hd_post_final_result(FAILURE) +for _ in range(40): + hd_sim.cmd_set_hd_operation_mode_data(HDOpModes.MODE_INIT.value, HDOpSubModes.SUBMODE_START.value) + sleep(0.25) -for test_num in range(NUM_DG_TESTS-1): - dg_sim.cmd_send_dg_post_single_result(SUCCESS, test_num=test_num) - sleep(1) -dg_sim.cmd_send_dg_post_single_result(FAILURE, test_num=5) -dg_sim.cmd_send_dg_post_final_result(FAILURE) +dg_sim.cmd_send_dg_post_final_result(SUCCESS) +hd_sim.cmd_send_hd_post_final_result(SUCCESS) +sleep(2) +hd_sim.cmd_set_hd_operation_mode_data(HDOpModes.MODE_STAN.value, HDOpSubModes.SUBMODE_START.value)