From 04a24265885f56c8e9e5123f25ad7d1368637a2b Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 18 May 2024 20:04:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=A9=E5=BA=A6=E8=AE=A1?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=95=B0=E5=80=BC=E9=94=99=E8=AF=AFBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .settings/language.settings.xml | 4 ++-- transmit_disinfection_protocol_v1 | 2 +- usrc/base/hardware.cpp | 7 ++++--- usrc/project_configs.h | 2 +- usrc/protocol_impl/protocol_impl_service.cpp | 6 ++++++ zsdk | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index fbe7e0a..a979a7e 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/transmit_disinfection_protocol_v1 b/transmit_disinfection_protocol_v1 index 67fd26a..6eb4a87 160000 --- a/transmit_disinfection_protocol_v1 +++ b/transmit_disinfection_protocol_v1 @@ -1 +1 @@ -Subproject commit 67fd26a1a81f0afe4e653f2c40151571f846028e +Subproject commit 6eb4a87eb4bdb1226db1d0e92f277b1c20d49b05 diff --git a/usrc/base/hardware.cpp b/usrc/base/hardware.cpp index 6bdc14b..417d072 100644 --- a/usrc/base/hardware.cpp +++ b/usrc/base/hardware.cpp @@ -171,8 +171,9 @@ int32_t Hardware::heater_read_temperature_data() { int32_t adcv = m_Heater_temperatureAdc.getCacheVal(); int32_t ma = (adcv / 4095.0 * 3.3 * 1000) / 150.0; // int32_t temp = (ma - 4) / (20 - 4) * (3000 - 0) + 0; - int32_t temp = (ma - 4) / (20 - 4) * (2500 - 0) + 0; - + int32_t temp = (ma - 4) * 1.0 / (20 - 4) * (3000 - 0) + 0; + temp = temp / 10.0; + if (temp < 0) temp = 0; // ZLOGI(TAG, "tadcv: %d ma:%d temp %d", adcv, ma, temp); return temp; // C*10 } @@ -233,7 +234,7 @@ int32_t Hardware::h2o2_sensor_data(report_h2o2_data_t* readdata) { // float ma = mv / 150.0; // float ppm = (ma - 4) / (20 - 4) * 2000; int32_t h2o2ma = (h2o2adcVal / 4095.0 * 3.3 * 1000) / 150.0; - int32_t h2o2ppm = (h2o2ma - 4) / (20 - 4) * 2000; + int32_t h2o2ppm = (h2o2ma - 4) * 1.0 / (20 - 4) * 2000; readdata->sensor_error = ecode != 0; readdata->h2o2 = h2o2ppm; diff --git a/usrc/project_configs.h b/usrc/project_configs.h index 2eecdc2..b07499e 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -13,7 +13,7 @@ #define HARDWARE_VERSION 1 #define PROJECT "dbdb_power_control_mini_board_protocol_v1" #define SN_HEADER "SN" -#define DEVICE_ID (3) +#define DEVICE_ID (kFixBoardId_PowerControl) #define DEBUG_UART huart1 // 调试串口 #define DEBUG_LIGHT_GPIO PE8 // 调试指示灯 diff --git a/usrc/protocol_impl/protocol_impl_service.cpp b/usrc/protocol_impl/protocol_impl_service.cpp index df14b1e..440eefe 100644 --- a/usrc/protocol_impl/protocol_impl_service.cpp +++ b/usrc/protocol_impl/protocol_impl_service.cpp @@ -42,23 +42,27 @@ static void zcanbus_on_rx(CanPacketRxBuffer* rxbuf, uint8_t* packet, size_t l if (cmdheader->cmdid == kcmd_dbdb_heater_ctrl) { int32_t val = *(int32_t*)(cmdheader->data); + ZLOGI(TAG, "kcmd_dbdb_heater_ctrl %d", val); Hardware::ins().heater_ctrl(val); ZCanReceiver::ins()->sendAck(cmdheader, NULL, 0); } else if (cmdheader->cmdid == kcmd_dbdb_heater_ctrl_safe_valve) { int32_t val = *(int32_t*)(cmdheader->data); + ZLOGI(TAG, "kcmd_dbdb_heater_ctrl_safe_valve %d", val); Hardware::ins().heater_ctrl_safe_valve(val); ZCanReceiver::ins()->sendAck(cmdheader, NULL, 0); } else if (cmdheader->cmdid == kcmd_dbdb_heater_read_electric_current) { int32_t current = Hardware::ins().heater_read_electric_current(); + ZLOGI(TAG, "kcmd_dbdb_heater_read_electric_current %d", current); ZCanReceiver::ins()->sendAck(cmdheader, (uint8_t*)¤t, sizeof(current)); } else if (cmdheader->cmdid == kcmd_dbdb_heater_read_temperature_data) { int32_t temp = Hardware::ins().heater_read_temperature_data(); + ZLOGI(TAG, "kcmd_dbdb_heater_read_temperature_data %d", temp); ZCanReceiver::ins()->sendAck(cmdheader, (uint8_t*)&temp, sizeof(temp)); } @@ -66,12 +70,14 @@ static void zcanbus_on_rx(CanPacketRxBuffer* rxbuf, uint8_t* packet, size_t l // MINI鼓风机 if (cmdheader->cmdid == kcmd_dbdb_mini_pwm_blower_ctrl) { int32_t val = *(int32_t*)(cmdheader->data); + ZLOGI(TAG, "kcmd_dbdb_mini_pwm_blower_ctrl %d", val); Hardware::ins().mini_pwm_blower_ctrl(val); ZCanReceiver::ins()->sendAck(cmdheader, NULL, 0); } else if (cmdheader->cmdid == kcmd_dbdb_mini_pwm_blower_read_fbcount) { int32_t fbcount = Hardware::ins().mini_pwm_blower_read_fbcount(); + ZLOGI(TAG, "kcmd_dbdb_mini_pwm_blower_read_fbcount %d", fbcount); ZCanReceiver::ins()->sendAck(cmdheader, (uint8_t*)&fbcount, sizeof(fbcount)); } #endif diff --git a/zsdk b/zsdk index 28781e5..cfc9142 160000 --- a/zsdk +++ b/zsdk @@ -1 +1 @@ -Subproject commit 28781e5b4d0910f77bade8f49d8c6925b74b2ecf +Subproject commit cfc9142c9578dbea728bfb93a07d8a85b5cc89eb