Browse Source

update

storage-in-realtime
zhaohe 12 months ago
parent
commit
b6a00f1d0d
  1. 2
      README.md
  2. 26
      appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp
  3. 1
      appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp
  4. 6
      appsrc/service/disinfection_logs_service.hpp

2
README.md

@ -83,6 +83,8 @@ TODO:
8. 添加一个程序根据全局异常标志位,对设备进行相应的检查,如果检查通过则清空标志位。同时如果发生异常,则发送板子复位指令,对板子进行复位。
整理错误码,为所有错误吗添加中文示意
消毒过程中检测水禁传感器,
...
5. 单片机支持自动过滤掉重发的指令。

26
appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp

@ -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);

1
appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp

@ -110,7 +110,6 @@ class DisinfectionCtrlService : public enable_shared_from_this<DisinfectionCtrlS
void tryLogState(bool forceLog);
void logState();
void traceState();
void initState();
};
} // namespace iflytop

6
appsrc/service/disinfection_logs_service.hpp

@ -11,14 +11,11 @@
//
#include "appbase/appbase.hpp"
#include "appsetting/appsetting.hpp"
#include "baseservice/baseservice.hpp"
#include "iflytop/core/components/zcsv/zcsv.hpp"
namespace iflytop {
class DisinfectionLogsService : public enable_shared_from_this<DisinfectionLogsService> {
THISCLASS(DisinfectionLogsService);
@ -27,7 +24,7 @@ class DisinfectionLogsService : public enable_shared_from_this<DisinfectionLogsS
shared_ptr<GConfig> m_gConfig;
shared_ptr<UDiskMgrService> m_udiskMgrService;
string m_sessionId;
string m_sessionId;
list<shared_ptr<DisinfectionStateSnapshot>> m_snapshots;
ZDictionary m_csvHeaderDict;
@ -37,6 +34,7 @@ class DisinfectionLogsService : public enable_shared_from_this<DisinfectionLogsS
DisinfectionLogsService();
void initialize();
public:
void startNewDisinfectionSession(string sessionId);
void pushStateSnapshot(shared_ptr<DisinfectionStateSnapshot> snapshot);
void finishDisinfectionSession();

Loading…
Cancel
Save