tao_z
2022-08-07 dd84d3ff28816a22a911bb26b435026b728676db
widgets/ShifterTool.py
@@ -346,7 +346,7 @@
                                     output_key_temp & 0xFF)
            # output_key_temp = ((((temp_key >> 4) ^ temp_key)
            #                     << 3) ^ temp_key) & 0xFFFFFFFF
        elif level == 0x09:
        elif level == 0x11:
            output_key_temp = 0x70237577
            output_key = struct.pack('BBBB', (output_key_temp >> 24) & 0xFF,
                                     (output_key_temp >> 16) & 0xFF,
@@ -551,7 +551,7 @@
                        self.needdisconnect.value = 0
                        self._isOpen.value = 0
                else:
                    msg, num = self._usbcan.Receive(len=1)
                    msg, num = self._usbcan.Receive(len=10, timeout=10)
                    if not num == 0:
                        for i in range(num):
                            if msg[i].arbitration_id == self.shifter.canid.phy_txId:
@@ -606,7 +606,7 @@
        if self._isOpen.value == 0:
            if self._usbcan is None:
                self.update_HardwareDevice()
                can_filters = [{'can_id': 0x420, 'can_mask': 0xFFFFFFFF}]
                can_filters = [{'can_id': 0x5E0, 'can_mask': 0xFFFFFFFF}]
                bitrate = list(
                    TIMING_DICT.keys())[self.devicedescription.baudrate]
@@ -721,14 +721,14 @@
        for i in range(_dataSize):
            receiveNum += 1
            msg = self.msgQueue.get()
            if msg.arbitration_id == 0x420:
                self.shifter.FramUnpack(msg.arbitration_id, msg.data)
                resp_data = self.Vehicle.ShiftLogic(self.shifter)
                self.send_VehiclePosition(resp_data)
            # if msg.arbitration_id == 0x420:
            #     self.shifter.FramUnpack(msg.arbitration_id, msg.data)
            #     resp_data = self.Vehicle.ShiftLogic(self.shifter)
            #     self.send_VehiclePosition(resp_data)
            formateddata.append(self._formatMsgData(
                receiveNum, msg, True))  # return a data list
        self._insertDataSmooth(data=formateddata, datasize=_dataSize)
        self.dispShiftstatus()
        # self.dispShiftstatus()
    def _insertDataSmooth(self, data, datasize):
        # row = 6-datasize
@@ -786,7 +786,7 @@
                "background-color:rgb(255, 85, 127)")
    def SecurityUnlockLevel_2(self):
        data = self.udsclient.unlock_security_access(9)
        data = self.udsclient.unlock_security_access(0x11)
        if data.positive:
            self.UI.pushButton_32.setStyleSheet(
                "background-color:rgb(255, 85, 127)")
@@ -1006,7 +1006,7 @@
            response = self.udsclient.change_session(3)
            if response.positive:
                self.disp_string('>>> 解锁安全访问')
                response = self.udsclient.unlock_security_access(9)
                response = self.udsclient.unlock_security_access(0x11)
            if response.positive:
                # 检查编程条件
@@ -1041,7 +1041,7 @@
        if response.positive:
            # 安全访问
            self.disp_string('>>> 安全访问')
            response = self.udsclient.unlock_security_access(9)
            response = self.udsclient.unlock_security_access(0x11)
        # print(response)
        if response.positive:
            self.disp_string('>>> 请求下载驱动文件')