|
|
@ -15,10 +15,20 @@ string DisinfectionCtrlService::getSetting(SettingId sid) { |
|
|
|
// 1. 从 realtimeCfg 中进行查找
|
|
|
|
// 2. 从 系统配置 中进行查找
|
|
|
|
// m_realtimeCfg.find
|
|
|
|
if (sid == SettingId::loglevel) { |
|
|
|
return fmt::format("{:.2f}", m_tlog); |
|
|
|
} |
|
|
|
auto value = m_realtimeCfg.find(sid); |
|
|
|
if (value != m_realtimeCfg.end()) { |
|
|
|
return value->second; |
|
|
|
} |
|
|
|
if (m_runType == RunType_t::kFormulaMode) { |
|
|
|
string str = GET_SERVICE(FormulaDBDao)->getFormula(m_formulaid, sid); |
|
|
|
if (!str.empty()) { |
|
|
|
return str; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
string str = GET_SERVICE(SettingDBDao)->getSettingValAsString(sid); |
|
|
|
if (str.empty()) { |
|
|
|
THROW_APP_EXCEPTION(err::kappe_is_cant_find_setting_id, "%s", string(sid).c_str()); |
|
|
@ -104,10 +114,11 @@ void DisinfectionCtrlService::initialize() { |
|
|
|
GET_TO_SERVICE(db); |
|
|
|
GET_TO_SERVICE(ds); |
|
|
|
GET_TO_SERVICE(gConfig); |
|
|
|
GET_TO_SERVICE(dcs); |
|
|
|
GET_TO_SERVICE(dics); |
|
|
|
GET_TO_SERVICE(dwus); |
|
|
|
|
|
|
|
sm.regStateProcesser(DisinfectionState::idle, bind(&DisinfectionCtrlService::processStateIdle, this, placeholders::_1)); |
|
|
|
sm.regStateProcesser(DisinfectionState::init, bind(&DisinfectionCtrlService::processStateInit, this, placeholders::_1)); |
|
|
|
sm.regStateProcesser(DisinfectionState::preheat, bind(&DisinfectionCtrlService::processStatePreheat, this, placeholders::_1)); |
|
|
|
sm.regStateProcesser(DisinfectionState::disinfection, bind(&DisinfectionCtrlService::processStateDisinfection, this, placeholders::_1)); |
|
|
|
sm.regStateProcesser(DisinfectionState::degradation, bind(&DisinfectionCtrlService::processStateDegradation, this, placeholders::_1)); |
|
|
@ -115,37 +126,109 @@ void DisinfectionCtrlService::initialize() { |
|
|
|
sm.regStateProcesser(DisinfectionState::dehumidificationBeforeDisinfection, bind(&DisinfectionCtrlService::processStateDehumidificationBeforeDisinfection, this, placeholders::_1)); |
|
|
|
sm.regStateProcesser(DisinfectionState::dehumidificationAfterDisinfection, bind(&DisinfectionCtrlService::processStateDehumidificationAfterDisinfection, this, placeholders::_1)); |
|
|
|
sm.regStateProcesser(DisinfectionState::emptyLiquidFromTheLine, bind(&DisinfectionCtrlService::processStateEmpytLiquidFromTheLine, this, placeholders::_1)); |
|
|
|
sm.regStateProcesser(DisinfectionState::appexception, bind(&DisinfectionCtrlService::processStateAppexception, this, placeholders::_1)); |
|
|
|
sm.regBfStateProcess(bind(&DisinfectionCtrlService::beforeStateProcess, this)); |
|
|
|
sm.regExceptionProcesser(bind(&DisinfectionCtrlService::exceptionProcesser, this, placeholders::_1)); |
|
|
|
sm.startProcess(); |
|
|
|
} |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* APP_IMPL * |
|
|
|
*******************************************************************************/ |
|
|
|
|
|
|
|
void DisinfectionCtrlService::start() { |
|
|
|
DisinfectionEvent event; |
|
|
|
event.event = kevent_start; |
|
|
|
sm.pushEvent(event); |
|
|
|
void DisinfectionCtrlService::start(int loglevel) { |
|
|
|
logger->info("start loglevel:{}", loglevel); |
|
|
|
checkBeforeStart(); |
|
|
|
m_tlog = loglevel; |
|
|
|
m_runType = kNormalMode; |
|
|
|
|
|
|
|
// 等待任务开始
|
|
|
|
while (sm.getState() == DisinfectionState::finished) { |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(10)); |
|
|
|
auto allrealtimesetting = SETTING_DB->getRealtimeSetting(); |
|
|
|
for (auto& setting : allrealtimesetting) { |
|
|
|
m_realtimeCfg[string(setting->setting_id)] = SETTING_DB->getSettingValAsString(setting->setting_id); |
|
|
|
} |
|
|
|
|
|
|
|
json cfg = m_realtimeCfg; |
|
|
|
logger->info("start tlog:{} cfg: {}", m_tlog, cfg.dump(2)); |
|
|
|
|
|
|
|
startWorkThread(); |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::startWithFormula(string formulaid) { |
|
|
|
logger->info("startWithFormula formulaid:{}", formulaid); |
|
|
|
checkBeforeStart(); |
|
|
|
|
|
|
|
json formulacfg = FORMULA_DB->getFormulaWithExcep(m_formulaid); |
|
|
|
m_runType = kFormulaMode; |
|
|
|
|
|
|
|
m_tlog = atoi(FORMULA_DB->getFormulaWithExcep(m_formulaid, string(SettingId::loglevel)).c_str()); |
|
|
|
|
|
|
|
m_realtimeCfg.clear(); |
|
|
|
auto allrealtimesetting = SETTING_DB->getRealtimeSetting(); |
|
|
|
for (auto& setting : allrealtimesetting) { |
|
|
|
if (formulacfg.find(string(setting->setting_id)) != formulacfg.end()) { |
|
|
|
m_realtimeCfg[string(setting->setting_id)] = formulacfg[string(setting->setting_id)]; |
|
|
|
} else { |
|
|
|
m_realtimeCfg[string(setting->setting_id)] = SETTING_DB->getSettingValAsString(setting->setting_id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
json cfg = m_realtimeCfg; |
|
|
|
logger->info("startWithFormula tlog:{} cfg: {}", m_tlog, cfg.dump(2)); |
|
|
|
startWorkThread(); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::checkBeforeStart() { |
|
|
|
if (DS->getAppExceptionFlag()) { |
|
|
|
THROW_APP_EXCEPTION(err::kappe_exception_flag_is_setted, ""); |
|
|
|
} |
|
|
|
|
|
|
|
if (DS->getDeviceState() != DeviceState::Idle) { |
|
|
|
THROW_APP_EXCEPTION(err::kappe_state_is_busy, ""); |
|
|
|
} |
|
|
|
|
|
|
|
if (zsteady_clock().gets() < SENSOR_PREHEART_TIME_S) { |
|
|
|
THROW_APP_EXCEPTION(err::kappe_sensor_is_pre_hearting, ""); |
|
|
|
} |
|
|
|
|
|
|
|
if (m_thread->isWaitingForJoin()) { |
|
|
|
THROW_APP_EXCEPTION(err::kappe_disinfection_state_is_wrong, ""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::startWorkThread() { |
|
|
|
m_thread.reset(new Thread("DisinfectionStateMachineThread", [this]() { |
|
|
|
DS->setDeviceState(DeviceState::Disinfection); |
|
|
|
logger->info("DisinfectionStateMachineThread start"); |
|
|
|
sm.resetState(); |
|
|
|
GET_SERVICE(WarningLightControler)->setworkFlag(true); |
|
|
|
sm.changeState(DisinfectionState::init); |
|
|
|
bool stopbyusrflag = false; |
|
|
|
while (true) { |
|
|
|
try { |
|
|
|
sm.process(); |
|
|
|
} catch (const appexception& e) { |
|
|
|
DS->setAppExceptionFlag(e); |
|
|
|
break; |
|
|
|
} |
|
|
|
if (sm.getState() == DisinfectionState::finished) { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if (!stopbyusrflag && ThisThread().getExitFlag()) { |
|
|
|
stopbyusrflag = true; |
|
|
|
sm.changeState(DisinfectionState::finished); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
logger->info("DisinfectionStateMachineThread end"); |
|
|
|
GET_SERVICE(WarningLightControler)->setworkFlag(false); |
|
|
|
DS->setDeviceState(DeviceState::Idle); |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::stop() { |
|
|
|
if (sm.getState() == DisinfectionState::finished) return; |
|
|
|
if (sm.getState() == DisinfectionState::idle) return; |
|
|
|
|
|
|
|
DisinfectionEvent event; |
|
|
|
event.event = kevent_stop; |
|
|
|
sm.pushEvent(event); |
|
|
|
|
|
|
|
// 等待任务结束
|
|
|
|
while (sm.getState() != DisinfectionState::finished) { |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(10)); |
|
|
|
if (m_thread) { |
|
|
|
m_thread->join(); |
|
|
|
m_thread = nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::updateCfg() { |
|
|
@ -169,7 +252,7 @@ void DisinfectionCtrlService::traceState() { |
|
|
|
|
|
|
|
tracecontent += fmt::format("[{}] ", string(sm.getState())); |
|
|
|
tracecontent += fmt::format("dvalue:{} ", s_dvalue); |
|
|
|
tracecontent += fmt::format("log:{}->{} ", s_nlog, s_tlog); |
|
|
|
tracecontent += fmt::format("log:{}->{} ", s_nlog, m_tlog); |
|
|
|
tracecontent += fmt::format("takebreak:{} ", s_isDisinfectionTakeBreak); |
|
|
|
tracecontent += fmt::format("remaintime:{} ", s_remaintime); |
|
|
|
|
|
|
@ -179,21 +262,9 @@ void DisinfectionCtrlService::traceState() { |
|
|
|
/*******************************************************************************
|
|
|
|
* StateMachine * |
|
|
|
*******************************************************************************/ |
|
|
|
void DisinfectionCtrlService::exceptionProcesser(const appexception& e) { |
|
|
|
logger->error("exceptionProcesser:{}", e.what()); |
|
|
|
sm.changeState(DisinfectionState::appexception); |
|
|
|
DS->setAppExceptionFlag(e); |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::processStateAppexception(DisinfectionEvent* event) { |
|
|
|
if (event->event == kevent_tmr_1s) { |
|
|
|
if (!DS->getAppExceptionFlag()) { |
|
|
|
// 异常恢复
|
|
|
|
sm.changeState(DisinfectionState::idle); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::initState() {} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::beforeStateProcess() { s_h2o2Snapshot = dcs->getH2O2SensorMgr()->takeSnapshot(); } |
|
|
|
void DisinfectionCtrlService::beforeStateProcess() { s_h2o2Snapshot = dics->getH2O2SensorMgr()->takeSnapshot(); } |
|
|
|
|
|
|
|
void DisinfectionCtrlService::changeToNextState() { |
|
|
|
/**
|
|
|
@ -227,7 +298,7 @@ void DisinfectionCtrlService::changeToNextState() { |
|
|
|
//
|
|
|
|
else if (sm.getState() == DisinfectionState::finished) { |
|
|
|
if (PORT.isDrawBarDM()) { |
|
|
|
if (getSettingAsBool(SettingId::enable_bd_dehumidify) && dcs->ExtChSelector_isOnline()) { |
|
|
|
if (getSettingAsBool(SettingId::enable_bd_dehumidify) && dics->ExtChSelector_isOnline()) { |
|
|
|
sm.changeState(DisinfectionState::dehumidificationBeforeDisinfection); |
|
|
|
} |
|
|
|
} else { |
|
|
@ -249,7 +320,7 @@ void DisinfectionCtrlService::changeToNextState() { |
|
|
|
//
|
|
|
|
else if (sm.getState() == DisinfectionState::emptyLiquidFromTheLine) { |
|
|
|
if (PORT.isDrawBarDM()) { |
|
|
|
if (getSettingAsBool(SettingId::enable_bd_dehumidify) && dcs->ExtChSelector_isOnline()) { |
|
|
|
if (getSettingAsBool(SettingId::enable_bd_dehumidify) && dics->ExtChSelector_isOnline()) { |
|
|
|
sm.changeState(DisinfectionState::dehumidificationAfterDisinfection); |
|
|
|
} |
|
|
|
} else { |
|
|
@ -266,21 +337,33 @@ void DisinfectionCtrlService::changeToNextState() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::processStateIdle(DisinfectionEvent* event) { sm.changeState(DisinfectionState::finished); } |
|
|
|
void DisinfectionCtrlService::processStateIdle(DisinfectionEvent* event) {} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::processStateInit(DisinfectionEvent* event) { |
|
|
|
if (event->event == kevent_enter_state) { |
|
|
|
/**
|
|
|
|
* @brief 开始消毒 |
|
|
|
*/ |
|
|
|
|
|
|
|
GET_SERVICE(WarningLightControler)->setworkFlag(true); |
|
|
|
changeToNextState(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::processStateDehumidificationBeforeDisinfection(DisinfectionEvent* event) { |
|
|
|
auto h2o2s = dcs->getH2O2SensorMgr(); |
|
|
|
auto h2o2s = dics->getH2O2SensorMgr(); |
|
|
|
if (event->event == kevent_enter_state) { |
|
|
|
tryLogState(true); |
|
|
|
ZASSERT(PORT.isDrawBarDM()); |
|
|
|
|
|
|
|
dcs->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
dics->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
usleep(100 * 1000); |
|
|
|
dcs->ExtChSelector_trySelectCh(kext_ch_dehumidification); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_dehumidification); |
|
|
|
} |
|
|
|
//
|
|
|
|
else if (event->event == kevent_exit_state) { |
|
|
|
dcs->Blower_ctrl(0); |
|
|
|
dcs->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
|
dics->Blower_ctrl(0); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
|
tryLogState(true); |
|
|
|
} |
|
|
|
//
|
|
|
@ -298,10 +381,6 @@ void DisinfectionCtrlService::processStateDehumidificationBeforeDisinfection(Dis |
|
|
|
changeToNextState(); |
|
|
|
tryLogState(false); |
|
|
|
} |
|
|
|
|
|
|
|
else if (event->event == kevent_stop) { |
|
|
|
sm.changeState(DisinfectionState::finished); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::processStatePreheat(DisinfectionEvent* event) { |
|
|
@ -309,16 +388,16 @@ void DisinfectionCtrlService::processStatePreheat(DisinfectionEvent* event) { |
|
|
|
logger->info("preheat state enter"); |
|
|
|
tryLogState(true); |
|
|
|
|
|
|
|
dcs->Blower_ctrl(90); |
|
|
|
dics->Blower_ctrl(90); |
|
|
|
usleep(1000 * 1000); |
|
|
|
dcs->Heater_ctrl(100); |
|
|
|
dics->Heater_ctrl(100); |
|
|
|
|
|
|
|
} else if (event->event == kevent_exit_state) { |
|
|
|
logger->info("preheat state exit"); |
|
|
|
|
|
|
|
dcs->Blower_ctrl(0); |
|
|
|
dics->Blower_ctrl(0); |
|
|
|
usleep(1000 * 1000); |
|
|
|
dcs->Heater_ctrl(0); |
|
|
|
dics->Heater_ctrl(0); |
|
|
|
|
|
|
|
tryLogState(true); |
|
|
|
} else if (event->event == kevent_tmr_1s) { |
|
|
@ -329,8 +408,6 @@ void DisinfectionCtrlService::processStatePreheat(DisinfectionEvent* event) { |
|
|
|
changeToNextState(); |
|
|
|
} |
|
|
|
tryLogState(false); |
|
|
|
} else if (event->event == kevent_stop) { |
|
|
|
sm.changeState(DisinfectionState::finished); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -339,19 +416,19 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) |
|
|
|
tryLogState(true); |
|
|
|
s_isDisinfectionTakeBreak = false; |
|
|
|
if (PORT.isPipeDM()) { |
|
|
|
dcs->AirLeakDetectTestModeCtrl_setMode(0); |
|
|
|
dics->AirLeakDetectTestModeCtrl_setMode(0); |
|
|
|
} |
|
|
|
dcs->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
|
dcs->AC_ctrl(1); |
|
|
|
dcs->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
dcs->Heater_ctrl(1); |
|
|
|
dcs->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
|
dics->AC_ctrl(1); |
|
|
|
dics->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
dics->Heater_ctrl(1); |
|
|
|
dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); |
|
|
|
} else if (event->event == kevent_exit_state) { |
|
|
|
s_isDisinfectionTakeBreak = false; |
|
|
|
dcs->AC_close(); |
|
|
|
dcs->Blower_close(); |
|
|
|
dcs->Heater_close(); |
|
|
|
dcs->SprayPump_stop(); |
|
|
|
dics->AC_close(); |
|
|
|
dics->Blower_close(); |
|
|
|
dics->Heater_close(); |
|
|
|
dics->SprayPump_stop(); |
|
|
|
s_dvalue = 0; |
|
|
|
tryLogState(true); |
|
|
|
} else if (event->event == kevent_tmr_1s) { |
|
|
@ -367,7 +444,7 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) |
|
|
|
if (zsteady_clock().elapsedTimeS(s_lastComputeDvalueTp) > DVALUE_COMPUTEPERIOD_TIME_S) { |
|
|
|
s_lastComputeDvalueTp = zsteady_clock().now(); |
|
|
|
s_nlog = computeNextLogLevel(s_nlog, s_dvalue); |
|
|
|
updateRemainTime(s_dvalue, s_nlog, s_tlog, s_remaintime); |
|
|
|
updateRemainTime(s_dvalue, s_nlog, m_tlog, s_remaintime); |
|
|
|
traceState(); |
|
|
|
} |
|
|
|
|
|
|
@ -377,22 +454,22 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) |
|
|
|
if (!s_isDisinfectionTakeBreak) { |
|
|
|
if (isTimeToPauseDisinfection()) { |
|
|
|
logger->info("pauseDisinfection"); |
|
|
|
dcs->SprayPump_stop(); |
|
|
|
dcs->AC_close(); |
|
|
|
dics->SprayPump_stop(); |
|
|
|
dics->AC_close(); |
|
|
|
s_isDisinfectionTakeBreak = true; |
|
|
|
traceState(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (isTimeToResumeDisinfection()) { |
|
|
|
logger->info("resumeDisinfection"); |
|
|
|
dcs->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); |
|
|
|
dcs->AC_ctrl(1); |
|
|
|
dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); |
|
|
|
dics->AC_ctrl(1); |
|
|
|
s_isDisinfectionTakeBreak = false; |
|
|
|
traceState(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (s_remaintime <= 0 && s_nlog > (s_tlog + 0.01)) { |
|
|
|
if (s_remaintime <= 0 && s_nlog > (m_tlog + 0.01)) { |
|
|
|
/**
|
|
|
|
* @brief 消毒结束 |
|
|
|
*/ |
|
|
@ -403,39 +480,35 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) |
|
|
|
// 检查是否消毒完成
|
|
|
|
} else if (event->event == kevent_update_cfg) { |
|
|
|
if (!s_isDisinfectionTakeBreak) { |
|
|
|
dcs->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); |
|
|
|
dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); |
|
|
|
} |
|
|
|
} else if (event->event == kevent_stop) { |
|
|
|
sm.changeState(DisinfectionState::finished); |
|
|
|
} |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::processStateEmpytLiquidFromTheLine(DisinfectionEvent* event) { |
|
|
|
if (event->event == kevent_enter_state) { |
|
|
|
tryLogState(true); |
|
|
|
dcs->SprayPump_startInRPM(-PORT.getSprayLiquidPumpMaxRPM()); |
|
|
|
dics->SprayPump_startInRPM(-PORT.getSprayLiquidPumpMaxRPM()); |
|
|
|
|
|
|
|
} else if (event->event == kevent_exit_state) { |
|
|
|
tryLogState(true); |
|
|
|
dcs->SprayPump_stop(); |
|
|
|
dics->SprayPump_stop(); |
|
|
|
} else if (event->event == kevent_tmr_1s) { |
|
|
|
if (sm.getStateHasPassedTimeMs() > EMTPTY_LINE_WHEN_DISINFECTION * 1000) { |
|
|
|
changeToNextState(); |
|
|
|
} |
|
|
|
} else if (event->event == kevent_stop) { |
|
|
|
sm.changeState(DisinfectionState::finished); |
|
|
|
} |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::processStateDehumidificationAfterDisinfection(DisinfectionEvent* event) { |
|
|
|
if (event->event == kevent_enter_state) { |
|
|
|
tryLogState(true); |
|
|
|
dcs->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
dcs->ExtChSelector_trySelectCh(kext_ch_dehumidification); |
|
|
|
dics->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_dehumidification); |
|
|
|
} else if (event->event == kevent_exit_state) { |
|
|
|
dcs->Blower_close(); |
|
|
|
dcs->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
|
dics->Blower_close(); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
|
tryLogState(true); |
|
|
|
} else if (event->event == kevent_tmr_1s) { |
|
|
|
if (!dcs->ExtChSelector_isOnline()) { |
|
|
|
if (!dics->ExtChSelector_isOnline()) { |
|
|
|
logger->error("exit dehumidification state, because extValBoard is offline"); |
|
|
|
changeToNextState(); |
|
|
|
return; |
|
|
@ -453,19 +526,16 @@ void DisinfectionCtrlService::processStateDehumidificationAfterDisinfection(Disi |
|
|
|
|
|
|
|
changeToNextState(); |
|
|
|
tryLogState(false); |
|
|
|
|
|
|
|
} else if (event->event == kevent_stop) { |
|
|
|
sm.changeState(DisinfectionState::finished); |
|
|
|
} |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::processStateDegradation(DisinfectionEvent* event) { |
|
|
|
if (event->event == kevent_enter_state) { |
|
|
|
tryLogState(true); |
|
|
|
dcs->ExtChSelector_trySelectCh(kext_ch_degradation); |
|
|
|
dcs->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_degradation); |
|
|
|
dics->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
} else if (event->event == kevent_exit_state) { |
|
|
|
dcs->Blower_close(); |
|
|
|
dcs->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
|
dics->Blower_close(); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
|
tryLogState(true); |
|
|
|
} else if (event->event == kevent_tmr_1s) { |
|
|
|
auto maxH2O2 = s_h2o2Snapshot->maxH2O2; |
|
|
@ -476,8 +546,6 @@ void DisinfectionCtrlService::processStateDegradation(DisinfectionEvent* event) |
|
|
|
changeToNextState(); |
|
|
|
} |
|
|
|
tryLogState(false); |
|
|
|
} else if (event->event == kevent_stop) { |
|
|
|
sm.changeState(DisinfectionState::finished); |
|
|
|
} |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::processStateFinished(DisinfectionEvent* event) { |
|
|
@ -488,10 +556,10 @@ void DisinfectionCtrlService::processStateFinished(DisinfectionEvent* event) { |
|
|
|
* @brief 消毒结束 |
|
|
|
*/ |
|
|
|
|
|
|
|
dcs->SprayPump_stop(); |
|
|
|
dcs->AC_ctrl(0); |
|
|
|
dcs->Blower_close(); |
|
|
|
dcs->Heater_close(); |
|
|
|
dics->SprayPump_stop(); |
|
|
|
dics->AC_ctrl(0); |
|
|
|
dics->Blower_close(); |
|
|
|
dics->Heater_close(); |
|
|
|
|
|
|
|
s_remaintime = 0; |
|
|
|
s_complete_tp = zsystem_clock().now(); |
|
|
@ -509,18 +577,5 @@ void DisinfectionCtrlService::processStateFinished(DisinfectionEvent* event) { |
|
|
|
logger->info("finished disinfection {}", s_sessionId); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//
|
|
|
|
else if (event->event == kevent_start) { |
|
|
|
/**
|
|
|
|
* @brief 开始消毒 |
|
|
|
*/ |
|
|
|
initState(); |
|
|
|
GET_SERVICE(WarningLightControler)->setworkFlag(true); |
|
|
|
changeToNextState(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::initState() {} |