|
|
@ -42,34 +42,28 @@ void DisinfectionApp::initialize() { |
|
|
|
if (isBoardType(kLargeSpaceDMPowerCtrlBoard, kSmallSpaceDMPowerCtrlBoard, kPipeDMPowerCtrlBoard)) { |
|
|
|
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|
|
|
heaterCtrler.initialize(PC7, &hadc1, ADC_CHANNEL_2, &hadc1, ADC_CHANNEL_8); |
|
|
|
bindHeaterCtrler(); |
|
|
|
} else if (isBoardType(kDrawBarDMPowerCtrlBoard)) { |
|
|
|
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|
|
|
heaterCtrler.initialize(PC7, NULL, 0, &hadc1, ADC_CHANNEL_1); |
|
|
|
bindHeaterCtrler(); |
|
|
|
} |
|
|
|
|
|
|
|
// 风机
|
|
|
|
if (isBoardType(kLargeSpaceDMPowerCtrlBoard, kSmallSpaceDMPowerCtrlBoard)) { |
|
|
|
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|
|
|
blowerCtrler.initialize(PC5, &hadc1, ADC_CHANNEL_1); |
|
|
|
bindBlowerCtrler(); |
|
|
|
} else if (isBoardType(kPipeDMPowerCtrlBoard)) { |
|
|
|
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|
|
|
LargeSpaceDmPowerCtrlBoardHal::HUART2_INIT(9600, UART_STOPBITS_1); |
|
|
|
blowerCtrler.initializeAsHighPowerUartBlower(&huart2, &hadc1, ADC_CHANNEL_1); |
|
|
|
bindBlowerCtrler(); |
|
|
|
} else if (isBoardType(kDrawBarDMPowerCtrlBoard)) { |
|
|
|
DBDMPowerCtrlBoard::HTIM3_INIT(); |
|
|
|
blowerCtrler.initializeAsMiniPwmBlower(&htim3, TIM_CHANNEL_3, PC6 /*en*/, PC9 /*fb*/); |
|
|
|
bindBlowerCtrler(); |
|
|
|
} |
|
|
|
|
|
|
|
// 空压机
|
|
|
|
if (isBoardType(kLargeSpaceDMPowerCtrlBoard, kSmallSpaceDMPowerCtrlBoard, kPipeDMPowerCtrlBoard)) { |
|
|
|
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|
|
|
airComCtrler.initialize(PC3, &hadc1, ADC_CHANNEL_0); |
|
|
|
bindAirComCtrler(); |
|
|
|
} else if (isBoardType(kDrawBarDMLiquidCtrlBoard)) { |
|
|
|
airComCtrler.initialize(PD14, NULL, 0); |
|
|
|
} |
|
|
@ -78,8 +72,7 @@ void DisinfectionApp::initialize() { |
|
|
|
// kfn_air_tightness_test_ac_ctrl
|
|
|
|
if (isBoardType(kPipeDMPowerCtrlBoard)) { |
|
|
|
REG_LAMADA_FN(kfn_air_tightness_test_ac_ctrl, [&](ProcessContext* cxt) { |
|
|
|
airComCtrler.air_compressor_ctrl(GET_PARAM(0)); |
|
|
|
airComCtrler.air_compressor_ctrl_safe_valve(GET_PARAM(0)); |
|
|
|
airComCtrler.open(GET_PARAM(0)); |
|
|
|
zcanbus_send_ack(cxt->packet, NULL, 0); |
|
|
|
}); |
|
|
|
} else if (isBoardType(kDrawBarDMLiquidCtrlBoard)) { |
|
|
@ -96,7 +89,6 @@ void DisinfectionApp::initialize() { |
|
|
|
LargeSpaceDmPowerCtrlBoardHal::HUART3_INIT(19200, UART_STOPBITS_2); |
|
|
|
LargeSpaceDmPowerCtrlBoardHal::HADC1_INIT(); |
|
|
|
h2o2Sensor.initialize(&huart3, &hadc1, ADC_CHANNEL_3); |
|
|
|
bindH2o2Sensor(); |
|
|
|
} |
|
|
|
|
|
|
|
// 水浸传感器
|
|
|
@ -104,8 +96,9 @@ void DisinfectionApp::initialize() { |
|
|
|
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*/); |
|
|
|
bindDeviceBottomWS(); |
|
|
|
bindEvaporationBinWS(); |
|
|
|
|
|
|
|
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)) { |
|
|
@ -113,7 +106,6 @@ void DisinfectionApp::initialize() { |
|
|
|
ZLOGI(TAG, "TMCMotorGroup init"); |
|
|
|
LargeSpaceDMLiquidCtrlBoardHal::HSPI1_INIT(); |
|
|
|
tmcPowerGroup.initialize(PB2, {&hspi1, PC4 /*cs*/, PB13 /*en*/}, {&hspi1, PA4 /*cs*/, PB12 /*en*/}); |
|
|
|
bindTmcPowerGroup(); |
|
|
|
} |
|
|
|
|
|
|
|
// 三色指示灯
|
|
|
@ -121,7 +113,6 @@ void DisinfectionApp::initialize() { |
|
|
|
// 三色指示灯初始化
|
|
|
|
ZLOGI(TAG, "WarningLightDriver init"); |
|
|
|
wlDriver.initialize(PD8, PD7, PD9, PD10); |
|
|
|
bindWlDriver(); |
|
|
|
} |
|
|
|
|
|
|
|
// 压力传感器初始化
|
|
|
@ -130,14 +121,12 @@ void DisinfectionApp::initialize() { |
|
|
|
osDelay(1500); // 等待传感器上电
|
|
|
|
LargeSpaceDMLiquidCtrlBoardHal::HUART3_INIT(9600, UART_STOPBITS_1); |
|
|
|
psBus.initialize(&huart3); |
|
|
|
bindPsBus(); |
|
|
|
} |
|
|
|
// 比例阀初始化
|
|
|
|
if (isBoardType(kPipeDMLiquidCtrlBoard)) { |
|
|
|
ZLOGI(TAG, "ProportionalValveCtrl init"); |
|
|
|
LargeSpaceDMLiquidCtrlBoardHal::HUART2_INIT(9600); |
|
|
|
proportionalValveCtrl.initialize(&huart2); |
|
|
|
bindProportionalValveCtrl(); |
|
|
|
} |
|
|
|
|
|
|
|
// 气密性测试通道
|
|
|
@ -163,70 +152,5 @@ void DisinfectionApp::initialize() { |
|
|
|
/***********************************************************************************************************************
|
|
|
|
* PROTOCOL_BIND * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
void DisinfectionApp::bindHeaterCtrler() { |
|
|
|
BIND_FN(HeaterController, &heaterCtrler, fn_heater_ctrl); |
|
|
|
BIND_FN(HeaterController, &heaterCtrler, fn_heater_ctrl_safe_valve); |
|
|
|
BIND_FN(HeaterController, &heaterCtrler, fn_heater_read_electric_current); |
|
|
|
BIND_FN(HeaterController, &heaterCtrler, fn_heater_read_temperature_data); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionApp::bindBlowerCtrler() { |
|
|
|
BIND_FN(BlowerController, &blowerCtrler, fn_blower_ctrl); |
|
|
|
BIND_FN(BlowerController, &blowerCtrler, fn_blower_ctrl_safe_valve); |
|
|
|
BIND_FN(BlowerController, &blowerCtrler, fn_blower_read_electric_current); |
|
|
|
BIND_FN(BlowerController, &blowerCtrler, fn_blower_is_error); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionApp::bindAirComCtrler() { |
|
|
|
BIND_FN(AirCompressorController, &airComCtrler, fn_air_compressor_ctrl); |
|
|
|
BIND_FN(AirCompressorController, &airComCtrler, fn_air_compressor_ctrl_safe_valve); |
|
|
|
BIND_FN(AirCompressorController, &airComCtrler, fn_air_compressor_read_electric_current); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionApp::bindH2o2Sensor() { |
|
|
|
BIND_FN(H2O2SensorDriver, &h2o2Sensor, fn_h2o2_sensor_read_calibration_date); |
|
|
|
BIND_FN(H2O2SensorDriver, &h2o2Sensor, fn_h2o2_sensor_read_sub_ic_errorcode); |
|
|
|
BIND_FN(H2O2SensorDriver, &h2o2Sensor, fn_h2o2_sensor_read_sub_ic_reg); |
|
|
|
} |
|
|
|
void DisinfectionApp::bindWlDriver() { BIND_FN(WarningLightDriver, &wlDriver, fn_triple_warning_light_ctl); } |
|
|
|
|
|
|
|
void DisinfectionApp::bindTmcPowerGroup() { |
|
|
|
BIND_FN(TmcMotorGroup, &tmcPowerGroup, fn_pump_rotate); |
|
|
|
BIND_FN(TmcMotorGroup, &tmcPowerGroup, fn_pump_stop); |
|
|
|
BIND_FN(TmcMotorGroup, &tmcPowerGroup, fn_pump_set_ihold_irun_idelay); |
|
|
|
BIND_FN(TmcMotorGroup, &tmcPowerGroup, fn_pump_set_acc); |
|
|
|
BIND_FN(TmcMotorGroup, &tmcPowerGroup, fn_pump_set_ramp); |
|
|
|
BIND_FN(TmcMotorGroup, &tmcPowerGroup, fn_pump_set_tzw); |
|
|
|
BIND_FN(TmcMotorGroup, &tmcPowerGroup, fn_pump_set_subic_reg); |
|
|
|
BIND_FN(TmcMotorGroup, &tmcPowerGroup, fn_pump_get_subic_reg); |
|
|
|
BIND_FN(TmcMotorGroup, &tmcPowerGroup, fn_pump_ping); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionApp::bindPsBus() { |
|
|
|
BIND_FN(PXXPSBus, &psBus, fn_psbus_read_data); |
|
|
|
BIND_FN(PXXPSBus, &psBus, fn_psbus_scan); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionApp::bindEvaporationBinWS() { |
|
|
|
ProtocolProcesserMgr::ins()->regCmdProcesser( //
|
|
|
|
CmdProcesser(kfn_evaporation_tank_water_sensor_read_state, //
|
|
|
|
[this](ProcessContext* cxt) { |
|
|
|
int32_t val = evaporationBinWS.read(); |
|
|
|
zcanbus_send_ack(cxt->packet, (uint8_t*)&val, sizeof(val)); |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionApp::bindDeviceBottomWS() { |
|
|
|
ProtocolProcesserMgr::ins()->regCmdProcesser( //
|
|
|
|
CmdProcesser(kfn_device_bottom_water_sensor_read_state, //
|
|
|
|
[this](ProcessContext* cxt) { |
|
|
|
int32_t val = deviceBottomWS.read(); |
|
|
|
zcanbus_send_ack(cxt->packet, (uint8_t*)&val, sizeof(val)); |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionApp::bindProportionalValveCtrl() { |
|
|
|
BIND_FN(ProportionalValveCtrl, &proportionalValveCtrl, fn_proportional_set_valve); |
|
|
|
BIND_FN(ProportionalValveCtrl, &proportionalValveCtrl, fn_proportional_read_pos); |
|
|
|
BIND_FN(ProportionalValveCtrl, &proportionalValveCtrl, fn_proportional_is_busy); |
|
|
|
} |