Index: dialin/protocols/CAN.py =================================================================== diff -u -r9ae90e7b14dc11b1f6fa631caecc75d68d7f68e8 -rab51b17355d6fcd68817af7a1134e2b397809cfa --- dialin/protocols/CAN.py (.../CAN.py) (revision 9ae90e7b14dc11b1f6fa631caecc75d68d7f68e8) +++ dialin/protocols/CAN.py (.../CAN.py) (revision ab51b17355d6fcd68817af7a1134e2b397809cfa) @@ -21,6 +21,7 @@ import can import math from time import sleep +from datetime import datetime import sys from logging import Logger import struct @@ -784,6 +785,7 @@ :return: None """ print( + datetime.now().time(), " " # can id f"{(complete_dialin_message['channel_id']):0{3}X}" " " # head tag Index: dialin/ui/hd_simulator.py =================================================================== diff -u -raf9e093318463eb6111bca2c925ffaad4f5b2773 -rab51b17355d6fcd68817af7a1134e2b397809cfa --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision af9e093318463eb6111bca2c925ffaad4f5b2773) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision ab51b17355d6fcd68817af7a1134e2b397809cfa) @@ -45,7 +45,7 @@ """ super().__init__() HDSimulator.instance_count = HDSimulator.instance_count + 1 - + self.checked_in = False self._log_manager = _LogManager(log_level=log_level, log_filepath=self.__class__.__name__ + ".log") self.logger = self._log_manager.logger self.console_out = console_out @@ -61,6 +61,9 @@ if auto_response: self.can_interface.register_receiving_publication_function(channel_id, + MsgIds.MSG_ID_UI_CHECK_IN.value, + self._handler_ui_first_check_in) + self.can_interface.register_receiving_publication_function(channel_id, MsgIds.MSG_ID_UI_INITIATE_TREATMENT_REQUEST.value, self._handler_ui_initiate_treatment) self.can_interface.register_receiving_publication_function(channel_id, @@ -291,6 +294,23 @@ self.cmd_send_uf_treatment_response(1, 0, uf_volume) + def _handler_ui_first_check_in(self, message)->None: + """ + Handler function to first check in to start the post + @param message: the check-in message + @return: None + """ + if self.checked_in: + return + + print("_handler_ui_first_check_in") + for i in range(20): + self.cmd_send_hd_post(i, True, False) + sleep(0.1) + self.cmd_send_hd_post(0, True, True) + self.cmd_send_hd_operation_mode(3, 0) + self.checked_in = True + def _handler_ui_initiate_treatment(self, message): """ Handler function to start a treatment