14 changed files with 280 additions and 59 deletions
-
4.settings/language.settings.xml
-
3.vscode/settings.json
-
2app_protocols/transmit_disfection_protocol
-
2app_protocols/zscanprotocol
-
101usrc/app/dmapp.cpp
-
163usrc/app/dmapp.cpp.bak
-
8usrc/app_main.cpp
-
2usrc/base/protocol_processer_mgr.cpp
-
2usrc/base/protocol_processer_utils.hpp
-
26usrc/board/public_board.cpp
-
18usrc/board/public_board.hpp
-
3usrc/module/pxxpsbus.hpp
-
3usrc/module/tmc_motor_group.cpp
-
2zsdk
@ -1 +1 @@ |
|||
Subproject commit 1c51b0f0e8b16dcca31ee69f6a46f5b630500556 |
|||
Subproject commit 9836b9c4356e8cf635be9ab8394d75c8fb301dfe |
@ -1 +1 @@ |
|||
Subproject commit 94c49f650f508e64b9e30e733dbb161c72ae2559 |
|||
Subproject commit d11d41c1062568f629d5ec2bc6435319b7ea83e3 |
@ -0,0 +1,163 @@ |
|||
#include "dmapp.hpp" |
|||
|
|||
/** |
|||
* @brief |
|||
* 小空间和大空间硬件一样 |
|||
* 管道式----- |
|||
* 液路控制板 |
|||
* 相比于大空间消毒机,不同的点: |
|||
* 1.增加比例阀控制 |
|||
* 2.空压机通道控制 |
|||
* 功率板 |
|||
* 相比于大空间消毒机,不同的点: |
|||
* 1. 风机改成鼓风机(可控风速) |
|||
* 拉杆箱------ |
|||
* 液路控制板 |
|||
* 功率板 |
|||
*/ |
|||
|
|||
using namespace iflytop; |
|||
using namespace transmit_disfection_protocol; |
|||
#define TAG "DMAPP" |
|||
|
|||
DisinfectionApp* DisinfectionApp::ins() { |
|||
static DisinfectionApp instance; |
|||
return &instance; |
|||
} |
|||
|
|||
const char* DisinfectionApp::getName() { return "DisinfectionApp"; } |
|||
|
|||
void DisinfectionApp::initialize() { |
|||
int btid = PublicBoard::ins()->getBoardTypeId(); |
|||
// only support |
|||
// large space disinfection machine, |
|||
// small space disinfection machine, |
|||
// pipe disinfection machine, |
|||
ZASSERT(PORT::isLargeSpaceDM() || PORT::isLargeSpaceDM() || PORT::isPipeDM()); |
|||
|
|||
// 加热片 |
|||
if (PORT::isPowerCtrlBoard()) { |
|||
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|||
heaterCtrler.initialize(PC7, &hadc1, ADC_CHANNEL_2, &hadc1, ADC_CHANNEL_4); |
|||
} |
|||
|
|||
if (isBoardType(kLargeSpaceDMPowerCtrlBoard, kSmallSpaceDMPowerCtrlBoard, kPipeDMPowerCtrlBoard)) { |
|||
} else if (isBoardType(kDrawBarDMPowerCtrlBoard)) { |
|||
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|||
heaterCtrler.initialize(PC7, NULL, 0, &hadc1, ADC_CHANNEL_1); |
|||
} |
|||
|
|||
// 风机 |
|||
if (isBoardType(kLargeSpaceDMPowerCtrlBoard, kSmallSpaceDMPowerCtrlBoard)) { |
|||
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|||
blowerCtrler.initialize(PC5, &hadc1, ADC_CHANNEL_1); |
|||
} else if (isBoardType(kPipeDMPowerCtrlBoard)) { |
|||
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|||
LargeSpaceDmPowerCtrlBoardHal::HUART2_INIT(9600, UART_STOPBITS_1); |
|||
blowerCtrler.initializeAsHighPowerUartBlower(&huart2, &hadc1, ADC_CHANNEL_1); |
|||
} else if (isBoardType(kDrawBarDMPowerCtrlBoard)) { |
|||
DBDMPowerCtrlBoard::HTIM3_INIT(); |
|||
blowerCtrler.initializeAsMiniPwmBlower(&htim3, TIM_CHANNEL_3, PC6 /*en*/, PC9 /*fb*/); |
|||
} |
|||
|
|||
// 空压机 |
|||
if (isBoardType(kLargeSpaceDMPowerCtrlBoard, kSmallSpaceDMPowerCtrlBoard, kPipeDMPowerCtrlBoard)) { |
|||
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|||
airComCtrler.initialize(PC3, &hadc1, ADC_CHANNEL_0); |
|||
} else if (isBoardType(kDrawBarDMLiquidCtrlBoard)) { |
|||
airComCtrler.initialize(PD14, NULL, 0); |
|||
} |
|||
|
|||
// 气密性测试空压机 |
|||
// kfn_air_tightness_test_ac_ctrl |
|||
if (isBoardType(kPipeDMPowerCtrlBoard)) { |
|||
REG_LAMADA_FN(kfn_air_tightness_test_ac_ctrl, [&](ProcessContext* cxt) { |
|||
airComCtrler.open(GET_PARAM(0)); |
|||
zcanbus_send_ack(cxt->packet, NULL, 0); |
|||
}); |
|||
REG_LAMADA_FN(kfn_air_tightness_test_ac_is_open, [&](ProcessContext* cxt) { zcanbus_send_ack(cxt->packet, airComCtrler.isOpen()); }); |
|||
|
|||
} else if (isBoardType(kDrawBarDMLiquidCtrlBoard)) { |
|||
static ZGPIO airCompressorCtrlGpio; |
|||
airCompressorCtrlGpio.initAsOutput(PD15, kxs_gpio_nopull, true, false); |
|||
REG_LAMADA_FN(kfn_air_tightness_test_ac_ctrl, [&](ProcessContext* cxt) { |
|||
airCompressorCtrlGpio.write(GET_PARAM(0)); |
|||
zcanbus_send_ack(cxt->packet, NULL, 0); |
|||
}); |
|||
REG_LAMADA_FN(kfn_air_tightness_test_ac_is_open, [&](ProcessContext* cxt) { zcanbus_send_ack(cxt->packet, airCompressorCtrlGpio.read()); }); |
|||
} |
|||
|
|||
// H2O2传感器 |
|||
if (isBoardType(kLargeSpaceDMPowerCtrlBoard, kSmallSpaceDMPowerCtrlBoard, kPipeDMPowerCtrlBoard, kDrawBarDMPowerCtrlBoard)) { |
|||
LargeSpaceDmPowerCtrlBoardHal::HUART3_INIT(19200, UART_STOPBITS_2); |
|||
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|||
osDelay(3000); |
|||
h2o2Sensor.initialize(&huart3, &hadc1, ADC_CHANNEL_3); |
|||
} |
|||
|
|||
// 水浸传感器 |
|||
if (isBoardType(kLargeSpaceDMLiquidCtrlBoard, kSmallSpaceDMLiquidCtrlBoard, kPipeDMLiquidCtrlBoard)) { |
|||
ZLOGI(TAG, "WaterSensor init"); |
|||
evaporationBinWS.initAsInput(PC7, kxs_gpio_nopull, kxs_gpio_no_irq, true /*mirror*/); |
|||
deviceBottomWS.initAsInput(PC8, kxs_gpio_nopull, kxs_gpio_no_irq, true /*mirror*/); |
|||
|
|||
REG_LAMADA_FN(kfn_device_bottom_water_sensor_read_state, [&](ProcessContext* cxt) { zcanbus_send_ack(cxt->packet, deviceBottomWS.read()); }); |
|||
REG_LAMADA_FN(kfn_evaporation_tank_water_sensor_read_state, [&](ProcessContext* cxt) { zcanbus_send_ack(cxt->packet, evaporationBinWS.read()); }); |
|||
} |
|||
|
|||
if (isBoardType(kLargeSpaceDMLiquidCtrlBoard, kSmallSpaceDMLiquidCtrlBoard, kPipeDMLiquidCtrlBoard, kDrawBarDMLiquidCtrlBoard)) { |
|||
// TMC电机初始化 |
|||
ZLOGI(TAG, "TMCMotorGroup init"); |
|||
LargeSpaceDMLiquidCtrlBoardHal::HSPI1_INIT(); |
|||
tmcPowerGroup.initialize(PB2, {&hspi1, PA4 /*cs*/, PB12 /*en*/}, {&hspi1, PC4 /*cs*/, PB13 /*en*/}); |
|||
} |
|||
|
|||
// 三色指示灯 |
|||
if (isBoardType(kLargeSpaceDMLiquidCtrlBoard, kSmallSpaceDMLiquidCtrlBoard, kPipeDMLiquidCtrlBoard)) { |
|||
// 三色指示灯初始化 |
|||
ZLOGI(TAG, "WarningLightDriver init"); |
|||
wlDriver.initialize(PD8, PD7, PD9, PD10); |
|||
} |
|||
|
|||
// 压力传感器初始化 |
|||
if (isBoardType(kLargeSpaceDMLiquidCtrlBoard, kSmallSpaceDMLiquidCtrlBoard, kPipeDMLiquidCtrlBoard, kDrawBarDMLiquidCtrlBoard)) { |
|||
ZLOGI(TAG, "PXXPSBus init"); |
|||
osDelay(1500); // 等待传感器上电 |
|||
LargeSpaceDMLiquidCtrlBoardHal::HUART3_INIT(9600, UART_STOPBITS_1); |
|||
psBus.initialize(&huart3); |
|||
} |
|||
// 比例阀初始化 |
|||
if (isBoardType(kPipeDMLiquidCtrlBoard)) { |
|||
ZLOGI(TAG, "ProportionalValveCtrl init"); |
|||
LargeSpaceDMLiquidCtrlBoardHal::HUART2_INIT(9600); |
|||
proportionalValveCtrl.initialize(&huart2); |
|||
} |
|||
|
|||
// 气密性测试通道 |
|||
if (isBoardType(kPipeDMLiquidCtrlBoard)) { |
|||
static ZGPIO airTightnessTestChGpio; |
|||
static ZGPIO eValve; |
|||
static bool state = false; |
|||
airTightnessTestChGpio.initAsOutput(PD15, kxs_gpio_nopull, true, false); |
|||
eValve.initAsOutput(PD14, kxs_gpio_nopull, false, true); |
|||
|
|||
REG_LAMADA_FN(kfn_air_tightness_test_cutoff_ch, [&](ProcessContext* cxt) { |
|||
airTightnessTestChGpio.write(1); // 内管路,气密性测试 |
|||
eValve.write(0); // 电磁阀闭合 |
|||
state = true; |
|||
zcanbus_send_ack(cxt->packet, NULL, 0); |
|||
}); |
|||
REG_LAMADA_FN(kfn_air_tightness_test_release_ch, [&](ProcessContext* cxt) { |
|||
airTightnessTestChGpio.write(0); // 连接空气 |
|||
eValve.write(1); // 电磁阀打开 |
|||
state = false; |
|||
zcanbus_send_ack(cxt->packet, NULL, 0); |
|||
}); |
|||
// kfn_air_tightness_test_is_cutoff |
|||
REG_LAMADA_FN(kfn_air_tightness_test_is_cutoff, [&](ProcessContext* cxt) { zcanbus_send_ack(cxt->packet, state); }); |
|||
} |
|||
} |
|||
|
|||
/*********************************************************************************************************************** |
|||
* PROTOCOL_BIND * |
|||
***********************************************************************************************************************/ |
@ -1 +1 @@ |
|||
Subproject commit 50565f27ea3e0128518c920d6aa8c98e299e1e54 |
|||
Subproject commit 2ec58da3d9802e851e67149e3801f7fa6607621d |
Write
Preview
Loading…
Cancel
Save
Reference in new issue