修改了次级配电协议,优化消息结构
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#include "PowerManagerFsm.hpp"
|
||||
|
||||
// StandbyState实现
|
||||
void StandbyState::entry() {
|
||||
PowerManagerFsm::entry();
|
||||
pm->m_driver.getSTANDBYTable(&pm->m_subDisSysCmd);
|
||||
pm->m_CcuColCmd.fcuCmd = FcuCommand::Stop;
|
||||
// pm->m_CcuColCmd.powerBatCmd = BatteryCommand::Stop;
|
||||
pm->m_CcuColCmd.powerBatCmd = BatteryCommand::Start;
|
||||
pm->workCondition = WorkCondition::STANDBY;
|
||||
LOG_F(INFO, "WorkCondition %d", pm->workCondition);
|
||||
}
|
||||
void StandbyState::react(StandbyEvent const &) {
|
||||
transit<StandbyState>();
|
||||
}
|
||||
void StandbyState::react(MasterCommandEvent const &) {
|
||||
PowerManagerFsm::handelPowerCmd();
|
||||
PowerManagerFsm::handleModCmd();
|
||||
PowerManagerFsm::handleWorkCmd();
|
||||
}
|
||||
|
||||
void StandbyState::react(DevCmdExt const &e)
|
||||
{
|
||||
LOG_F(INFO, "StandbyState::react(DevCmdExt const &e)");
|
||||
//正常模式下,不允许执行DevCmdExt
|
||||
if (pm->currentMod == RunMode::Normal )
|
||||
{
|
||||
LOG_F(INFO, "正常模式下,不允许执行DevCmdExt");
|
||||
}
|
||||
else if (pm->currentMod == RunMode::Test)
|
||||
{
|
||||
if(handPowerProtection(e))
|
||||
PowerManagerFsm::react(e);
|
||||
else
|
||||
LOG_F(INFO, "DevCmdExt 执行失败");
|
||||
}
|
||||
else if (pm->currentMod == RunMode::Debug)
|
||||
{
|
||||
LOG_F(INFO, "调试模式下,直接执行DevCmdExt");
|
||||
PowerManagerFsm::react(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_F(INFO, "当前模式未知");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void StandbyState::handlePowerOn() {
|
||||
LOG_F(INFO,"动力电上电");
|
||||
//TODO: 电源上电 更新协议
|
||||
// PowerManagerFsm::pm->m_CcuColCmd.powerBatCmd = 0x10;
|
||||
// if(PowerManagerFsm::pm->m_pmCurrentState.ccustate.fcuState == 0x04)
|
||||
// PowerManagerFsm::pm->m_CcuColCmd.fcuCmd = 0x02;
|
||||
}
|
||||
Reference in New Issue
Block a user