Browse Source

v1.0.6

storage-in-realtime
zhaohe 11 months ago
parent
commit
a269fdec7f
  1. 3
      README.md
  2. 6
      appsrc/appbase/appbean/air_leak_test_mode.hpp
  3. 2
      appsrc/appsetting/project_port/basic/zappversion.hpp
  4. 40
      appsrc/service/app/air_leak_detect_test.cpp
  5. 6
      appsrc/service/app/air_leak_detect_test.hpp
  6. 8
      appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp
  7. 6
      appsrc/service/hardware/device_io_ctrl_service.cpp
  8. 1
      appsrc/service/hardware/device_io_ctrl_service.hpp

3
README.md

@ -26,4 +26,7 @@ VERSION 1.0.4
VERSION 1.0.5 VERSION 1.0.5
1. 修改测试json格式 1. 修改测试json格式
2. 修改气密性测试阀门控制逻辑 2. 修改气密性测试阀门控制逻辑
VERSION 1.0.6
1. 修改消毒时空压机关闭时机
2. 修改气密性测试逻辑
``` ```

6
appsrc/appbase/appbean/air_leak_test_mode.hpp

@ -6,8 +6,6 @@
#define AirLeakTestMode_LIST(type, marco) /**/ \ #define AirLeakTestMode_LIST(type, marco) /**/ \
marco(type, disinfection) /**/ \ marco(type, disinfection) /**/ \
marco(type, inflation) /**/ \ marco(type, inflation) /**/ \
marco(type, leakTest) /**/ \
marco(type, closeAll) /**/ \
marco(type, openAll) /**/
marco(type, leakTest) /**/
ZENUM_DECLAR(AirLeakTestMode, AirLeakTestMode_LIST); ZENUM_DECLAR(AirLeakTestMode, AirLeakTestMode_LIST);

2
appsrc/appsetting/project_port/basic/zappversion.hpp

@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION "1.0.5"
#define VERSION "1.0.6"
#define PROJECT_NAME "TRANSMIT_DM" #define PROJECT_NAME "TRANSMIT_DM"

40
appsrc/service/app/air_leak_detect_test.cpp

