From 68293fe710ce8b448c2e2dedf2359d1f6b912b6d Mon Sep 17 00:00:00 2001 From: 95384 <664090429@qq.com> Date: Sat, 2 Nov 2024 10:15:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=A9=E5=BA=A6=E4=BC=A0?= =?UTF-8?q?=E6=84=9F=E5=99=A8=E5=A4=A7=E4=BA=8E80=E5=BA=A6=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E6=96=AD=E8=A8=80=E5=8D=A1=E6=AD=BB=E6=95=B4=E4=B8=AA?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drivers/Sht3x/sht30.c | 29 +++++- EWARM/micro_climate.ewd | 2 +- EWARM/settings/Project.wsdt | 31 +++--- EWARM/settings/micro_climate.dbgdt | 22 ++--- EWARM/settings/micro_climate.dnx | 96 +++++++++---------- .../micro_climate.micro_climate.driver.xcl | 26 +++-- .../micro_climate.micro_climate.general.xcl | 2 +- 7 files changed, 123 insertions(+), 85 deletions(-) diff --git a/Drivers/Sht3x/sht30.c b/Drivers/Sht3x/sht30.c index 48d3345..f1e1a18 100644 --- a/Drivers/Sht3x/sht30.c +++ b/Drivers/Sht3x/sht30.c @@ -142,8 +142,33 @@ BOOL get_temp_humi_data(float* temdata, float* humidata) tmp_temdata = filter_middle(collect_temdata,COLLECT_DATA_NUM, FILTER_DATA_TYPE_FLOAT); tmp_humidata = filter_middle(collect_humidata,COLLECT_DATA_NUM, FILTER_DATA_TYPE_FLOAT); - AssertError((tmp_temdata.fValue >= -40) && (tmp_temdata.fValue <= 85), return FALSE, "sht30温度值校验失败"); - AssertError((tmp_humidata.fValue >= 0) && (tmp_humidata.fValue <= 100), return FALSE, "sht30湿度值校验失败"); +// 断言有问题 +// AssertError((tmp_temdata.fValue >= -40) && (tmp_temdata.fValue <= 85), return FALSE, "sht30温度值校验失败"); +// AssertError((tmp_humidata.fValue >= 0) && (tmp_humidata.fValue <= 100), return FALSE, "sht30湿度值校验失败"); + if(tmp_temdata.fValue < -40) + { + tmp_temdata.fValue = -40; +// term_printf("sht30温度值校验失败"); + return FALSE; + } + if(tmp_temdata.fValue > 125) + { + tmp_temdata.fValue = 125; +// term_printf("sht30温度值校验失败"); + return FALSE; + } + if(tmp_humidata.fValue < 0) + { + tmp_humidata.fValue = 0; +// term_printf("sht30湿度值校验失败"); + return FALSE; + } + if(tmp_humidata.fValue > 100) + { + tmp_humidata.fValue = 100; +// term_printf("sht3湿度值校验失败"); + return FALSE; + } *temdata = tmp_temdata.fValue; *humidata = tmp_humidata.fValue; diff --git a/EWARM/micro_climate.ewd b/EWARM/micro_climate.ewd index 5b5b0b7..c04c241 100644 --- a/EWARM/micro_climate.ewd +++ b/EWARM/micro_climate.ewd @@ -84,7 +84,7 @@