From dfbae9be39fbc13a8df1bb21ce84f13dea602d53 Mon Sep 17 00:00:00 2001 From: Razvalyaev Date: Thu, 25 Dec 2025 10:33:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20newline=20=D0=B8=20=D0=BF=D0=BE=20=D0=BC=D0=B5?= =?UTF-8?q?=D0=BB=D0=BE=D1=87=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MyLibs/Inc/bench_time.h | 2 +- MyLibs/Inc/bit_access.h | 2 +- MyLibs/Inc/filters.h | 8 +++++--- MyLibs/Inc/mylibs_defs.h | 8 +++++++- MyLibs/Inc/trace.h | 2 +- MyLibs/Inc/trackers.h | 2 +- MyLibs/Src/filters.c | 18 +++++++++--------- 7 files changed, 25 insertions(+), 17 deletions(-) diff --git a/MyLibs/Inc/bench_time.h b/MyLibs/Inc/bench_time.h index bb8e68f..178f1f1 100644 --- a/MyLibs/Inc/bench_time.h +++ b/MyLibs/Inc/bench_time.h @@ -309,4 +309,4 @@ static inline void BenchTime_ResetStats(uint8_t channel) { /** BENCH_TIME * @} - */ \ No newline at end of file + */ diff --git a/MyLibs/Inc/bit_access.h b/MyLibs/Inc/bit_access.h index d8fe334..f390c77 100644 --- a/MyLibs/Inc/bit_access.h +++ b/MyLibs/Inc/bit_access.h @@ -165,4 +165,4 @@ typedef union /** BIT_ACCESS_DEFINES * @} - */ \ No newline at end of file + */ diff --git a/MyLibs/Inc/filters.h b/MyLibs/Inc/filters.h index a53980d..6c5957f 100644 --- a/MyLibs/Inc/filters.h +++ b/MyLibs/Inc/filters.h @@ -85,8 +85,10 @@ int32_t process_value_int(int32_t raw_adc_quant) { #ifdef FILTERS_ENABLE #ifdef ARM_MATH_CM4 -#include "arm_math.h" -#define DSP_FITLERS 1 + #include "arm_math.h" + #define DSP_FITLERS 1 +#else + #include "math.h" #endif @@ -521,4 +523,4 @@ float FilterBiquad_Process(FilterBiquad_t* filter, float input); #endif // FILTERS_ENABLE -#endif // __FILTERS_H_ \ No newline at end of file +#endif // __FILTERS_H_ diff --git a/MyLibs/Inc/mylibs_defs.h b/MyLibs/Inc/mylibs_defs.h index a4eb7c6..c4f744d 100644 --- a/MyLibs/Inc/mylibs_defs.h +++ b/MyLibs/Inc/mylibs_defs.h @@ -201,6 +201,12 @@ extern void Error_Handler(void); */ #define ABS(x) ( ((x) > 0)? (x) : -(x)) +/** + * @brief Константа Пи + */ +#ifndef PI +#define PI 3.14159265f +#endif /** UTILS_DEFINES * @} */ @@ -224,4 +230,4 @@ do{ \ /** @endcond */ -#endif //__MYLIBS_TOOLS_H_ \ No newline at end of file +#endif //__MYLIBS_TOOLS_H_ diff --git a/MyLibs/Inc/trace.h b/MyLibs/Inc/trace.h index 976b8d1..fde2312 100644 --- a/MyLibs/Inc/trace.h +++ b/MyLibs/Inc/trace.h @@ -587,4 +587,4 @@ __STATIC_FORCEINLINE void HF_HandleFault(void) -#endif //__TRACE_H_ \ No newline at end of file +#endif //__TRACE_H_ diff --git a/MyLibs/Inc/trackers.h b/MyLibs/Inc/trackers.h index 458dd00..089ecdb 100644 --- a/MyLibs/Inc/trackers.h +++ b/MyLibs/Inc/trackers.h @@ -159,4 +159,4 @@ #endif //TRACKERS_ENABLE -#endif //__TRACKERS_H_ \ No newline at end of file +#endif //__TRACKERS_H_ diff --git a/MyLibs/Src/filters.c b/MyLibs/Src/filters.c index cb8eb58..3a0edf9 100644 --- a/MyLibs/Src/filters.c +++ b/MyLibs/Src/filters.c @@ -354,14 +354,14 @@ float FilterRMS_Process(FilterRMS_t* filter, float input) { // ==================== INT32_T ВЕРСИИ ==================== -// Вспомогательная функция для сравнения int32_t -static int Filter_int32_compare(const void *a, const void *b) { - int32_t ia = *(const int32_t*)a; - int32_t ib = *(const int32_t*)b; - if (ia < ib) return -1; - if (ia > ib) return 1; - return 0; -} +//// Вспомогательная функция для сравнения int32_t +//static int Filter_int32_compare(const void *a, const void *b) { +// int32_t ia = *(const int32_t*)a; +// int32_t ib = *(const int32_t*)b; +// if (ia < ib) return -1; +// if (ia > ib) return 1; +// return 0; +//} /** * @brief Инициализация медианного фильтра (int32_t) @@ -748,7 +748,7 @@ int32_t FilterRMSInt_Process(FilterRMSInt_t* filter, int32_t input) { int64_t mean_square = filter->sum_squares / filter->count; // Защита от отрицательных значений if (mean_square < 0) mean_square = 0; - filter->last_rms = (int32_t)sqrt((double)mean_square); + filter->last_rms = (int32_t)_sqrtf((float)mean_square); } return filter->last_rms;