#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @文件 :bms_work.py @时间 :2024/03/09 13:28:43 @作者 :FF @版本 :1.0 @邮箱 :fanchcho@gmail.com @说明 :BMS工作线程 ''' from utils.globalvar import SD from utils.qt import QObject, Signal class BmsReceived(QObject): to_show_masterid_signal = Signal(int) to_show_0000_signal = Signal(object, int) to_show_0001_signal = Signal(object, int) to_show_0002_signal = Signal(object, int) to_show_0003_signal = Signal(object, int) to_show_0004_signal = Signal(object, int) to_show_0005_signal = Signal(object, int) to_show_0006_signal = Signal(object, int) to_show_0007_signal = Signal(object, int) to_show_0008_signal = Signal(object, int) to_show_0009_signal = Signal(object, int) to_show_000A_signal = Signal(object, int) to_show_000B_signal = Signal(object, int) to_show_000C_signal = Signal(object, int) to_show_000D_signal = Signal(object, int) to_show_000E_signal = Signal(object, int) to_show_000F_signal = Signal(object, int) to_show_0010_signal = Signal(object, int) to_show_0011_signal = Signal(object, int) to_show_0012_signal = Signal(object, int) to_show_0013_signal = Signal(object, int) to_show_0014_signal = Signal(object, int) to_show_0015_signal = Signal(object, int) to_show_0016_signal = Signal(object, int) to_show_0017_signal = Signal(object, int) to_show_0018_signal = Signal(object, int) to_show_0019_signal = Signal(object, int) to_show_001A_signal = Signal(object, int) to_show_001B_signal = Signal(object, int) to_show_001C_signal = Signal(object, int) to_show_001D_signal = Signal(object, int) to_show_001E_signal = Signal(object, int) to_show_001F_signal = Signal(object, int) to_show_0020_signal = Signal(object, int) to_show_0021_signal = Signal(object, int) to_show_0022_signal = Signal(object, int) to_show_0023_signal = Signal(object, int) def __init__(self): super(BmsReceived, self).__init__() self.dantidianya = [0 for i in range(10000)] self.dantiwendu = [0 for i in range(10000)] self.masterVersion = ["" for i in range(18)] self.fram_param = ["" for i in range(24)] self.single_low_vol_x = "" self.single_high_temp_x = "" # 接收数据 def received(self): while SD.CAN_ON_OFF: result = SD.CAN_CONTROL.receive() if (result[1]): # ID主机号识别 if result[1] & 0xFFFF == 1: self.to_show_masterid_signal.emit((result[1] >> 16) & 0xFF) # 0001 if (result[1] ^ 0x18000000) & 0xFFFF == 0: self.to_show_0000_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0001 if (result[1] ^ 0x18000001) & 0xFFFF == 0: self.to_show_0001_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0002 elif (result[1] ^ 0x18000002) & 0xFFFF == 0: self.to_show_0002_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0003 elif (result[1] ^ 0x18000003) & 0xFFFF == 0: self.to_show_0003_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0004 elif (result[1] ^ 0x18000004) & 0xFFFF == 0: self.to_show_0004_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0005 elif (result[1] ^ 0x18000005) & 0xFFFF == 0: self.to_show_0005_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0006 elif (result[1] ^ 0x18000006) & 0xFFFF == 0: self.to_show_0006_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0007 elif (result[1] ^ 0x18000007) & 0xFFFF == 0: self.to_show_0007_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0008 elif (result[1] ^ 0x18000008) & 0xFFFF == 0: self.to_show_0008_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0009 elif (result[1] ^ 0x18000009) & 0xFFFF == 0: self.to_show_0009_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 000A elif (result[1] ^ 0x1800000A) & 0xFFFF == 0: self.to_show_000A_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 000B elif (result[1] ^ 0x1800000B) & 0xFFFF == 0: self.to_show_000B_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 000C elif (result[1] ^ 0x1800000C) & 0xFFFF == 0: self.to_show_000C_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 000D elif (result[1] ^ 0x1800000D) & 0xFFFF == 0: self.to_show_000D_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 000E elif (result[1] ^ 0x1800000E) & 0xFFFF == 0: self.to_show_000E_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 000F elif (result[1] ^ 0x1800000F) & 0xFFFF == 0: self.to_show_000F_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0010 elif (result[1] ^ 0x18000010) & 0xFFFF == 0: self.to_show_0010_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0011 elif (result[1] ^ 0x18000011) & 0xFFFF == 0: self.to_show_0011_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0012 elif (result[1] ^ 0x18000012) & 0xFFFF == 0: self.to_show_0012_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0013 elif (result[1] ^ 0x18000013) & 0xFFFF == 0: self.to_show_0013_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0014 elif (result[1] ^ 0x18000014) & 0xFFFF == 0: self.to_show_0014_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0015 elif (result[1] ^ 0x18000015) & 0xFFFF == 0: self.to_show_0015_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0016 elif (result[1] ^ 0x18000016) & 0xFFFF == 0: self.to_show_0016_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0017 elif (result[1] ^ 0x18000017) & 0xFFFF == 0: self.to_show_0017_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0018 elif (result[1] ^ 0x18000018) & 0xFFFF == 0: self.to_show_0018_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0019 elif (result[1] ^ 0x18000019) & 0xFFFF == 0: self.to_show_0019_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 001A elif (result[1] ^ 0x1800001A) & 0xFFFF == 0: self.to_show_001A_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 001B elif (result[1] ^ 0x1800001B) & 0xFFFF == 0: self.to_show_001B_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 001C elif (result[1] ^ 0x1800001C) & 0xFFFF == 0: self.to_show_001C_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 001D elif (result[1] ^ 0x1800001D) & 0xFFFF == 0: self.to_show_001D_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 001E elif (result[1] ^ 0x1800001E) & 0xFFFF == 0: self.to_show_001E_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 001F elif (result[1] ^ 0x1800001F) & 0xFFFF == 0: self.to_show_001F_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0020 elif (result[1] ^ 0x18000020) & 0xFFFF == 0: self.to_show_0020_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0021 elif (result[1] ^ 0x18000021) & 0xFFFF == 0: self.to_show_0021_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0022 elif (result[1] ^ 0x18000022) & 0xFFFF == 0: self.to_show_0022_signal.emit(result[2], (result[1] >> 16) & 0xFF) # 0023 elif (result[1] ^ 0x18000023) & 0xFFFF == 0: self.to_show_0023_signal.emit(result[2], (result[1] >> 16) & 0xFF)