From dd84d3ff28816a22a911bb26b435026b728676db Mon Sep 17 00:00:00 2001 From: tao_z <tzj0429@163.com> Date: Sun, 07 Aug 2022 21:42:44 +0800 Subject: [PATCH] 针对B41V修改 --- widgets/ShifterTool.py | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-) diff --git a/widgets/ShifterTool.py b/widgets/ShifterTool.py index 3d5513d..0fb5bd0 100644 --- a/widgets/ShifterTool.py +++ b/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,13 +606,13 @@ 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] self._usbcan = USBCAN(device_type=4, device_index=0, - can_index=0, + can_index=self.devicedescription.channel, bitrate=bitrate, can_filters=can_filters) if not self._usbcan.InitAndStart(): @@ -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 @@ -750,7 +750,6 @@ pass def TestPresentEvent(self): - self.udsclient. if self.UI.radioButton.isChecked(): self.TestPresentTimer.start(3000) else: @@ -787,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)") @@ -1007,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: # 检查编程条件 @@ -1042,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('>>> 请求下载驱动文件') -- Gitblit v1.8.0