修复了程序在启动时偶尔崩溃的问题

This commit is contained in:
zjk
2026-01-27 20:45:00 +08:00
parent b5ca051831
commit e5193bd7f7
9 changed files with 456 additions and 133 deletions
+31 -9
View File
@@ -1764,15 +1764,37 @@ class PowerManagerApp:
self.simulation_LowBusFbMsg.reservedCircuitBreaker2 = self.simulation_LVBCmdMsg.reservedCircuitBreaker2
self.simulation_LowBusFbMsg.emergencyLithiumBatteryGroup1CircuitBreaker = self.simulation_LVBCmdMsg.emergencyLithiumBatteryGroup1CircuitBreaker
self.send_udp_command(self.simulation_HighVolBusFbMsg.pack(), self.udp_ip, self.udp_port)
time.sleep(1)
self.send_udp_command(self.simulation_HighAVolBusFbMsg.pack(), self.udp_ip, self.udp_port)
time.sleep(1)
self.send_udp_command(self.simulation_LowBusFbMsg.pack(), self.udp_ip, self.udp_port)
time.sleep(1)
self.send_udp_command(self.simulation_LowMainBusFbMsg.pack(), self.udp_ip, self.udp_port)
time.sleep(1) # 1秒间隔
# self.send_udp_command(self.simulation_HighVolBusFbMsg.pack(), self.udp_ip, self.udp_control_port)
# time.sleep(0.1)
# self.send_udp_command(self.simulation_HighAVolBusFbMsg.pack(), self.udp_ip, self.udp_control_port)
# time.sleep(0.1)
# self.send_udp_command(self.simulation_LowBusFbMsg.pack(), self.udp_ip, self.udp_control_port)
# time.sleep(0.1)
# self.send_udp_command(self.simulation_LowMainBusFbMsg.pack(), self.udp_ip, self.udp_control_port)
# time.sleep(0.1) # 1秒间隔
# 处理高压母线数据
packed_data = self.simulation_HighVolBusFbMsg.pack()
error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(error_packed_data, self.udp_ip, self.udp_control_port)
# time.sleep(0.1)
# 处理高压A母线数据
packed_data = self.simulation_HighAVolBusFbMsg.pack()
error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(error_packed_data, self.udp_ip, self.udp_control_port)
# time.sleep(0.01)
# 处理低压母线数据
packed_data = self.simulation_LowBusFbMsg.pack()
error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(error_packed_data, self.udp_ip, self.udp_control_port)
# time.sleep(0.01)
# 处理仪表主母线数据
packed_data = self.simulation_LowMainBusFbMsg.pack()
error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(error_packed_data, self.udp_ip, self.udp_control_port)
time.sleep(0.01) # 1秒间隔
def on_connection_changed(self, *args):
"""连接状态改变回调"""
if self.Start_Connection.get():
@@ -1899,4 +1921,4 @@ if __name__ == "__main__":
root.protocol("WM_DELETE_WINDOW", app.on_closing)
print('start')
root.mainloop()
print('end')
print('end')