Franike 4 miesięcy temu
rodzic
commit
72964e8862
2 zmienionych plików z 15 dodań i 9 usunięć
  1. 7 7
      controller/bms_main_ctl.py
  2. 8 2
      widget/bms_main.py

+ 7 - 7
controller/bms_main_ctl.py

@@ -29,8 +29,8 @@ class BmsMainControll:
         self._view.fault_release_signal.connect(self.operate1)
         self._view.jy_signal.connect(self.operate2)
         self._view.jy_one_signal.connect(self.operate3)
-        self._view.chg_mos_signal.connect(self.operate4)
-        self._view.dchg_mos_signal.connect(self.operate5)
+        self._view.dchg_mos_signal.connect(self.operate4)
+        self._view.chg_mos_signal.connect(self.operate5)
         self._view.pre_mos_signal.connect(self.operate6)
         self._view.gjd1_signal.connect(self.operate7)
         self._view.gjd2_signal.connect(self.operate8)
@@ -212,7 +212,7 @@ class BmsMainControll:
                 data += (8 - len(data)) * [0]
             data[0] = 0x01
             data[1] = 0xC0
-            data[2] = (do7_status << 1) & 0xFF
+            data[2] = (do7_status << 5) & 0xFF
             data[3] = 0
             msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1804, data)
         except:
@@ -226,7 +226,7 @@ class BmsMainControll:
                 data += (8 - len(data)) * [0]
             data[0] = 0x01
             data[1] = 0xC0
-            data[2] = (do8_status << 1) & 0xFF
+            data[2] = (do8_status << 6) & 0xFF
             data[3] = 0
             msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1804, data)
         except:
@@ -381,7 +381,7 @@ class BmsMainControll:
             data[0] = 0x00
             data[1] = 0xC0
             data[2] = 0
-            data[3] = (status >> 1) & 0xFF
+            data[3] = (status << 1) & 0xFF
             msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1804, data)
         except:
             self._view.can_connect_error()
@@ -395,7 +395,7 @@ class BmsMainControll:
             data[0] = 0x00
             data[1] = 0xC0
             data[2] = 0
-            data[3] = (status >> 2) & 0xFF
+            data[3] = (status << 2) & 0xFF
             msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1804, data)
         except:
             self._view.can_connect_error()
@@ -409,7 +409,7 @@ class BmsMainControll:
             data[0] = 0x00
             data[1] = 0xC0
             data[2] = 0
-            data[3] = (status >> 4) & 0xFF
+            data[3] = (status << 4) & 0xFF
             msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1804, data)
         except:
             self._view.can_connect_error()

+ 8 - 2
widget/bms_main.py

@@ -46,7 +46,8 @@ class Win_Main(Main, MyFrame):
         self.under_widget.snkz_check_box.stateChanged.connect(self._controll_sys)
         self.under_widget.p_check_box.stateChanged.connect(self._do1)
         self.under_widget.n_check_box.stateChanged.connect(self._do2)
-        self.under_widget.pre_check_box.stateChanged.connect(self._do3)
+        # self.under_widget.pre_check_box.stateChanged.connect(self._do3)
+        self.under_widget.pre_check_box.stateChanged.connect(self._prev_check)
         self.under_widget.center_check_box.stateChanged.connect(self._do4)
         self.under_widget.dlq_check_box.stateChanged.connect(self._do5)
         self.under_widget.do6_check_box.stateChanged.connect(self._do6)
@@ -58,7 +59,7 @@ class Win_Main(Main, MyFrame):
         self.under_widget.again_one_check_box.stateChanged.connect(self._again_one)
         self.under_widget.chg_check_box.stateChanged.connect(self._chg)
         self.under_widget.dchg_check_box.stateChanged.connect(self._dchg)
-        self.under_widget.pre_check_box.stateChanged.connect(self._pre)
+        # self.under_widget.pre_check_box.stateChanged.connect(self._pre)
         self.under_widget.gjd1_check_box.stateChanged.connect(self._gjd1)
         self.under_widget.gjd2_check_box.stateChanged.connect(self._gjd2)
         self.under_widget.qiangzhi_chg_check_box.stateChanged.connect(self._qiangzhi_chg)
@@ -162,6 +163,11 @@ class Win_Main(Main, MyFrame):
     def _fan(self, data):
         self.fan_signal.emit(data)
 
+    def _prev_check(self,data):
+        if SD.CCU_TYPE == 1:
+            self._do3(data)
+        else:
+            self._pre(data)
 
     def can_connect_error(self):
         QMessageBox.critical(self, "连接状态" if SD.SYSTEM_LANGUAGE == 0 else "Connect State", "CAN 连接失败!" if SD.SYSTEM_LANGUAGE == 0 else "CAN Connect Error!")