修改了上电操作

This commit is contained in:
zjk
2025-06-24 10:45:37 +08:00
parent 035205101b
commit 45fdc455e9
15 changed files with 3982 additions and 1888 deletions
+23 -2
View File
@@ -341,11 +341,11 @@ void PowerManger::initControlCmd()
//================初始化复合管控=============================
m_CcuColCmd.fcmode = 0x00; //默认无效
m_CcuColCmd.fcuCmd = 0x00; //无效指令
m_CcuColCmd.fcuPowerEfficiency = 15; //默认为15kw
m_CcuColCmd.fcuPowerEfficiency = 8; //默认为8kw
m_CcuColCmd.insChargeEnable = 0x30; //不允许充电
m_CcuColCmd.insBatCmd = 0x00; //无效指令
m_CcuColCmd.powerBatCmd = 0x00; //无效指令
m_CcuColCmd.powerBatEfficiency = 230; //默认为最大
m_CcuColCmd.powerBatEfficiency = 00; //默认为最大
m_CcuColCmd.heartbeat = 0;
m_CcuColCmd.masterState = 0xAA;//主站状态,运行中
//================初始化上位机指令=========================
@@ -373,4 +373,25 @@ void PowerManger::injectFault(unsigned type,unsigned int faultCode){
LOG_F(INFO, "注入故障: %d %d", type, faultCode);
TestEvent testEvent("故障注入测试",type,faultCode);
PowerManagerFsm::dispatch(testEvent);
}
void PowerManger::pushDeviceCommand(DeviceSwitchCmd cmd) {
std::lock_guard<std::mutex> lock(m_deviceCmdMutex);
m_deviceCmdQuenue.push(cmd);
}
bool PowerManger::popDeviceCommand(DeviceSwitchCmd &cmd) {
std::lock_guard<std::mutex> lock(m_deviceCmdMutex);
if(m_deviceCmdQuenue.empty()) {
return false;
}
cmd = m_deviceCmdQuenue.front();
m_deviceCmdQuenue.pop();
return true;
}
bool PowerManger::isDeviceCmdEmpty() const {
std::lock_guard<std::mutex> lock(m_deviceCmdMutex);
return m_deviceCmdQuenue.empty();
}