Index: dialin/common/msg_defs.py =================================================================== diff -u -r8ea13ae6dd10732bfcc456798f4785c4d88c95d3 -r120e6925083c799b20143834e431bdc9f34c3687 --- dialin/common/msg_defs.py (.../msg_defs.py) (revision 8ea13ae6dd10732bfcc456798f4785c4d88c95d3) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision 120e6925083c799b20143834e431bdc9f34c3687) @@ -161,6 +161,7 @@ MSG_ID_HEAT_DISINFECT_RSRVR2_TO_RSRVR1_DURATION_MINS = 0xA01F # Heat disinfection reservoir 2 to reservoir 1 duration in minutes MSG_ID_HEAT_DISINFECT_NO_OF_CYCLES_TO_RUN = 0xA020 # Heat disinfection number of cycles to run MSG_ID_HEAT_DISINFECT_PUBLISH_INTERVAL_OVERRIDE = 0xA021 # Heat disinfection data publish interval override request + MSG_ID_PRIMING_STATUS = 0xA022 # The priming status MSG_ID_HD_DEBUG_EVENT = 0xFFF1 # HD debug event text to be logged in event log MSG_ID_DG_DEBUG_EVENT = 0xFFF2 # DG debug event text to be logged in event log Index: dialin/ui/hd_proxy.py =================================================================== diff -u -r8ea13ae6dd10732bfcc456798f4785c4d88c95d3 -r120e6925083c799b20143834e431bdc9f34c3687 --- dialin/ui/hd_proxy.py (.../hd_proxy.py) (revision 8ea13ae6dd10732bfcc456798f4785c4d88c95d3) +++ dialin/ui/hd_proxy.py (.../hd_proxy.py) (revision 120e6925083c799b20143834e431bdc9f34c3687) @@ -114,3 +114,21 @@ self.can_interface.send(message, 0) + + def cmd_send_priming_time_remaining(self, state, seconds_remaining, seconds_total): + """ + Broadcasts the number of seconds remaining in priming to the UI + + @return: None + """ + + payload = bytearray() + payload += integer_to_bytearray(state) + payload += integer_to_bytearray(seconds_remaining) + payload += integer_to_bytearray(seconds_total) + + message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_sync_broadcast_ch_id, + message_id=MsgIds.MSG_ID_PRIMING_STATUS.value, + payload=payload) + + self.can_interface.send(message, 0) Index: tests/test_hd_simulator.py =================================================================== diff -u -r8ea13ae6dd10732bfcc456798f4785c4d88c95d3 -r120e6925083c799b20143834e431bdc9f34c3687 --- tests/test_hd_simulator.py (.../test_hd_simulator.py) (revision 8ea13ae6dd10732bfcc456798f4785c4d88c95d3) +++ tests/test_hd_simulator.py (.../test_hd_simulator.py) (revision 120e6925083c799b20143834e431bdc9f34c3687) @@ -107,13 +107,26 @@ ] hd_simulator.cmd_send_treatment_parameter_validation_response(rejections) +def test_priming(): + hd_simulator = HDSimulator(log_level="DEBUG") + state = 0 + total_seconds = 100 + for seconds_remaining in range(total_seconds, -1, -1): + if seconds_remaining % (total_seconds // 3) == 0: + state += 1 + hd_simulator.cmd_send_priming_time_remaining(state, seconds_remaining, total_seconds) + sleep(0.05) + + if __name__ == '__main__': # test_clear_alarms() # sleep(1) # test_poweroff() - test_valid_parameters() + # test_valid_parameters() + test_priming() +