将公式中的2cos45改为宏定义

This commit is contained in:
95384 2024-12-03 16:53:13 +08:00
parent 61d662a441
commit b713b75cf0
2 changed files with 5 additions and 2 deletions

View File

@ -53,6 +53,9 @@
// 富奥通结构 L = 118946
// #define DISTANCE 118946
// 公式中的二倍cos45
#define TWO_COS45 1.41421356237309f
// x方向
#define WIND_DIRECTION_X 0x00
// y方向

View File

@ -442,7 +442,7 @@ void wind_task(void const * argument)
weather_info.wind_c = (g_stConfigInfo.transducer_distace * 2.0f)/2.0f*(1.0f/tofx+1.0f/tofy);
// weather_info.wind_velocity_x = 0-DISTANCE*dtof/1.41422f/tofx/tofx;
// 修正公式
weather_info.wind_velocity_x = 0-(g_stConfigInfo.transducer_distace * 2.0f)*dtof/1.41422f/tofx/tofy;
weather_info.wind_velocity_x = 0-(g_stConfigInfo.transducer_distace * 2.0f)*dtof/TWO_COS45/tofx/tofy;
}
// 通道3 通道4 测试东西风速
@ -502,7 +502,7 @@ void wind_task(void const * argument)
weather_info.wind_c = (g_stConfigInfo.transducer_distace * 2.0f)/2.0f*(1.0f/tofx+1.0f/tofy);
// weather_info.wind_velocity_y = DISTANCE*dtof/1.41422f/tofx/tofx;
// 修正公式
weather_info.wind_velocity_y = (g_stConfigInfo.transducer_distace * 2.0f)*dtof/1.41422f/tofx/tofy;
weather_info.wind_velocity_y = (g_stConfigInfo.transducer_distace * 2.0f)*dtof/TWO_COS45/tofx/tofy;
}
weather_info.wind_velocity = sqrtf(weather_info.wind_velocity_x*weather_info.wind_velocity_x + weather_info.wind_velocity_y*weather_info.wind_velocity_y);