| | |
| | | # # meg = Message() |
| | | # # msg = VCI_CAN_OBJ() |
| | | from ast import arg |
| | | import encodings |
| | | import threading |
| | | from tkinter.tix import Tree |
| | | from USBCAN import * |
| | |
| | | from multiprocessing import Process, Queue, Value, Pipe |
| | | import datetime |
| | | from ShifterDefine import * |
| | | import cantools |
| | | from pprint import pprint |
| | | import binascii |
| | | from hexread import * |
| | | # def rece_msg(bus): |
| | | # msg = bus.Receive(0.1) |
| | | # if msg[0] is not None: |
| | |
| | | "IndicationLEDControl": 0x8101 |
| | | } |
| | | |
| | | print(DID_dic["IndicationLEDControl"]) |
| | | # print(DID_dic["IndicationLEDControl"]) |
| | | |
| | | # def f(conn): |
| | | # conn.send([1, 'test', None]) |
| | |
| | | # # w.show() |
| | | |
| | | # sys.exit(app.exec_()) |
| | | |
| | | # dbc = cantools.database.load_file("DBC/SX7H.dbc") |
| | | # # print(dbc.messages) |
| | | # sa_message = dbc.get_message_by_name('SA1') |
| | | # # print(sa_message) |
| | | # # pprint(sa_message.signals) |
| | | # frame = [0x00, 0x0A, 0x00, 0xF0, 0, 0, 0, 0] |
| | | # input_signal = dbc.decode_message(0x420, frame) |
| | | # part_str = str(input_signal['SA1_Status_ParkButtonReq']) |
| | | # pprint(part_str) |
| | | # if input_signal['SA1_Status_ParkButtonReq'] == 'No request': |
| | | # print('yes') |
| | | |
| | | # data = sa_message.encode({ |
| | | # 'SA1_Status_PRNDL': 0, |
| | | # 'SA1_Status_GearShftPosReq': 0, #'Shifter position Zero', |
| | | # 'SA1_Status_ParkButtonReq': 2, |
| | | # "SA1_ShifterManualSignal": 0, |
| | | # "SA1_ShifterModeSignal": 1, |
| | | # "SA1_Status_ShftSensSng_Fault": 0, |
| | | # "SA1_IND_ShifterMisUsd": 0, |
| | | # "SA1_Live_counter": 1, |
| | | # "SA1_Status_UnlockButtonReq": 1, |
| | | # "SA1_Status_EcoShifterModeReq": 0, |
| | | # "SA1_Status_RqGearPosInV": 0xf, |
| | | # "SA1_Status_ShiftPosValidFlag": 0, |
| | | # }) |
| | | # print(data) |
| | | # print(SA1_Status_ParkButtonReq_dic['No request']) |
| | | |
| | | with open(r"./source bin/SX7H_Shifter.bin", 'rb') as fd: |
| | | bin_file = fd.read() |
| | | print(bin_file[0:20]) |
| | | print('=====================================================') |
| | | |
| | | hex_rd = Hex_read() |
| | | hex_rd.Open_file(r"./source bin/SX7H_Shifter.hex") |
| | | hex_file = hex_rd.data |
| | | print(hex_file[0:20]) |
| | | |
| | | aa = binascii.a2b_hex(hex_file) |
| | | print(aa[0:20]) |