diff --git a/App/Src/anemometer_dev.c b/App/Src/anemometer_dev.c index d0cd05d..863cee0 100644 --- a/App/Src/anemometer_dev.c +++ b/App/Src/anemometer_dev.c @@ -121,9 +121,9 @@ float32_t cal_tof(q15_t* x,uint32_t len) /*****************滤波器**********/ - arm_mean_q15(x,50,&dc_offset); - // 信号减去直流分量 - arm_offset_q15(x,-dc_offset,x,len); +// arm_mean_q15(x,50,&dc_offset); +// // 信号减去直流分量 +// arm_offset_q15(x,-dc_offset,x,len); // 转换成浮点数 // arm_q15_to_float(x,buf,len); @@ -423,8 +423,8 @@ void wind_task(void const * argument) // dtof = 0; }else{ // 计算成us - tofx = (tofx/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.0001f; - tofy = (tofy/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.0001f; + tofx = ((tofx-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.0001f; + tofy = ((tofy-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.0001f; // 通过各通道渡越时间求时间差 dtof = tofx-tofy; @@ -470,8 +470,8 @@ void wind_task(void const * argument) }else{ // 计算成us - tofx = tofx/ADC_SAMP_RATE_MHz+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.000001f; - tofy = tofy/ADC_SAMP_RATE_MHz+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.000001f; + tofx = ((tofx-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.000001f; + tofy = ((tofy-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.000001f; // 通过各通道渡越时间求时间差 dtof = tofx-tofy; } @@ -509,7 +509,7 @@ void wind_task(void const * argument) av_speed = 0; av_angle = 0; } -/// term_printf("x:%.2f y:%.2f win_speed %.2f m/s angle %.2f \r\n",av_speedx,av_speedy,av_speed,av_angle); + term_printf("x:%.2f y:%.2f win_speed %.2f m/s angle %.2f \r\n",av_speedx,av_speedy,av_speed,av_angle); } ///term_printf("win_speed %.2f \r\n",weather_info.wind_velocity); diff --git a/Core/Src/main.c b/Core/Src/main.c index 662e14f..d2d439e 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -121,7 +121,7 @@ void Flash_EnableReadProtection(void) * @brief The application entry point. * @retval int */ -int main(void) + int main(void) { /* USER CODE BEGIN 1 */ diff --git a/Drivers/Filter/FIR.h b/Drivers/Filter/FIR.h index 86625ff..e80780f 100644 --- a/Drivers/Filter/FIR.h +++ b/Drivers/Filter/FIR.h @@ -9,6 +9,7 @@ #define numTaps 60 +#define FIR_PHASE_DELAY ((numTaps-2)/2) //const float B[numTaps] = { // 0.01000739448,-0.0008298238972,-0.002934818622,-0.005351484753,-0.006882067304, // -0.006692492869,-0.004794952925,-0.002162534744,-0.000337747857,-0.0006400240236,