优化通信代码,修复状态机的bug
This commit is contained in:
@@ -8,12 +8,15 @@ PowerManger* PowerManagerFsm::pm = nullptr;
|
||||
|
||||
// InitState实现
|
||||
void InitState::entry() {
|
||||
PowerManagerFsm::entry();
|
||||
std::cout << "===========================" << std::endl;
|
||||
// PowerManagerFsm::pm->m_pmEvent = "初始化状态";
|
||||
PowerManagerFsm::pm->printState("InitState", "进入初始化状态");
|
||||
}
|
||||
|
||||
void InitState::react(InitEvent const &) {
|
||||
// double StartTime = PowerManagerFsm::pm->GetAppStartTime();
|
||||
std::cout << "开始初始化" << std::endl;
|
||||
double StartTime = 0;
|
||||
while (PowerManagerFsm::pm->connectState < 5) {
|
||||
MOOSPause(1000);
|
||||
@@ -49,10 +52,14 @@ void InitState::react(InitEvent const &) {
|
||||
MOOSPause(1000);
|
||||
PowerManagerFsm::pm->printState("InitState", PowerManagerFsm::pm->m_pmEvent);
|
||||
}
|
||||
std::cout << "InitState: 初始化完成" << std::endl;
|
||||
//转换到待机状态
|
||||
transit<StandbyState>();
|
||||
}
|
||||
|
||||
// StandbyState实现
|
||||
void StandbyState::entry() {
|
||||
PowerManagerFsm::entry();
|
||||
PowerManagerFsm::pm->printState("StandbyState", "进入待机状态");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user