|
|
@ -254,7 +254,19 @@ void DisinfectionCtrlService::tryLogState(bool forceLog) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::logState() {} |
|
|
|
void DisinfectionCtrlService::logState() { |
|
|
|
shared_ptr<DisinfectionStateSnapshot> snapshot = make_shared<DisinfectionStateSnapshot>(); |
|
|
|
snapshot->state = sm.getState(); |
|
|
|
snapshot->time = zsystem_clock().now(); |
|
|
|
snapshot->dval = s_dvalue; |
|
|
|
snapshot->nlog = s_nlog; |
|
|
|
snapshot->tlog = m_tlog; |
|
|
|
snapshot->remainTime = s_remaintime; |
|
|
|
snapshot->remainDisinfectant = dwus->getWeight(); |
|
|
|
snapshot->h2o2Snapshot = s_h2o2Snapshot; |
|
|
|
|
|
|
|
AppEventBus::ins()->push(make_shared<AppDisinfectionSnapshotEvent>(snapshot)); |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::traceState() { |
|
|
|
string tracecontent; |
|
|
|
|
|
|
@ -270,7 +282,6 @@ void DisinfectionCtrlService::traceState() { |
|
|
|
/*******************************************************************************
|
|
|
|
* StateMachine * |
|
|
|
*******************************************************************************/ |
|
|
|
void DisinfectionCtrlService::initState() {} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::beforeStateProcess() { s_h2o2Snapshot = dics->getH2O2SensorMgr()->takeSnapshot(); } |
|
|
|
|
|
|
@ -373,7 +384,7 @@ void DisinfectionCtrlService::processStateInit(DisinfectionEvent* event) { |
|
|
|
*/ |
|
|
|
|
|
|
|
s_sessionId = createDisinfectionID(); |
|
|
|
s_remaintime = m_tlog * 60 * 60; // 计算总的加热时间
|
|
|
|
s_remaintime = -1; |
|
|
|
s_nlog = 0; |
|
|
|
s_dvalue = 0; |
|
|
|
s_start_tp = zsystem_clock().now(); |
|
|
@ -397,6 +408,7 @@ void DisinfectionCtrlService::processStateDehumidificationBeforeDisinfection(Dis |
|
|
|
dics->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
usleep(100 * 1000); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_dehumidification); |
|
|
|
s_remaintime = -1; |
|
|
|
} |
|
|
|
//
|
|
|
|
else if (event->event == kevent_exit_state) { |
|
|
@ -429,6 +441,7 @@ void DisinfectionCtrlService::processStatePreheat(DisinfectionEvent* event) { |
|
|
|
dics->Blower_ctrl(90); |
|
|
|
usleep(1000 * 1000); |
|
|
|
dics->Heater_ctrl(100); |
|
|
|
s_remaintime = getSettingAsInt(SettingId::pre_heat_time_s); |
|
|
|
|
|
|
|
} else if (event->event == kevent_exit_state) { |
|
|
|
logger->info("preheat state exit"); |
|
|
@ -440,6 +453,10 @@ void DisinfectionCtrlService::processStatePreheat(DisinfectionEvent* event) { |
|
|
|
tryLogState(true); |
|
|
|
} else if (event->event == kevent_tmr_1s) { |
|
|
|
int preHeatTimeS = getSettingAsInt(SettingId::pre_heat_time_s); |
|
|
|
s_remaintime--; |
|
|
|
if (s_remaintime <= 0) { |
|
|
|
s_remaintime = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if (sm.getStateHasPassedTimeMs() > preHeatTimeS * 1000) { |
|
|
|
// 退出预热状态,进入消毒状态
|
|
|
@ -535,6 +552,7 @@ void DisinfectionCtrlService::processStateEmpytLiquidFromTheLine(DisinfectionEve |
|
|
|
if (event->event == kevent_enter_state) { |
|
|
|
tryLogState(true); |
|
|
|
dics->SprayPump_startInRPM(-PORT.getSprayLiquidPumpMaxRPM()); |
|
|
|
s_remaintime = -1; |
|
|
|
|
|
|
|
} else if (event->event == kevent_exit_state) { |
|
|
|
tryLogState(true); |
|
|
@ -550,6 +568,7 @@ void DisinfectionCtrlService::processStateDehumidificationAfterDisinfection(Disi |
|
|
|
tryLogState(true); |
|
|
|
dics->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_dehumidification); |
|
|
|
s_remaintime = -1; |
|
|
|
} else if (event->event == kevent_exit_state) { |
|
|
|
dics->Blower_close(); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
@ -580,6 +599,7 @@ void DisinfectionCtrlService::processStateDegradation(DisinfectionEvent* event) |
|
|
|
tryLogState(true); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_degradation); |
|
|
|
dics->Blower_ctrl(DEFAULT_BLOWSER_LEVEL); |
|
|
|
s_remaintime = -1; |
|
|
|
} else if (event->event == kevent_exit_state) { |
|
|
|
dics->Blower_close(); |
|
|
|
dics->ExtChSelector_trySelectCh(kext_ch_disinfection); |
|
|
|