diff --git a/.cproject b/.cproject index 972787d..c7a91be 100644 --- a/.cproject +++ b/.cproject @@ -62,6 +62,7 @@ + @@ -78,6 +79,7 @@ + @@ -120,42 +122,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.gitmodules b/.gitmodules index 7736c7d..d2f4d65 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "transmit_disfection_protocol"] -path = app_protocols/transmit_disfection_protocol -url = zwsd@192.168.1.3:p_transmit_disinfection_v3/transmit_disfection_protocol.git [submodule "app_protocols/zscanprotocol"] path = app_protocols/zscanprotocol url = zwsd@192.168.1.3:zprotocols/zscanprotocol.git @@ -22,3 +19,6 @@ url = zwsd@192.168.1.3:zsdk_stm32_v1/Drivers.git [submodule "Core"] path = Core url = zwsd@192.168.1.3:zsdk_stm32_v1/Core.git +[submodule "app_protocols/transmit_disfection_protocol"] + path = app_protocols/transmit_disfection_protocol + url = zwsd@192.168.1.3:p_transmit_disinfection_v3/transmit_disfection_protocol.git diff --git a/README.md b/README.md index cd41b81..457402a 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,8 @@ ``` ``` + V103:增加比例阀超时判定阈值 - V2: - 完成需求 - V3: - 1.当控制电机时,会重置电机异常标志位 - V4: - 1.去掉压力传感器传感器信息自动上报 - V5: - 添加看门狗 ``` ```c diff --git a/app_protocols/transmit_disfection_protocol b/app_protocols/transmit_disfection_protocol new file mode 160000 index 0000000..6fb781e --- /dev/null +++ b/app_protocols/transmit_disfection_protocol @@ -0,0 +1 @@ +Subproject commit 6fb781e6b5fe8f4f44c7046b30cbee47512f5bd9 diff --git a/app_protocols/zscanprotocol b/app_protocols/zscanprotocol new file mode 160000 index 0000000..d11d41c --- /dev/null +++ b/app_protocols/zscanprotocol @@ -0,0 +1 @@ +Subproject commit d11d41c1062568f629d5ec2bc6435319b7ea83e3 diff --git a/stm32components b/stm32components index d387a6d..03d9638 160000 --- a/stm32components +++ b/stm32components @@ -1 +1 @@ -Subproject commit d387a6d07dd669a43fafc96016635e3b95830a0c +Subproject commit 03d9638ccbc69971524957a68e51842da0960940 diff --git a/ucomponents/preportional_valve/preportional_valve_ctrl.cpp b/ucomponents/preportional_valve/preportional_valve_ctrl.cpp index b00e913..60007f9 100644 --- a/ucomponents/preportional_valve/preportional_valve_ctrl.cpp +++ b/ucomponents/preportional_valve/preportional_valve_ctrl.cpp @@ -7,14 +7,14 @@ using namespace zscanprotocol; #define WORK_STATE_REG 0x0000 #define CTRL_STATE_REG 0x0001 #define POS_STATE_REG 0x0013 -#define OVERTIME 30 +#define OVERTIME 1000 #define TAG "PreportionalValveCtrl" void PreportionalValveCtrl::initialize(UART_HandleTypeDef* huart) { m_modbusBlockHost.initialize(huart); } int32_t PreportionalValveCtrl::writeReg06(uint8_t slaveAddr, uint16_t regAddr, uint16_t regVal) { // 重发三次 - for (size_t i = 0; i < 3; i++) { + for (size_t i = 0; i < 5; i++) { int32_t err = m_modbusBlockHost.writeReg06(slaveAddr, regAddr, regVal, OVERTIME); if (err == 0) return 0; } @@ -22,7 +22,7 @@ int32_t PreportionalValveCtrl::writeReg06(uint8_t slaveAddr, uint16_t regAddr, u } int32_t PreportionalValveCtrl::readReg03(uint8_t slaveAddr, uint16_t regAddr, uint16_t* regVal) { // 重发三次 - for (size_t i = 0; i < 3; i++) { + for (size_t i = 0; i < 5; i++) { int32_t err = m_modbusBlockHost.readReg03(slaveAddr, regAddr, regVal, OVERTIME); if (err == 0) return 0; } diff --git a/ucomponents/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.cpp b/ucomponents/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.cpp index 735fcdb..f44cf13 100644 --- a/ucomponents/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.cpp +++ b/ucomponents/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.cpp @@ -1,6 +1,5 @@ #include "pxx_pressure_sensor_bus.hpp" - using namespace iflytop; #define TAG "PxxSensor" @@ -24,7 +23,7 @@ using namespace iflytop; * 指令间隔至少30ms */ -#define OVERTIME_MS 50 +#define OVERTIME_MS 100 static const char* protocolType2Str(PXXPressureSensorBus::protocol_type_t type) { switch (type) { @@ -167,6 +166,13 @@ void PXXPressureSensorBus::probeSensor() { ZLOGI(TAG, "end"); initedEnd = true; } +bool PXXPressureSensorBus::modbusReadReg03(uint8_t slaveAddr, uint16_t regAddr, uint16_t* regVal) { // + for (size_t i = 0; i < 5; i++) { + bool suc = m_modbusBlockHost->readReg03(slaveAddr, regAddr, regVal, OVERTIME_MS); + if (suc) return true; + } + return false; +} void PXXPressureSensorBus::threadFuncStart() { /** @@ -187,7 +193,7 @@ void PXXPressureSensorBus::threadFuncStart() { if (sensors[i].type == kp100_protocol) { int16_t val = 0; - suc = m_modbusBlockHost->readReg03(i, 0x0004, (uint16_t*)&val, OVERTIME_MS); + suc = modbusReadReg03(i, 0x0004, (uint16_t*)&val); { zlock_guard l(m_lock); if (suc) sensors[i].val = val; @@ -195,7 +201,7 @@ void PXXPressureSensorBus::threadFuncStart() { } } else if (sensors[i].type == kdp600_protocol) { int16_t val = 0; - suc = m_modbusBlockHost->readReg03(i, 0x0000, (uint16_t*)&val, OVERTIME_MS); + suc = modbusReadReg03(i, 0x0000, (uint16_t*)&val); { zlock_guard l(m_lock); diff --git a/ucomponents/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.hpp b/ucomponents/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.hpp index ad2c1d7..7cead01 100644 --- a/ucomponents/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.hpp +++ b/ucomponents/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.hpp @@ -55,7 +55,7 @@ class PXXPressureSensorBus { /*********************************************************************************************************************** * FUNC * ***********************************************************************************************************************/ - void init(UART_HandleTypeDef *huart); + void init(UART_HandleTypeDef* huart); bool readData(int32_t id, int16_t* data); private: @@ -68,6 +68,8 @@ class PXXPressureSensorBus { bool tryProbeProtocolP100(int id, sensor_t* sensor); bool tryProbeProtocolDP600(int id, sensor_t* sensor); void probeSensor(); + + bool modbusReadReg03(uint8_t slaveAddr, uint16_t regAddr, uint16_t* regVal); }; } // namespace iflytop \ No newline at end of file diff --git a/usrc/app_main.cpp b/usrc/app_main.cpp index 6ad293e..0fc1a6c 100644 --- a/usrc/app_main.cpp +++ b/usrc/app_main.cpp @@ -139,6 +139,7 @@ void umain() { SysMgr::ins()->initedFinished(); SysMgr::ins()->dumpSysInfo(); ZLOGI(TAG, "="); + zcanbus_send_report(kreport_device_reset, NULL, 0, 100); MX_IWDG_Init(); while (true) { osDelay(30); diff --git a/usrc/module/h2o2_sensor.cpp b/usrc/module/h2o2_sensor.cpp index 7357402..bd7feca 100644 --- a/usrc/module/h2o2_sensor.cpp +++ b/usrc/module/h2o2_sensor.cpp @@ -79,9 +79,9 @@ int32_t H2O2Sensor::h2o2_sensor_data(report_h2o2_data_t* readdata) { } readdata->h2o2 = h2o2adcToPPM(h2o2adcData); readdata->h2o2adc = h2o2adcData; - readdata->humid = sensordata.rh; + readdata->rh = sensordata.rh; readdata->temp = sensordata.temp; - readdata->saturation = 0; + readdata->rs = 0; ZLOGI(TAG, "ppm:%d(adc:%d), rh:%d, temp:%d, df_ptemp:%d, ah:%d, mr:%d, wbt:%d, eh:%d", // readdata->h2o2, // h2o2adcData, // @@ -106,4 +106,4 @@ void H2O2Sensor::onH2O2CaptureThread() { h2o2_sensor_data(&data); if (gEnableReportFlag) zcanbus_send_report(kreport_h2o2_sensor_data, (uint8_t*)&data, sizeof(data), 30); } -} \ No newline at end of file +} diff --git a/usrc/project_configs.h b/usrc/project_configs.h index e260e1f..c547d2d 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -15,7 +15,7 @@ * @brief 基础配置 * */ -#define SOFTWARE_VERSION 102 // 软件版本 +#define SOFTWARE_VERSION 103 // 软件版本 #define HARDWARE_VERSION 1 // 硬件版本 #define PROJECT "transmit_disinfection_micro_re" // 工程名称 #define SN_HEADER "SN" // SN号前缀