Skip to content

Commit

Permalink
Renamed variables. Closes #425
Browse files Browse the repository at this point in the history
  • Loading branch information
krichardsson committed Aug 12, 2019
1 parent 821427e commit ea32e8c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
17 changes: 8 additions & 9 deletions src/hal/src/sensors_bmi088_bmp388.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -571,22 +573,19 @@ 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++;

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
Expand Down
18 changes: 9 additions & 9 deletions src/hal/src/sensors_bmi088_spi_bmp388.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -862,22 +865,19 @@ 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++;

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
Expand Down

0 comments on commit ea32e8c

Please sign in to comment.