Browse Source

v3.0.3 | 优化上报周期 修复部分BUG

master
zhaohe 4 weeks ago
parent
commit
b4196214a5
  1. 2
      appsrc/appconfig/basic/zappversion.hpp
  2. 2
      appsrc/baseservice/db/setting_db_dao.cpp
  3. 10
      appsrc/service/app/air_leak_detect_test.cpp
  4. 10
      appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp
  5. 10
      appsrc/service/app/disinfection_ctrl_service_ext.cpp
  6. 11
      appsrc/service/app/drain_liquid_service.cpp
  7. 2
      appsrc/service/app_core.cpp
  8. 2
      appsrc/service/front_end_realtime_display_content_mgr.cpp
  9. 2
      appsrc/service/test_page_ctrl_service.cpp

2
appsrc/appconfig/basic/zappversion.hpp

@ -1,3 +1,3 @@
#pragma once
#define VERSION "3.0.2"
#define VERSION "3.0.3"
#define PROJECT_NAME "TRANSMIT_DM"

2
appsrc/baseservice/db/setting_db_dao.cpp

@ -197,7 +197,7 @@ void SettingDBDao::initSettingDefaultValTable() {
break;
}
case SettingId::kdvalue_correct_coefficient: {
setting.name_ch = "D值修正";
setting.name_ch = "D值修正";
setting.setValConfig("float", "1.5", "0.5", "3");
setting.setVisibleRangeConfig(true, true, false, false);
break;

10
appsrc/service/app/air_leak_detect_test.cpp

@ -24,7 +24,12 @@ void AirLeakDetectTest::initialize() {
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(500);
if (m_workstate == kidle) {
ThisThread().sleepForMs(3000);
} else {
ThisThread().sleepForMs(500);
}
}
}));
} else {
@ -59,6 +64,8 @@ void AirLeakDetectTest::start(int inflationTimeMs) {
m_workstate = kidle;
DS->setDeviceState(DeviceState::Idle);
}));
stateUpdateThread->wake();
}
void AirLeakDetectTest::stop() {
logger->info("AirLeakDetectTest stop");
@ -66,6 +73,7 @@ void AirLeakDetectTest::stop() {
m_thread->join();
m_thread = nullptr;
}
stateUpdateThread->wake();
}
AirLeakDetectTest::state_t AirLeakDetectTest::getWorkstate() { return m_workstate; }

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

@ -27,13 +27,13 @@ string DisinfectionCtrlService::getSetting(SettingId sid) {
return value->second;
}
if (m_runType == RunType_t::kFormulaMode) {
string str = GET_SERVICE(FormulaDBDao)->getFormula(m_formulaid, sid);
string str = FORMULA_DB->getFormula(m_formulaid, sid);
if (!str.empty()) {
return str;
}
}
string str = GET_SERVICE(SettingDBDao)->getSettingValAsString(sid);
string str = SETTING_DB->getSettingValAsString(sid);
if (str.empty()) {
THROW_APP_EXCEPTION(err::kappe_setting_id_outof_range, fmt::format("setting id:{} not found", sid));
}
@ -245,6 +245,12 @@ void DisinfectionCtrlService::startWorkThread() {
GET_SERVICE(WarningLightControler)->setworkFlag(false);
DS->setDeviceState(DeviceState::Idle);
}));
// Waitting for the state machine to change from idle to init
for (size_t i = 0; i < 50; i++) {
if (sm.getState() != DisinfectionState::idle) break;
usleep(100 * 1000);
}
}
void DisinfectionCtrlService::stop() {

10
appsrc/service/app/disinfection_ctrl_service_ext.cpp

@ -52,10 +52,16 @@ void DisinfectionCtrlServiceExt::initialize() {
REG_EXTFN_VOID(stopStateReport, void());
stateUpdateThread.reset(new Thread("DisinfectionCtrlServiceExt-stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
ThisThread thisThread;
while (!thisThread.getExitFlag()) {
json report = getState();
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", report);
ThisThread().sleepForMs(500);
if (dcs->getState().getId() == DisinfectionState::kidle) {
thisThread.sleepForMs(5000);
} else {
thisThread.sleepForMs(900);
}
}
}));
}

11
appsrc/service/app/drain_liquid_service.cpp

@ -18,13 +18,18 @@ void DrainLiquidService::initialize() {
REG_EXTFN_VOID(stopStateReport, void());
stateUpdateThread.reset(new Thread("DrainLiquidService-stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
ThisThread thisThread;
while (!thisThread.getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(500);
if (m_workstate == kidle) {
thisThread.sleepForMs(3000);
} else {
thisThread.sleepForMs(500);
}
}
}));
} else {
@ -72,6 +77,7 @@ void DrainLiquidService::start() {
m_workstate = kidle;
DS->setDeviceState(DeviceState::Idle);
}));
stateUpdateThread->wake();
}
DrainLiquidService::state_t DrainLiquidService::getWorkstate() { return m_workstate; }
@ -84,6 +90,7 @@ void DrainLiquidService::stop() {
m_workstate = kidle;
m_dics->AddLiquidPump_stop();
logger->info("stopDraining ");
stateUpdateThread->wake();
}
void DrainLiquidService::start(shared_ptr<MsgProcessContext> cxt) { //

2
appsrc/service/app_core.cpp

@ -242,7 +242,7 @@ void AppCore::initialize() {
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(1000);
ThisThread().sleepForMs(1500);
}
}));

2
appsrc/service/front_end_realtime_display_content_mgr.cpp

@ -16,7 +16,7 @@ void FrontEndRealtimeDisplayContentMgr::initialize() { //
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(1000);
ThisThread().sleepForMs(3000);
}
}));
}

2
appsrc/service/test_page_ctrl_service.cpp

@ -32,7 +32,7 @@ void TestPageCtrlService::initialize() {
m_thread.reset(new Thread("TestPageCtrlServiceReportThread", [this]() {
while (!ThisThread().getExitFlag()) {
ThisThread().sleepForMs(1000);
ThisThread().sleepForMs(3000);
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", readState());
}
}));

Loading…
Cancel
Save