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

Loading…
Cancel
Save