From ea32e8cb1a04ac0c21a9c7c40c5e4e6433c37bc0 Mon Sep 17 00:00:00 2001 From: Kristoffer Richardsson Date: Mon, 12 Aug 2019 16:28:28 +0200 Subject: [PATCH] Renamed variables. Closes #425 --- src/hal/src/sensors_bmi088_bmp388.c | 17 ++++++++--------- src/hal/src/sensors_bmi088_spi_bmp388.c | 18 +++++++++--------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/hal/src/sensors_bmi088_bmp388.c b/src/hal/src/sensors_bmi088_bmp388.c index 4db945d18c..0239233727 100644 --- a/src/hal/src/sensors_bmi088_bmp388.c +++ b/src/hal/src/sensors_bmi088_bmp388.c @@ -117,13 +117,15 @@ static uint64_t imuIntTimestamp; static Axis3i16 gyroRaw; static Axis3i16 accelRaw; static BiasObj gyroBiasRunning; -static Axis3f gyroBias; +static Axis3f gyroBias; #if defined(SENSORS_GYRO_BIAS_CALCULATE_STDDEV) && defined (GYRO_BIAS_LIGHT_WEIGHT) -static Axis3f gyroBiasStdDev; +static Axis3f gyroBiasStdDev; #endif -static bool gyroBiasFound = false; +static bool gyroBiasFound = false; static float accScaleSum = 0; static float accScale = 1; +static bool accScaleFound = false; +static uint32_t accScaleSumCount = 0; // Low Pass filtering #define GYRO_LPF_CUTOFF_FREQ 80 @@ -571,10 +573,7 @@ bool sensorsBmi088Bmp388Test(void) */ static bool processAccScale(int16_t ax, int16_t ay, int16_t az) { - static bool accBiasFound = false; - static uint32_t accScaleSumCount = 0; - - if (!accBiasFound) + if (!accScaleFound) { accScaleSum += sqrtf(powf(ax * SENSORS_BMI088_G_PER_LSB_CFG, 2) + powf(ay * SENSORS_BMI088_G_PER_LSB_CFG, 2) + powf(az * SENSORS_BMI088_G_PER_LSB_CFG, 2)); accScaleSumCount++; @@ -582,11 +581,11 @@ static bool processAccScale(int16_t ax, int16_t ay, int16_t az) if (accScaleSumCount == SENSORS_ACC_SCALE_SAMPLES) { accScale = accScaleSum / SENSORS_ACC_SCALE_SAMPLES; - accBiasFound = true; + accScaleFound = true; } } - return accBiasFound; + return accScaleFound; } #ifdef GYRO_BIAS_LIGHT_WEIGHT diff --git a/src/hal/src/sensors_bmi088_spi_bmp388.c b/src/hal/src/sensors_bmi088_spi_bmp388.c index eb4d0a3a3d..d4b33836e5 100644 --- a/src/hal/src/sensors_bmi088_spi_bmp388.c +++ b/src/hal/src/sensors_bmi088_spi_bmp388.c @@ -170,13 +170,16 @@ static uint64_t imuIntTimestamp; static Axis3i16 gyroRaw; static Axis3i16 accelRaw; static BiasObj gyroBiasRunning; -static Axis3f gyroBias; +static Axis3f gyroBias; #if defined(SENSORS_GYRO_BIAS_CALCULATE_STDDEV) && defined (GYRO_BIAS_LIGHT_WEIGHT) -static Axis3f gyroBiasStdDev; +static Axis3f gyroBiasStdDev; #endif -static bool gyroBiasFound = false; +static bool gyroBiasFound = false; static float accScaleSum = 0; static float accScale = 1; +static bool accScaleFound = false; +static uint32_t accScaleSumCount = 0; + // Low Pass filtering #define GYRO_LPF_CUTOFF_FREQ 80 @@ -862,10 +865,7 @@ bool sensorsBmi088SpiBmp388Test(void) */ static bool processAccScale(int16_t ax, int16_t ay, int16_t az) { - static bool accBiasFound = false; - static uint32_t accScaleSumCount = 0; - - if (!accBiasFound) + if (!accScaleFound) { accScaleSum += sqrtf(powf(ax * SENSORS_BMI088_G_PER_LSB_CFG, 2) + powf(ay * SENSORS_BMI088_G_PER_LSB_CFG, 2) + powf(az * SENSORS_BMI088_G_PER_LSB_CFG, 2)); accScaleSumCount++; @@ -873,11 +873,11 @@ static bool processAccScale(int16_t ax, int16_t ay, int16_t az) if (accScaleSumCount == SENSORS_ACC_SCALE_SAMPLES) { accScale = accScaleSum / SENSORS_ACC_SCALE_SAMPLES; - accBiasFound = true; + accScaleFound = true; } } - return accBiasFound; + return accScaleFound; } #ifdef GYRO_BIAS_LIGHT_WEIGHT