From a269fdec7f5c7c1a511fc9babd65978c7ed3be30 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 26 Aug 2024 14:14:59 +0800 Subject: [PATCH] v1.0.6 --- README.md | 3 ++ appsrc/appbase/appbean/air_leak_test_mode.hpp | 6 ++-- .../appsetting/project_port/basic/zappversion.hpp | 2 +- appsrc/service/app/air_leak_detect_test.cpp | 40 +++++++++++++--------- appsrc/service/app/air_leak_detect_test.hpp | 6 ++-- .../disinfection_ctrl_service.cpp | 8 +++-- appsrc/service/hardware/device_io_ctrl_service.cpp | 6 ++++ appsrc/service/hardware/device_io_ctrl_service.hpp | 1 + 8 files changed, 44 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 032ec6c..b6c8ca3 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,7 @@ VERSION 1.0.4 VERSION 1.0.5 1. 修改测试json格式 2. 修改气密性测试阀门控制逻辑 +VERSION 1.0.6 + 1. 修改消毒时空压机关闭时机 + 2. 修改气密性测试逻辑 ``` \ No newline at end of file diff --git a/appsrc/appbase/appbean/air_leak_test_mode.hpp b/appsrc/appbase/appbean/air_leak_test_mode.hpp index 743867a..c58d285 100644 --- a/appsrc/appbase/appbean/air_leak_test_mode.hpp +++ b/appsrc/appbase/appbean/air_leak_test_mode.hpp @@ -6,8 +6,6 @@ #define AirLeakTestMode_LIST(type, marco) /**/ \ marco(type, disinfection) /**/ \ marco(type, inflation) /**/ \ - marco(type, leakTest) /**/ \ - marco(type, closeAll) /**/ \ - marco(type, openAll) /**/ - + marco(type, leakTest) /**/ + ZENUM_DECLAR(AirLeakTestMode, AirLeakTestMode_LIST); \ No newline at end of file diff --git a/appsrc/appsetting/project_port/basic/zappversion.hpp b/appsrc/appsetting/project_port/basic/zappversion.hpp index 97233ea..cf1fbd9 100644 --- a/appsrc/appsetting/project_port/basic/zappversion.hpp +++ b/appsrc/appsetting/project_port/basic/zappversion.hpp @@ -1,3 +1,3 @@ #pragma once -#define VERSION "1.0.5" +#define VERSION "1.0.6" #define PROJECT_NAME "TRANSMIT_DM" \ No newline at end of file diff --git a/appsrc/service/app/air_leak_detect_test.cpp b/appsrc/service/app/air_leak_detect_test.cpp index 1025837..7c2b20f 100644 --- a/appsrc/service/app/air_leak_detect_test.cpp +++ b/appsrc/service/app/air_leak_detect_test.cpp @@ -2,6 +2,9 @@ #include "pipeline_pressure_control.hpp" using namespace iflytop; + +#define DEFAULT_INFLATION_TIME_MS 300 + void AirLeakDetectTest::initialize() { logger->info("AirLeakDetectTest initialize"); @@ -10,13 +13,13 @@ void AirLeakDetectTest::initialize() { GET_TO_SERVICE(m_gConfig) GET_TO_SERVICE(m_dics) - REG_EXTFN_VOID(start, void()); + REG_EXTFN(start, void(int), inflationTimeMs); REG_EXTFN_VOID(stop, void()); REG_EXTFN_VOID(getState, void()); REG_EXTFN_VOID(getServiceConfig, void()); } -void AirLeakDetectTest::start() { +void AirLeakDetectTest::start(int inflationTimeMs) { logger->info("AirLeakDetectTest start"); auto nowstate = m_ds->getDeviceState(); if (nowstate != DeviceState::Idle) { @@ -26,16 +29,16 @@ void AirLeakDetectTest::start() { m_workstate = kinitDevice; DS->setDeviceState(DeviceState::AirLeakDetectTesting); - m_thread.reset(new Thread("AirLeakDetectTestThread", [this]() { + m_thread.reset(new Thread("AirLeakDetectTestThread", [this, inflationTimeMs]() { try { - airLeakDetectTestThread(); + airLeakDetectTestThread(inflationTimeMs); } catch (const appexception& e) { AppEventBus::ins()->push(make_shared(e)); } GET_SERVICE(PipelinePressureControl)->syncPressureValueState(); try { - // if (PORT.isPipeDM()) m_dics->AirLeakDetectTestModeCtrl_setMode(0); + if (PORT.isPipeDM()) m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::disinfection); } catch (...) { } @@ -52,12 +55,13 @@ void AirLeakDetectTest::stop() { } AirLeakDetectTest::state_t AirLeakDetectTest::getWorkstate() { return m_workstate; } -void AirLeakDetectTest::airLeakDetectTestThread() { +void AirLeakDetectTest::airLeakDetectTestThread(int inflationTimeMs) { if (PORT.isPipeDM()) { m_workstate = kinitDevice; // 初始化设备,关闭比例法 m_dics->PosiPressureProp_setValve(0); m_dics->NegaPressureProp_setValve(0); + m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::inflation); // 等待比例法关闭 while (!ThisThread().getExitFlag()) { @@ -73,10 +77,11 @@ void AirLeakDetectTest::airLeakDetectTestThread() { // 开始充气 logger->info("inflate....."); m_workstate = kinflating; - m_dics->AC_ctrl(1); - ThisThread().sleepForMs(100); // 充气时间 - m_dics->AC_ctrl(0); - // m_dics->AirLeakDetectTestModeCtrl_setMode(1); + m_dics->AC_ctrlNoDelay(1); + if (inflationTimeMs == 0) inflationTimeMs = DEFAULT_INFLATION_TIME_MS; + ThisThread().sleepForMs(inflationTimeMs); // 充气时间 + m_dics->AC_close(); + m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::leakTest); if (ThisThread().getExitFlag()) return; // 等待充气完成 @@ -92,8 +97,8 @@ void AirLeakDetectTest::airLeakDetectTestThread() { * EXT * *******************************************************************************/ -void AirLeakDetectTest::start(shared_ptr cxt) { // - start(); +void AirLeakDetectTest::start(shared_ptr cxt, int inflationTimeMs) { // + start(inflationTimeMs); } void AirLeakDetectTest::stop(shared_ptr cxt) { stop(); } void AirLeakDetectTest::getState(shared_ptr cxt) { // @@ -107,10 +112,11 @@ void AirLeakDetectTest::getState(shared_ptr cxt) { // void AirLeakDetectTest::getServiceConfig(shared_ptr cxt) { if (PORT.isPipeDM()) { json cfg; - cfg["pressureUint"] = "kPa"; - cfg["pressureMax"] = 8.0; - cfg["show"] = true; - cfg["updatePeriod"] = 300; - cxt->rely = cfg; + cfg["pressureUint"] = "kPa"; + cfg["pressureMax"] = 8.0; + cfg["show"] = true; + cfg["updatePeriod"] = 300; + cfg["inflationTimeMs"] = DEFAULT_INFLATION_TIME_MS; + cxt->rely = cfg; } } \ No newline at end of file diff --git a/appsrc/service/app/air_leak_detect_test.hpp b/appsrc/service/app/air_leak_detect_test.hpp index 462cb7c..d9787e5 100644 --- a/appsrc/service/app/air_leak_detect_test.hpp +++ b/appsrc/service/app/air_leak_detect_test.hpp @@ -72,17 +72,17 @@ class AirLeakDetectTest : public enable_shared_from_this { public: void initialize(); - void start(); + void start( int inflationTimeMs); void stop(); state_t getWorkstate(); - void start(shared_ptr cxt); + void start(shared_ptr cxt, int inflationTimeMs); void stop(shared_ptr cxt); void getState(shared_ptr cxt); void getServiceConfig(shared_ptr cxt); private: - void airLeakDetectTestThread(); + void airLeakDetectTestThread(int inflationTimeMs); }; } // namespace iflytop diff --git a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp index e6bd79c..286ecd0 100644 --- a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp +++ b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp @@ -503,10 +503,10 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) s_remaintime = m_tlog * 60 * 60 * 2; } else if (event->event == kevent_exit_state) { s_isDisinfectionTakeBreak = false; - dics->AC_close(); + dics->SprayPump_stop(); dics->Blower_close(); dics->Heater_close(); - dics->SprayPump_stop(); + dics->AC_close(); s_dvalue = 0; tryLogState(true); } else if (event->event == kevent_tmr_1s) { @@ -541,8 +541,8 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) } else { if (isTimeToResumeDisinfection()) { logger->info("resumeDisinfection"); - dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); dics->AC_ctrl(1); + dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed)); s_isDisinfectionTakeBreak = false; tryLogState(true); } @@ -589,12 +589,14 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event) void DisinfectionCtrlService::processStateEmpytLiquidFromTheLine(DisinfectionEvent* event) { if (event->event == kevent_enter_state) { tryLogState(true); + dics->AC_ctrl(1); dics->SprayPump_startInRPM(-PORT.getSprayLiquidPumpMaxRPM()); s_remaintime = EMTPTY_LINE_WHEN_DISINFECTION; } else if (event->event == kevent_exit_state) { tryLogState(true); dics->SprayPump_stop(); + dics->AC_close(); } else if (event->event == kevent_tmr_1s) { s_remaintime--; if (s_remaintime <= 0) { diff --git a/appsrc/service/hardware/device_io_ctrl_service.cpp b/appsrc/service/hardware/device_io_ctrl_service.cpp index c335130..177bbcb 100644 --- a/appsrc/service/hardware/device_io_ctrl_service.cpp +++ b/appsrc/service/hardware/device_io_ctrl_service.cpp @@ -255,6 +255,12 @@ int DeviceIoControlService::AC_ctrl(int power) { usleep(1000 * 1000); return 0; } +int DeviceIoControlService::AC_ctrlNoDelay(int power) { + logger->info(" AC_ctrl, power={}", power); + if (!isInTestMode()) CAN_MASTER->airCompressorCtrl(GET_BOARDID(), power); + return 0; +} + int DeviceIoControlService::AC_close() { logger->info(" AC_close"); if (!isInTestMode()) CAN_MASTER->airCompressorCtrl(GET_BOARDID(), 0); diff --git a/appsrc/service/hardware/device_io_ctrl_service.hpp b/appsrc/service/hardware/device_io_ctrl_service.hpp index 4eee0d0..047beb7 100644 --- a/appsrc/service/hardware/device_io_ctrl_service.hpp +++ b/appsrc/service/hardware/device_io_ctrl_service.hpp @@ -66,6 +66,7 @@ class DeviceIoControlService : public enable_shared_from_this