Compare commits

...

2 Commits

Author SHA1 Message Date
bb39c4b6e0 Fix bug in settings parser 2020-11-02 18:20:57 +01:00
7b1ae3bdc6 Improve code in calibration module 2020-11-02 18:20:17 +01:00
2 changed files with 29 additions and 27 deletions

View File

@ -103,7 +103,8 @@ static float calculate_standard_deviation(float *values, uint32_t count, float m
float res; float res;
switch (remainder) { switch (remainder) {
case 0: do { sum += (*values - mean) * (*values - mean); case 0: do {
sum += (*values - mean) * (*values - mean);
values++; values++;
/* FALLTHRU */ /* FALLTHRU */
case 7: sum += (*values - mean) * (*values - mean); 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; 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 * The constraint 't' tells GCC to use a floating point register
*/ */
__asm__ __volatile__("vsqrt.f32 %0, %1" : "=t"(res) : "t"(sum)); __asm__ __volatile__("vsqrt.f32 %0, %1" : "=t"(res) : "t"(sum));

View File

@ -151,7 +151,8 @@ int sd_card_settings_try_load_calibration(float *sens_deviation, float *offset)
} while (res != CONFIG_PARSER_END_REACHED && } while (res != CONFIG_PARSER_END_REACHED &&
res != CONFIG_PARSER_GENERIC_ERR && res != CONFIG_PARSER_GENERIC_ERR &&
res != CONFIG_PARSER_IOERR); res != CONFIG_PARSER_IOERR &&
res != CONFIG_PARSER_PARAM_ERR);
config_parser_close_file(p); config_parser_close_file(p);