Encode the actual current date in vw_mqb_config.py (#32093)

pull/32157/head
MarinkoMagla 1 year ago committed by GitHub
parent 7a3c03c901
commit 9d1b3cc773
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      selfdrive/debug/vw_mqb_config.py

@ -6,6 +6,7 @@ from enum import IntEnum
from panda import Panda from panda import Panda
from panda.python.uds import UdsClient, MessageTimeoutError, NegativeResponseError, SESSION_TYPE,\ from panda.python.uds import UdsClient, MessageTimeoutError, NegativeResponseError, SESSION_TYPE,\
DATA_IDENTIFIER_TYPE, ACCESS_TYPE DATA_IDENTIFIER_TYPE, ACCESS_TYPE
from datetime import date
# TODO: extend UDS library to allow custom/vendor-defined data identifiers without ignoring type checks # TODO: extend UDS library to allow custom/vendor-defined data identifiers without ignoring type checks
class VOLKSWAGEN_DATA_IDENTIFIER_TYPE(IntEnum): class VOLKSWAGEN_DATA_IDENTIFIER_TYPE(IntEnum):
@ -136,8 +137,10 @@ if __name__ == "__main__":
# last two bytes, but not the VZ/importer or tester serial number # last two bytes, but not the VZ/importer or tester serial number
# Can't seem to read it back, but we can read the calibration tester, # Can't seem to read it back, but we can read the calibration tester,
# so fib a little and say that same tester did the programming # so fib a little and say that same tester did the programming
# TODO: encode the actual current date current_date = date.today()
prog_date = b'\x22\x02\x08' formatted_date = current_date.strftime('%y-%m-%d')
year, month, day = [int(part) for part in formatted_date.split('-')]
prog_date = bytes([year, month, day])
uds_client.write_data_by_identifier(DATA_IDENTIFIER_TYPE.PROGRAMMING_DATE, prog_date) uds_client.write_data_by_identifier(DATA_IDENTIFIER_TYPE.PROGRAMMING_DATE, prog_date)
tester_num = uds_client.read_data_by_identifier(DATA_IDENTIFIER_TYPE.CALIBRATION_REPAIR_SHOP_CODE_OR_CALIBRATION_EQUIPMENT_SERIAL_NUMBER) tester_num = uds_client.read_data_by_identifier(DATA_IDENTIFIER_TYPE.CALIBRATION_REPAIR_SHOP_CODE_OR_CALIBRATION_EQUIPMENT_SERIAL_NUMBER)
uds_client.write_data_by_identifier(DATA_IDENTIFIER_TYPE.REPAIR_SHOP_CODE_OR_TESTER_SERIAL_NUMBER, tester_num) uds_client.write_data_by_identifier(DATA_IDENTIFIER_TYPE.REPAIR_SHOP_CODE_OR_TESTER_SERIAL_NUMBER, tester_num)

Loading…
Cancel
Save