From b482215e275687ed20ca26b49c9a23faa6687918 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 7 Jul 2025 18:47:53 +0800 Subject: [PATCH 1/4] v3.0.6 --- appsrc/appbase/appbean/setting_id.hpp | 4 ++-- appsrc/appconfig/basic/zappversion.hpp | 2 +- .../disinfection_ctrl_service.cpp | 25 ++++++++++++++++++---- .../disinfection_ctrl_service.hpp | 6 ++++++ .../service/app/disinfection_ctrl_service_ext.cpp | 12 ++++++++++- .../service/app/disinfection_ctrl_service_ext.hpp | 5 ++++- appsrc/service/os_mgr_service.cpp | 9 +++++++- packet_release.sh | 2 +- 8 files changed, 54 insertions(+), 11 deletions(-) diff --git a/appsrc/appbase/appbean/setting_id.hpp b/appsrc/appbase/appbean/setting_id.hpp index 1d7693b..87e4648 100644 --- a/appsrc/appbase/appbean/setting_id.hpp +++ b/appsrc/appbase/appbean/setting_id.hpp @@ -7,12 +7,12 @@ marco(type, continued_gs) /**/ \ marco(type, stoped_satur) /**/ \ marco(type, continued_satur) /**/ \ + marco(type, stoped_humi) /**/ \ + marco(type, continued_humi) /**/ \ marco(type, max_humidity) /**/ \ marco(type, drainage_pump_speed) /**/ \ marco(type, injection_pump_speed) /**/ \ marco(type, pre_heat_time_s) /**/ \ - marco(type, stoped_humi) /**/ \ - marco(type, continued_humi) /**/ \ marco(type, record_period_min) /**/ \ marco(type, record_printer_period_min) /**/ \ marco(type, loglevel) /*消毒等级*/ \ diff --git a/appsrc/appconfig/basic/zappversion.hpp b/appsrc/appconfig/basic/zappversion.hpp index 72c9a3e..81c73bd 100644 --- a/appsrc/appconfig/basic/zappversion.hpp +++ b/appsrc/appconfig/basic/zappversion.hpp @@ -1,3 +1,3 @@ #pragma once -#define VERSION "3.0.4" +#define VERSION "3.0.6" #define PROJECT_NAME "TRANSMIT_DM" \ No newline at end of file diff --git a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp index 6776225..060e04b 100644 --- a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp +++ b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp @@ -213,7 +213,7 @@ void DisinfectionCtrlService::checkBeforeStart() { void DisinfectionCtrlService::startWorkThread() { resetState(); - + handlePumpStopFlag = false; m_thread.reset(new Thread("DisinfectionStateMachineThread", [this]() { DS->setDeviceState(DeviceState::Disinfection); logger->info("DisinfectionStateMachineThread start"); @@ -549,8 +549,10 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) } else { if (isTimeToResumeDisinfection()) { logger->info("resumeDisinfection"); - dics->AC_ctrl(1); - dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); + if (!handlePumpStopFlag) { + dics->AC_ctrl(1); + dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); + } s_isDisinfectionTakeBreak = false; tryLogState(true); } @@ -595,11 +597,26 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) // 检查是否消毒完成 } else if (event->event == kevent_update_cfg) { - if (!s_isDisinfectionTakeBreak) { + if (!s_isDisinfectionTakeBreak && !handlePumpStopFlag) { + dics->AC_ctrl(1); dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); } + if (handlePumpStopFlag) { + dics->SprayPump_stop(); + dics->AC_close(); + } } } + +void DisinfectionCtrlService::setHandleStopPumpInjectionFlag() { + handlePumpStopFlag = true; + updateCfg(); +} +void DisinfectionCtrlService::clearHandleStopPumpInjectionFlag() { + handlePumpStopFlag = false; + updateCfg(); +} + void DisinfectionCtrlService::processStateEmpytLiquidFromTheLine(DisinfectionEvent* event) { if (event->event == kevent_enter_state) { tryLogState(true); diff --git a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp index e5f0adf..ca10e57 100644 --- a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp +++ b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp @@ -61,6 +61,8 @@ class DisinfectionCtrlService : public enable_shared_from_this syncState) { sm.getStateSafeBlock(syncState); } + void clearHandleStopPumpInjectionFlag(); + void setHandleStopPumpInjectionFlag(); + bool getHandlePumpStopFlag() { return handlePumpStopFlag; } + map& getRealtimeCfg() { return m_realtimeCfg; } DisinfectionState getState() { return sm.getState(); } int getCurStateRemainTimeS() { return s_remaintime; } diff --git a/appsrc/service/app/disinfection_ctrl_service_ext.cpp b/appsrc/service/app/disinfection_ctrl_service_ext.cpp index e96e823..25b97a6 100644 --- a/appsrc/service/app/disinfection_ctrl_service_ext.cpp +++ b/appsrc/service/app/disinfection_ctrl_service_ext.cpp @@ -50,6 +50,8 @@ void DisinfectionCtrlServiceExt::initialize() { REG_EXTFN_VOID(getServiceConfig, void()); REG_EXTFN_VOID(startStateReport, void()); REG_EXTFN_VOID(stopStateReport, void()); + REG_EXTFN_VOID(clearHandleStopPumpInjectionFlag, void()); + REG_EXTFN_VOID(setHandleStopPumpInjectionFlag, void()); stateUpdateThread.reset(new Thread("DisinfectionCtrlServiceExt-stateUpdateThread", [this]() { ThisThread thisThread; @@ -107,7 +109,14 @@ void DisinfectionCtrlServiceExt::setRealtimeConfig(shared_ptr dcs->getRealtimeCfg()[key] = val; dcs->updateCfg(); } - +void DisinfectionCtrlServiceExt::clearHandleStopPumpInjectionFlag(shared_ptr cxt) { + dcs->clearHandleStopPumpInjectionFlag(); + if (stateUpdateThread) stateUpdateThread->wake(); +} +void DisinfectionCtrlServiceExt::setHandleStopPumpInjectionFlag(shared_ptr cxt) { + dcs->setHandleStopPumpInjectionFlag(); + if (stateUpdateThread) stateUpdateThread->wake(); +} void DisinfectionCtrlServiceExt::getState(shared_ptr cxt) { cxt->rely = getState(); } json DisinfectionCtrlServiceExt::getState() { json rely; @@ -121,6 +130,7 @@ json DisinfectionCtrlServiceExt::getState() { rely["injectedVelocity"] = dcs->getInjectedVelocity(); rely["startTimestamp"] = dcs->getStartTP(); rely["completeTimestamp"] = dcs->getCompleteTP(); + rely["handlePumpStopFlag"] = dcs->getHandlePumpStopFlag(); }); return rely; } diff --git a/appsrc/service/app/disinfection_ctrl_service_ext.hpp b/appsrc/service/app/disinfection_ctrl_service_ext.hpp index 4186d9d..e0f7a59 100644 --- a/appsrc/service/app/disinfection_ctrl_service_ext.hpp +++ b/appsrc/service/app/disinfection_ctrl_service_ext.hpp @@ -44,6 +44,9 @@ class DisinfectionCtrlServiceExt : public enable_shared_from_this cxt, string key, string val); void updateTargetLogLevel(shared_ptr cxt, float loglevel); + void clearHandleStopPumpInjectionFlag(shared_ptr cxt); + void setHandleStopPumpInjectionFlag(shared_ptr cxt); + /******************************************************************************* * 状态 * *******************************************************************************/ @@ -55,7 +58,7 @@ class DisinfectionCtrlServiceExt : public enable_shared_from_thisgetState(); } - int64_t getDisinfectionStartTP() { return dcs->getStartTP(); } + int64_t getDisinfectionStartTP() { return dcs->getStartTP(); } }; } // namespace iflytop \ No newline at end of file diff --git a/appsrc/service/os_mgr_service.cpp b/appsrc/service/os_mgr_service.cpp index 18c47a1..d9ee08a 100644 --- a/appsrc/service/os_mgr_service.cpp +++ b/appsrc/service/os_mgr_service.cpp @@ -35,5 +35,12 @@ void OsMgrService::updateTime(shared_ptr cxt, int hour, int m } void OsMgrService::getTime(shared_ptr cxt) { - cxt->rely["time"] = duration_cast(system_clock::now().time_since_epoch()).count(); + // cxt->rely["time"] = duration_cast(system_clock::now().time_since_epoch()).count(); + + struct timeval tv; + gettimeofday(&tv, NULL); + + // 计算毫秒级 Unix 时间戳 + long long timestamp_ms = (long long)tv.tv_sec * 1000 + tv.tv_usec / 1000; + cxt->rely["time"] = timestamp_ms; } diff --git a/packet_release.sh b/packet_release.sh index f9cda88..7030709 100755 --- a/packet_release.sh +++ b/packet_release.sh @@ -18,7 +18,7 @@ rm -rf $packetpath mkdir -p $packetpath/ cp ./build/app/* $packetpath/ -cp -rf html $packetpath/ +# cp -rf html $packetpath/ tar -czvf $packetpath.tar.gz -C /tmp/ $packetname From f1bd8d34c3a2ce141406262b3ba4b60e69d3a08b Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 7 Jul 2025 18:55:41 +0800 Subject: [PATCH 2/4] append --- appsrc/baseservice/db/setting_db_dao.cpp | 38 ++++++++++++++++---------------- appsrc/service/os_mgr_service.cpp | 4 +++- packet_release.sh | 2 +- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/appsrc/baseservice/db/setting_db_dao.cpp b/appsrc/baseservice/db/setting_db_dao.cpp index 364fa00..3d78b1d 100644 --- a/appsrc/baseservice/db/setting_db_dao.cpp +++ b/appsrc/baseservice/db/setting_db_dao.cpp @@ -55,25 +55,25 @@ using namespace iflytop; using namespace db; static Setting settingInitTable[] = { - {.setting_id = SettingId::kstoped_gs}, - {.setting_id = SettingId::kcontinued_gs}, - {.setting_id = SettingId::kstoped_satur}, - {.setting_id = SettingId::kcontinued_satur}, - {.setting_id = SettingId::kmax_humidity}, - {.setting_id = SettingId::kdrainage_pump_speed}, - {.setting_id = SettingId::kinjection_pump_speed}, - {.setting_id = SettingId::kpre_heat_time_s}, - {.setting_id = SettingId::kstoped_humi}, - {.setting_id = SettingId::kcontinued_humi}, - {.setting_id = SettingId::krecord_period_min}, - {.setting_id = SettingId::krecord_printer_period_min}, - {.setting_id = SettingId::kloglevel}, - {.setting_id = SettingId::kenable_bd_dehumidify}, - {.setting_id = SettingId::kbd_dehumidify_threshold}, - {.setting_id = SettingId::kenable_ad_dehumidify}, - {.setting_id = SettingId::kad_dehumidify_threshold}, - {.setting_id = SettingId::kenable_ad_degrade}, - {.setting_id = SettingId::kad_degrade_threshold}, + {.setting_id = SettingId::stoped_gs}, + {.setting_id = SettingId::continued_gs}, + {.setting_id = SettingId::stoped_satur}, + {.setting_id = SettingId::continued_satur}, + {.setting_id = SettingId::stoped_humi}, + {.setting_id = SettingId::continued_humi}, + {.setting_id = SettingId::max_humidity}, + {.setting_id = SettingId::drainage_pump_speed}, + {.setting_id = SettingId::injection_pump_speed}, + {.setting_id = SettingId::pre_heat_time_s}, + {.setting_id = SettingId::record_period_min}, + {.setting_id = SettingId::record_printer_period_min}, + {.setting_id = SettingId::loglevel}, + {.setting_id = SettingId::enable_bd_dehumidify}, + {.setting_id = SettingId::bd_dehumidify_threshold}, + {.setting_id = SettingId::enable_ad_dehumidify}, + {.setting_id = SettingId::ad_dehumidify_threshold}, + {.setting_id = SettingId::enable_ad_degrade}, + {.setting_id = SettingId::ad_degrade_threshold}, {.setting_id = SettingId::dvalue_correct_coefficient}, }; diff --git a/appsrc/service/os_mgr_service.cpp b/appsrc/service/os_mgr_service.cpp index d9ee08a..bae535c 100644 --- a/appsrc/service/os_mgr_service.cpp +++ b/appsrc/service/os_mgr_service.cpp @@ -41,6 +41,8 @@ void OsMgrService::getTime(shared_ptr cxt) { gettimeofday(&tv, NULL); // 计算毫秒级 Unix 时间戳 + // TODO: 修改成时区来自系统 long long timestamp_ms = (long long)tv.tv_sec * 1000 + tv.tv_usec / 1000; - cxt->rely["time"] = timestamp_ms; + timestamp_ms += 8 * 3600 * 1000; // 转换为北京时间(UTC+8) + cxt->rely["time"] = timestamp_ms; } diff --git a/packet_release.sh b/packet_release.sh index 7030709..f9cda88 100755 --- a/packet_release.sh +++ b/packet_release.sh @@ -18,7 +18,7 @@ rm -rf $packetpath mkdir -p $packetpath/ cp ./build/app/* $packetpath/ -# cp -rf html $packetpath/ +cp -rf html $packetpath/ tar -czvf $packetpath.tar.gz -C /tmp/ $packetname From 8181da8ec54e3a0fb92956bf8ea19a36d61f83be Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 7 Jul 2025 19:01:38 +0800 Subject: [PATCH 3/4] append --- appsrc/baseservice/db/setting_db_dao.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appsrc/baseservice/db/setting_db_dao.cpp b/appsrc/baseservice/db/setting_db_dao.cpp index 3d78b1d..0c27b33 100644 --- a/appsrc/baseservice/db/setting_db_dao.cpp +++ b/appsrc/baseservice/db/setting_db_dao.cpp @@ -65,9 +65,9 @@ static Setting settingInitTable[] = { {.setting_id = SettingId::drainage_pump_speed}, {.setting_id = SettingId::injection_pump_speed}, {.setting_id = SettingId::pre_heat_time_s}, + {.setting_id = SettingId::loglevel}, {.setting_id = SettingId::record_period_min}, {.setting_id = SettingId::record_printer_period_min}, - {.setting_id = SettingId::loglevel}, {.setting_id = SettingId::enable_bd_dehumidify}, {.setting_id = SettingId::bd_dehumidify_threshold}, {.setting_id = SettingId::enable_ad_dehumidify}, From 3bbb09becfcd913b570ad6e492b8e08fa3a1ea91 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 7 Jul 2025 19:58:32 +0800 Subject: [PATCH 4/4] 3.0.7 --- appsrc/appconfig/basic/zappversion.hpp | 2 +- appsrc/baseservice/db/calibrate_info_dao.hpp | 10 +++++++--- .../disinfection_ctrl/disinfection_ctrl_service.cpp | 13 +++++++++++-- .../disinfection_ctrl/disinfection_ctrl_service.hpp | 8 ++++++-- appsrc/service/app/disinfection_ctrl_service_ext.cpp | 18 +++++++++++++++--- appsrc/service/app/disinfection_ctrl_service_ext.hpp | 3 +++ 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/appsrc/appconfig/basic/zappversion.hpp b/appsrc/appconfig/basic/zappversion.hpp index 81c73bd..c2093f3 100644 --- a/appsrc/appconfig/basic/zappversion.hpp +++ b/appsrc/appconfig/basic/zappversion.hpp @@ -1,3 +1,3 @@ #pragma once -#define VERSION "3.0.6" +#define VERSION "3.0.7" #define PROJECT_NAME "TRANSMIT_DM" \ No newline at end of file diff --git a/appsrc/baseservice/db/calibrate_info_dao.hpp b/appsrc/baseservice/db/calibrate_info_dao.hpp index 6a8e160..75ae6ea 100644 --- a/appsrc/baseservice/db/calibrate_info_dao.hpp +++ b/appsrc/baseservice/db/calibrate_info_dao.hpp @@ -35,7 +35,7 @@ using namespace nlohmann; namespace db { typedef struct { - int id; + int id; float h2O2LiquidWeightSensorZeroBias; // H2O2液体重量传感器零点偏差 } CalibrationInfo; } // namespace db @@ -62,8 +62,12 @@ class CalibrationInfoDao : public KeyValDBV2Dao { CalibrationInfo getCalibrationInfo(); json getCalibrationInfoJson(); - void setH2O2LiquidWeightSensorZeroBias(float bias); - float getH2O2LiquidWeightSensorZeroBias(); + void setH2O2LiquidWeightSensorZeroBias(float bias); + float getH2O2LiquidWeightSensorZeroBias(); + + + + private: void initialize(); diff --git a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp index 060e04b..30cb698 100644 --- a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp +++ b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp @@ -608,11 +608,20 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) } } -void DisinfectionCtrlService::setHandleStopPumpInjectionFlag() { +// void DisinfectionCtrlService::setHandleStopPumpInjectionFlag() { +// handlePumpStopFlag = true; +// updateCfg(); +// } +// void DisinfectionCtrlService::clearHandleStopPumpInjectionFlag() { +// handlePumpStopFlag = false; +// updateCfg(); +// } + +void DisinfectionCtrlService::handleStopPumpInjection() { handlePumpStopFlag = true; updateCfg(); } -void DisinfectionCtrlService::clearHandleStopPumpInjectionFlag() { +void DisinfectionCtrlService::handleStartPumpInjection() { handlePumpStopFlag = false; updateCfg(); } diff --git a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp index ca10e57..70a794b 100644 --- a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp +++ b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.hpp @@ -90,8 +90,12 @@ class DisinfectionCtrlService : public enable_shared_from_this syncState) { sm.getStateSafeBlock(syncState); } - void clearHandleStopPumpInjectionFlag(); - void setHandleStopPumpInjectionFlag(); + // void clearHandleStopPumpInjectionFlag(); + // void setHandleStopPumpInjectionFlag(); + void handleStopPumpInjection(); + void handleStartPumpInjection(); + + bool getHandlePumpStopFlag() { return handlePumpStopFlag; } map& getRealtimeCfg() { return m_realtimeCfg; } diff --git a/appsrc/service/app/disinfection_ctrl_service_ext.cpp b/appsrc/service/app/disinfection_ctrl_service_ext.cpp index 25b97a6..06f8839 100644 --- a/appsrc/service/app/disinfection_ctrl_service_ext.cpp +++ b/appsrc/service/app/disinfection_ctrl_service_ext.cpp @@ -50,8 +50,11 @@ void DisinfectionCtrlServiceExt::initialize() { REG_EXTFN_VOID(getServiceConfig, void()); REG_EXTFN_VOID(startStateReport, void()); REG_EXTFN_VOID(stopStateReport, void()); - REG_EXTFN_VOID(clearHandleStopPumpInjectionFlag, void()); + REG_EXTFN_VOID(handleStopPumpInjection, void()); + REG_EXTFN_VOID(handleStartPumpInjection, void()); REG_EXTFN_VOID(setHandleStopPumpInjectionFlag, void()); + REG_EXTFN_VOID(clearHandleStopPumpInjectionFlag, void()); + stateUpdateThread.reset(new Thread("DisinfectionCtrlServiceExt-stateUpdateThread", [this]() { ThisThread thisThread; @@ -109,12 +112,21 @@ void DisinfectionCtrlServiceExt::setRealtimeConfig(shared_ptr dcs->getRealtimeCfg()[key] = val; dcs->updateCfg(); } +void DisinfectionCtrlServiceExt::handleStopPumpInjection(shared_ptr cxt) { + dcs->handleStopPumpInjection(); + if (stateUpdateThread) stateUpdateThread->wake(); +} +void DisinfectionCtrlServiceExt::handleStartPumpInjection(shared_ptr cxt) { + dcs->handleStartPumpInjection(); + if (stateUpdateThread) stateUpdateThread->wake(); +} + void DisinfectionCtrlServiceExt::clearHandleStopPumpInjectionFlag(shared_ptr cxt) { - dcs->clearHandleStopPumpInjectionFlag(); + dcs->handleStopPumpInjection(); if (stateUpdateThread) stateUpdateThread->wake(); } void DisinfectionCtrlServiceExt::setHandleStopPumpInjectionFlag(shared_ptr cxt) { - dcs->setHandleStopPumpInjectionFlag(); + dcs->handleStartPumpInjection(); if (stateUpdateThread) stateUpdateThread->wake(); } void DisinfectionCtrlServiceExt::getState(shared_ptr cxt) { cxt->rely = getState(); } diff --git a/appsrc/service/app/disinfection_ctrl_service_ext.hpp b/appsrc/service/app/disinfection_ctrl_service_ext.hpp index e0f7a59..68e5777 100644 --- a/appsrc/service/app/disinfection_ctrl_service_ext.hpp +++ b/appsrc/service/app/disinfection_ctrl_service_ext.hpp @@ -47,6 +47,9 @@ class DisinfectionCtrlServiceExt : public enable_shared_from_this cxt); void setHandleStopPumpInjectionFlag(shared_ptr cxt); + void handleStopPumpInjection(shared_ptr cxt); + void handleStartPumpInjection(shared_ptr cxt); + /******************************************************************************* * 状态 * *******************************************************************************/