Browse Source

fix some bug

storage-in-realtime
zhaohe 11 months ago
parent
commit
bcb1c8799e
  1. 6
      appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp

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

@ -12,6 +12,8 @@ using namespace disinfection;
#define SETTING_DB SettingDBDao::ins()
#define FORMULA_DB FormulaDBDao::ins()
static bool feq(float a, float b) { return fabs(a - b) < 0.0001; }
string DisinfectionCtrlService::getSetting(SettingId sid) {
// 1. 从 realtimeCfg 中进行查找
// 2. 从 系统配置 中进行查找
@ -526,6 +528,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);
if (s_nlog >= m_tlog) s_nlog = m_tlog;
updateRemainTime(s_dvalue, s_nlog, m_tlog, s_remaintime);
// traceState();
tryLogState(false);
@ -552,10 +555,11 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event)
}
}
if (s_remaintime <= 0 && s_nlog > (m_tlog + 0.01)) {
if (s_remaintime <= 0 && feq(s_nlog, m_tlog)) {
/**
* @brief
*/
s_nlog = m_tlog;
changeToNextState();
}

Loading…
Cancel
Save