Index: dialin/ui/hd_simulator.py =================================================================== diff -u -re0ee1c47b7d49ff63855c1c5c2f35a0ab52b822d -ra0f6037ac5b71cc79554622e1a3406bfba12e795 --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision e0ee1c47b7d49ff63855c1c5c2f35a0ab52b822d) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision a0f6037ac5b71cc79554622e1a3406bfba12e795) @@ -42,7 +42,7 @@ def __init__(self, can_interface: str = "can0", log_level: bool = None, console_out: bool = False, - passive_mode: bool = False, + passive_mode: bool = True, auto_response: bool = False): """ The HDSimulator constructor @@ -310,16 +310,15 @@ self.cmd_send_uf_treatment_response(1, 0, uf_volume) - def _handler_ui_first_check_in(self, message)->None: + 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 """ now = time.time() - # if the application is not checking-in (the simulatoe ) within 2 sec it means it has been stopped, + # if the application is not checking-in (the simulator ) within 2 sec it means it has been stopped, # so do the check-in again. - print("check-in: ", now, now - self.checked_in_last) if now - self.checked_in_last > 5: self.checked_in = False @@ -328,7 +327,6 @@ if self.checked_in: return - print("_handler_ui_first_check_in") self.cmd_send_power_on_self_test_version_request() for i in range(20): self.cmd_send_hd_post(i, True, False) @@ -1938,21 +1936,19 @@ @param message: The ui version response message @return: None """ - major = struct.unpack('B', bytearray( - message['message'][self.START_POS_MAJOR:self.END_POS_MAJOR])) - minor = struct.unpack('B', bytearray( - message['message'][self.START_POS_MINOR:self.END_POS_MINOR])) - micro = struct.unpack('B', bytearray( - message['message'][self.START_POS_MICRO:self.END_POS_MICRO])) - build = struct.unpack('H', bytearray( - message['message'][self.START_POS_BUILD:self.END_POS_BUILD])) - compatibility = struct.unpack('H', bytearray( - message['message'][self.START_POS_COMPAT:self.END_POS_COMPAT])) + payload = message['message'] + index = DenaliMessage.PAYLOAD_START_INDEX + major, index = bytearray_to_byte(payload, index, False) + minor, index = bytearray_to_byte(payload, index, False) + micro, index = bytearray_to_byte(payload, index, False) + build, index = bytearray_to_short(payload, index, False) + compt, index = bytearray_to_integer(payload, index, False) - if all([len(each) > 0 for each in [major, minor, micro, build]]): - self.ui_version = f"v{major[0]}.{minor[0]}.{micro[0]}-{build[0]}-{compatibility[0]}" - self.logger.debug(f"UI VERSION: {self.ui_version}") + self.ui_version = f"v{major}.{minor}.{micro}-{build},{compt}" + self.logger.debug(f"UI VERSION: {self.ui_version}") + print("version: ", self.ui_version) + def cmd_send_hd_request_ui_version(self) -> None: """ send HD request for UI version