Improve code in calibration module

This commit is contained in:
Mario Hüttel 2020-11-02 18:20:17 +01:00
parent e37001e3c4
commit 7b1ae3bdc6
1 changed files with 27 additions and 26 deletions

View File

@ -103,7 +103,8 @@ static float calculate_standard_deviation(float *values, uint32_t count, float m
float res;
switch (remainder) {
case 0: do { sum += (*values - mean) * (*values - mean);
case 0: do {
sum += (*values - mean) * (*values - mean);
values++;
/* FALLTHRU */
case 7: sum += (*values - mean) * (*values - mean);
@ -131,7 +132,7 @@ static float calculate_standard_deviation(float *values, uint32_t count, float m
}
sum /= (float)count;
/* Compute the square roor using the FPU.
/* Compute the square root using the FPU.
* The constraint 't' tells GCC to use a floating point register
*/
__asm__ __volatile__("vsqrt.f32 %0, %1" : "=t"(res) : "t"(sum));