From 980d3a242978580d1c49df2bcb955c284035de52 Mon Sep 17 00:00:00 2001 From: 95384 <664090429@qq.com> Date: Sat, 18 Jan 2025 10:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E9=9A=9C=E7=A2=8D=E7=89=A9=E9=81=AE?= =?UTF-8?q?=E6=8C=A1=E6=8E=A2=E5=A4=B4=E6=97=B6=EF=BC=8C=E6=BB=91=E5=8A=A8?= =?UTF-8?q?=E5=B9=B3=E5=9D=87=E6=95=B0=E7=BB=84=E7=B4=A2=E5=BC=95=E4=B8=8E?= =?UTF-8?q?=E8=AE=A1=E6=95=B0=E5=BD=92=E9=9B=B6=EF=BC=9B=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=94=99=E8=AF=AF=E6=AC=A1=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=A2=9E=E5=80=BC=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E6=BA=A2=E5=87=BA=EF=BC=9B=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8C=BA=E5=9F=9F=E4=B8=8E=E5=87=BA=E5=8E=82?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8C=BA=E5=9F=9F=E9=83=BD=E9=A2=84=E7=95=99?= =?UTF-8?q?20=E4=B8=AA=E5=AD=97=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Inc/inflash.h | 2 ++ App/Src/anemometer_dev.c | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/App/Inc/inflash.h b/App/Inc/inflash.h index 40f9d99..db3c976 100644 --- a/App/Inc/inflash.h +++ b/App/Inc/inflash.h @@ -39,6 +39,8 @@ typedef struct _usr_config_info{ u_int16_t temp5; /* 占位留待升级 */ u_int16_t temp6; /* 占位留待升级 */ u_int16_t temp7; /* 占位留待升级 */ + u_int16_t temp8; /* 占位留待升级 */ + u_int16_t temp9; /* 占位留待升级 */ u_int8_t flag_end; }usr_config_info; diff --git a/App/Src/anemometer_dev.c b/App/Src/anemometer_dev.c index cb63dd5..2a45d42 100644 --- a/App/Src/anemometer_dev.c +++ b/App/Src/anemometer_dev.c @@ -460,6 +460,7 @@ char str[100]; //} +SlidingWindow_10min win_10min = {0}; void wind_task(void const * argument) { //软件加密校验 @@ -527,7 +528,6 @@ void wind_task(void const * argument) // 接受信号很小 if(tofx<0||tofy<0) { - tof_error_log_NS ++; // 放弃本次采样,可以有效筛选雨滴等导致的异常大的风速数据 // 但是持续的遮挡会导致风速数据保持不变。 // 连续10次采样有问题判定为有遮挡,置错误标志位,将声速与风速分量置0 @@ -540,6 +540,7 @@ void wind_task(void const * argument) } else { + tof_error_log_NS ++; continue; } // 手动设置渡越时间差为0,会在探头受遮挡的时候输出0,持续遮挡的时候也输出0,但是计算出声速将变得很大 @@ -594,7 +595,6 @@ void wind_task(void const * argument) // 如果测量的信号幅值过小。 if(tofx<0||tofy<0) { - tof_error_log_WE ++; // 放弃本次采样,可以有效筛选雨滴等导致的异常大的风速数据 // 但是持续的遮挡会导致风速数据保持不变。 // 连续10次采样有问题判定为有遮挡,置错误标志位,将声速与风速分量置0 @@ -607,6 +607,7 @@ void wind_task(void const * argument) } else { + tof_error_log_WE ++; continue; } // 手动设置渡越时间差为0,会在探头受遮挡的时候输出0,持续遮挡的时候也输出0,但是计算出声速将变得很大 @@ -663,6 +664,9 @@ void wind_task(void const * argument) { av_speed = 0; av_angle = 0; + //滑动平均值索引归零 + win_10min.count = 0; + win_10min.index = 0; } // 360一圈 if(av_speedy<0) @@ -844,7 +848,6 @@ void update_mcs_param(float new_wind_speed, float new_wind_dirction) } } -SlidingWindow_10min win_10min = {0}; SlidingWindow_3s win_3s = {0}; //求和函数 float sum(float arr[], int n)