From a01b07c070745692c3bbb3fac0c27e072dc27456 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 26 Aug 2024 10:54:38 +0800 Subject: [PATCH] update --- app_protocols/transmit_disfection_protocol | 2 +- usrc/app/dmapp.cpp | 41 +++++++++++++++++++----------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/app_protocols/transmit_disfection_protocol b/app_protocols/transmit_disfection_protocol index 6fb781e..9135659 160000 --- a/app_protocols/transmit_disfection_protocol +++ b/app_protocols/transmit_disfection_protocol @@ -1 +1 @@ -Subproject commit 6fb781e6b5fe8f4f44c7046b30cbee47512f5bd9 +Subproject commit 9135659ab41af623d10c691646501d313f927c14 diff --git a/usrc/app/dmapp.cpp b/usrc/app/dmapp.cpp index 4a772c7..191ef35 100644 --- a/usrc/app/dmapp.cpp +++ b/usrc/app/dmapp.cpp @@ -133,29 +133,40 @@ void DisinfectionApp::initialize() { /*********************************************************************************************************************** * 气密性测试通道 * ***********************************************************************************************************************/ + + // kAirLeakTestMode_disinfection + // kAirLeakTestMode_inflation + // kAirLeakTestMode_leakTest + if (PORT::isLiquidCtrlBoard() && (PORT::isPipeDM())) { - static ZGPIO airTightnessTestChGpio; - static ZGPIO eValve0; - static ZGPIO eValve1; - static bool state = false; + static air_leak_test_mode_t airLeakTestMode = kAirLeakTestMode_disinfection; + static ZGPIO airTightnessTestChGpio; + static ZGPIO eValve0; + static ZGPIO eValve1; airTightnessTestChGpio.initAsOutput(PD14, kxs_gpio_nopull, true, false); eValve0.initAsOutput(PD15, kxs_gpio_nopull, false, true); eValve1.initAsOutput(PC6, kxs_gpio_nopull, false, true); - REG_LAMADA_FN(kfn_air_leak_detect_test_set_mode, [&](ProcessContext* cxt) { - if (GET_PARAM(0) == 1) { - airTightnessTestChGpio.write(1); // 内管路,气密性测试 - eValve0.write(0); - eValve1.write(0); // 电磁阀闭合 - state = true; - } else { + REG_LAMADA_FN(kfn_air_leak_test_set_mode, [&](ProcessContext* cxt) { + if (GET_PARAM(0) == kAirLeakTestMode_disinfection) { + airTightnessTestChGpio.write(1); // 内管路 + eValve0.write(1); // 电磁阀打开 + eValve1.write(1); // 电磁阀打开 + } else if (GET_PARAM(0) == kAirLeakTestMode_inflation) { airTightnessTestChGpio.write(0); // 连接空气 - eValve0.write(1); - eValve1.write(1); // 电磁阀打开 - state = false; + eValve0.write(1); // 电磁阀打开 + eValve1.write(1); // 电磁阀打开 + } else if (GET_PARAM(0) == kAirLeakTestMode_leakTest) { + airTightnessTestChGpio.write(1); // 内管路 + eValve0.write(0); // 电磁阀闭合 + eValve1.write(0); // 电磁阀闭合 } + airLeakTestMode = (air_leak_test_mode_t)GET_PARAM(0); zcanbus_send_ack(cxt->packet, NULL, 0); }); - REG_LAMADA_FN(kfn_air_tightness_test_get_mode, [&](ProcessContext* cxt) { zcanbus_send_ack(cxt->packet, state); }); + REG_LAMADA_FN(kfn_air_leak_test_get_mode, [&](ProcessContext* cxt) { + int32_t mode = airLeakTestMode; + zcanbus_send_ack(cxt->packet, mode); + }); } }