72 lines
3.9 KiB
C++
72 lines
3.9 KiB
C++
#include "PowerManagerFsm.hpp"
|
|
|
|
|
|
// DJMode实现
|
|
void DJMode::react(MasterCommandEvent const &) {
|
|
PowerManagerFsm::handelPowerCmd();
|
|
PowerManagerFsm::handleModCmd();
|
|
PowerManagerFsm::handleWorkCmd();
|
|
}
|
|
|
|
void DJMode::entry() {
|
|
PowerManagerFsm::entry();
|
|
pm->workCondition = WorkCondition::CHANING;
|
|
handleCuriseWork();
|
|
//1 启动载荷装置
|
|
pm->m_subDisSysCmd.launchControler = 1;
|
|
//启动启闭机构和电缸
|
|
unsigned char cmd = 1;
|
|
//2.1 启闭机构
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover1, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover2, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover3, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover4, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover5, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover6, (unsigned char)cmd);
|
|
pm->m_upperCommManager->processPeriodicTasks();
|
|
MOOSPause(10);
|
|
pm->m_lowerCommManager->operate_HVA_actuatorCircuit_Breaker(1);
|
|
//2.2 敞水电缸
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet1, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet2, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet3, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet4, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet5, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet6, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet7, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet8, (unsigned char)cmd);
|
|
pm->m_upperCommManager->processPeriodicTasks();
|
|
MOOSPause(10);
|
|
pm->m_lowerCommManager->operate_HVA_openWaterCoverStartCylinderCircuit_Breaker(1);
|
|
pm->workCondition = WorkCondition::DJ_MODE;
|
|
LOG_F(INFO, "进入DJ模式");
|
|
}
|
|
|
|
|
|
void DJMode::exit() {
|
|
PowerManagerFsm::exit();
|
|
//1 解除启闭机构
|
|
unsigned char cmd = 0;
|
|
pm->m_lowerCommManager->operate_HVA_actuatorCircuit_Breaker(0);
|
|
MOOSPause(3);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover1, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover2, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover3, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover4, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover5, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowCover6, (unsigned char)cmd);
|
|
pm->m_upperCommManager->processPeriodicTasks();
|
|
//2 解除敞水机构
|
|
pm->m_lowerCommManager->operate_HVA_openWaterCoverStartCylinderCircuit_Breaker(0);
|
|
MOOSPause(3);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet1, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet2, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet3, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet4, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet5, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet6, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet7, (unsigned char)cmd);
|
|
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::bowWaterInet8, (unsigned char)cmd);
|
|
pm->m_upperCommManager->processPeriodicTasks();
|
|
}
|