@ -2,6 +2,9 @@
#include "pipeline_pressure_control.hpp" #include "pipeline_pressure_control.hpp"
using namespace iflytop; using namespace iflytop;
#define DEFAULT_INFLATION_TIME_MS 300
void AirLeakDetectTest::initialize() { void AirLeakDetectTest::initialize() {
logger->info("AirLeakDetectTest initialize"); logger->info("AirLeakDetectTest initialize");
@ -10,13 +13,13 @@ void AirLeakDetectTest::initialize() {
GET_TO_SERVICE(m_gConfig) GET_TO_SERVICE(m_gConfig)
GET_TO_SERVICE(m_dics) GET_TO_SERVICE(m_dics)
REG_EXTFN_VOID(start, void());
REG_EXTFN(start, void(int), inflationTimeMs);
REG_EXTFN_VOID(stop, void()); REG_EXTFN_VOID(stop, void());
REG_EXTFN_VOID(getState, void()); REG_EXTFN_VOID(getState, void());
REG_EXTFN_VOID(getServiceConfig, void()); REG_EXTFN_VOID(getServiceConfig, void());
} }
void AirLeakDetectTest::start() {
void AirLeakDetectTest::start(int inflationTimeMs) {
logger->info("AirLeakDetectTest start"); logger->info("AirLeakDetectTest start");
auto nowstate = m_ds->getDeviceState(); auto nowstate = m_ds->getDeviceState();
if (nowstate != DeviceState::Idle) { if (nowstate != DeviceState::Idle) {
@ -26,16 +29,16 @@ void AirLeakDetectTest::start() {
m_workstate = kinitDevice; m_workstate = kinitDevice;
DS->setDeviceState(DeviceState::AirLeakDetectTesting); DS->setDeviceState(DeviceState::AirLeakDetectTesting);
m_thread.reset(new Thread("AirLeakDetectTestThread", [this]() {
m_thread.reset(new Thread("AirLeakDetectTestThread", [this, inflationTimeMs]() {
try { try {
airLeakDetectTestThread();
airLeakDetectTestThread(inflationTimeMs);
} catch (const appexception& e) { } catch (const appexception& e) {
AppEventBus::ins()->push(make_shared<AppWarningPromoptEvent>(e)); AppEventBus::ins()->push(make_shared<AppWarningPromoptEvent>(e));
} }
GET_SERVICE(PipelinePressureControl)->syncPressureValueState(); GET_SERVICE(PipelinePressureControl)->syncPressureValueState();
try { try {
// if (PORT.isPipeDM()) m_dics->AirLeakDetectTestModeCtrl_setMode(0);
if (PORT.isPipeDM()) m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::disinfection);
} catch (...) { } catch (...) {
} }
@ -52,12 +55,13 @@ void AirLeakDetectTest::stop() {
} }
AirLeakDetectTest::state_t AirLeakDetectTest::getWorkstate() { return m_workstate; } AirLeakDetectTest::state_t AirLeakDetectTest::getWorkstate() { return m_workstate; }
void AirLeakDetectTest::airLeakDetectTestThread() {
void AirLeakDetectTest::airLeakDetectTestThread(int inflationTimeMs) {
if (PORT.isPipeDM()) { if (PORT.isPipeDM()) {
m_workstate = kinitDevice; m_workstate = kinitDevice;
// 初始化设备,关闭比例法 // 初始化设备,关闭比例法
m_dics->PosiPressureProp_setValve(0); m_dics->PosiPressureProp_setValve(0);
m_dics->NegaPressureProp_setValve(0); m_dics->NegaPressureProp_setValve(0);
m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::inflation);
// 等待比例法关闭 // 等待比例法关闭
while (!ThisThread().getExitFlag()) { while (!ThisThread().getExitFlag()) {
@ -73,10 +77,11 @@ void AirLeakDetectTest::airLeakDetectTestThread() {
// 开始充气 // 开始充气
logger->info("inflate....."); logger->info("inflate.....");
m_workstate = kinflating; 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; if (ThisThread().getExitFlag()) return;
// 等待充气完成 // 等待充气完成
@ -92,8 +97,8 @@ void AirLeakDetectTest::airLeakDetectTestThread() {
* EXT * * EXT *
*******************************************************************************/ *******************************************************************************/
void AirLeakDetectTest::start(shared_ptr<MsgProcessContext> cxt) { //
start();
void AirLeakDetectTest::start(shared_ptr<MsgProcessContext> cxt, int inflationTimeMs) { //
start(inflationTimeMs);
} }
void AirLeakDetectTest::stop(shared_ptr<MsgProcessContext> cxt) { stop(); } void AirLeakDetectTest::stop(shared_ptr<MsgProcessContext> cxt) { stop(); }
void AirLeakDetectTest::getState(shared_ptr<MsgProcessContext> cxt) { // void AirLeakDetectTest::getState(shared_ptr<MsgProcessContext> cxt) { //
@ -107,10 +112,11 @@ void AirLeakDetectTest::getState(shared_ptr<MsgProcessContext> cxt) { //
void AirLeakDetectTest::getServiceConfig(shared_ptr<MsgProcessContext> cxt) { void AirLeakDetectTest::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
if (PORT.isPipeDM()) { if (PORT.isPipeDM()) {
json cfg; 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;
} }
} }

6
appsrc/service/app/air_leak_detect_test.hpp

@ -72,17 +72,17 @@ class AirLeakDetectTest : public enable_shared_from_this<AirLeakDetectTest> {
public: public:
void initialize(); void initialize();
void start();
void start( int inflationTimeMs);
void stop(); void stop();
state_t getWorkstate(); state_t getWorkstate();
void start(shared_ptr<MsgProcessContext> cxt);
void start(shared_ptr<MsgProcessContext> cxt, int inflationTimeMs);
void stop(shared_ptr<MsgProcessContext> cxt); void stop(shared_ptr<MsgProcessContext> cxt);
void getState(shared_ptr<MsgProcessContext> cxt); void getState(shared_ptr<MsgProcessContext> cxt);
void getServiceConfig(shared_ptr<MsgProcessContext> cxt); void getServiceConfig(shared_ptr<MsgProcessContext> cxt);
private: private:
void airLeakDetectTestThread();
void airLeakDetectTestThread(int inflationTimeMs);
}; };
} // namespace iflytop } // namespace iflytop

8
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; s_remaintime = m_tlog * 60 * 60 * 2;
} else if (event->event == kevent_exit_state) { } else if (event->event == kevent_exit_state) {
s_isDisinfectionTakeBreak = false; s_isDisinfectionTakeBreak = false;
dics->AC_close();
dics->SprayPump_stop();
dics->Blower_close(); dics->Blower_close();
dics->Heater_close(); dics->Heater_close();
dics->SprayPump_stop();
dics->AC_close();
s_dvalue = 0; s_dvalue = 0;
tryLogState(true); tryLogState(true);
} else if (event->event == kevent_tmr_1s) { } else if (event->event == kevent_tmr_1s) {
@ -541,8 +541,8 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event)
} else { } else {
if (isTimeToResumeDisinfection()) { if (isTimeToResumeDisinfection()) {
logger->info("resumeDisinfection"); logger->info("resumeDisinfection");
dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed));
dics->AC_ctrl(1); dics->AC_ctrl(1);
dics->SprayPump_start(getSettingAsInt(SettingId::injection_pump_speed));
s_isDisinfectionTakeBreak = false; s_isDisinfectionTakeBreak = false;
tryLogState(true); tryLogState(true);
} }
@ -589,12 +589,14 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event)
void DisinfectionCtrlService::processStateEmpytLiquidFromTheLine(DisinfectionEvent* event) { void DisinfectionCtrlService::processStateEmpytLiquidFromTheLine(DisinfectionEvent* event) {
if (event->event == kevent_enter_state) { if (event->event == kevent_enter_state) {
tryLogState(true); tryLogState(true);
dics->AC_ctrl(1);
dics->SprayPump_startInRPM(-PORT.getSprayLiquidPumpMaxRPM()); dics->SprayPump_startInRPM(-PORT.getSprayLiquidPumpMaxRPM());
s_remaintime = EMTPTY_LINE_WHEN_DISINFECTION; s_remaintime = EMTPTY_LINE_WHEN_DISINFECTION;
} else if (event->event == kevent_exit_state) { } else if (event->event == kevent_exit_state) {
tryLogState(true); tryLogState(true);
dics->SprayPump_stop(); dics->SprayPump_stop();
dics->AC_close();
} else if (event->event == kevent_tmr_1s) { } else if (event->event == kevent_tmr_1s) {
s_remaintime--; s_remaintime--;
if (s_remaintime <= 0) { if (s_remaintime <= 0) {

6
appsrc/service/hardware/device_io_ctrl_service.cpp

@ -255,6 +255,12 @@ int DeviceIoControlService::AC_ctrl(int power) {
usleep(1000 * 1000); usleep(1000 * 1000);
return 0; 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() { int DeviceIoControlService::AC_close() {
logger->info(" AC_close"); logger->info(" AC_close");
if (!isInTestMode()) CAN_MASTER->airCompressorCtrl(GET_BOARDID(), 0); if (!isInTestMode()) CAN_MASTER->airCompressorCtrl(GET_BOARDID(), 0);

1
appsrc/service/hardware/device_io_ctrl_service.hpp

@ -66,6 +66,7 @@ class DeviceIoControlService : public enable_shared_from_this<DeviceIoControlSer
// 空压机控制 // 空压机控制
int AC_ctrl(int power); int AC_ctrl(int power);
int AC_ctrlNoDelay(int power);
int AC_close(); int AC_close();
float AC_readEI(); float AC_readEI();

Loading…
Cancel
Save