Merge pull request #2023 from martinbudden/bf_gyro_fixes
Minor fixes to gyro ISR code, as per review
This commit is contained in:
commit
9fe1ebd1aa
|
@ -1054,6 +1054,10 @@ void validateAndFixGyroConfig(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !defined(GYRO_USES_SPI) || !defined(USE_MPU_DATA_READY_SIGNAL)
|
||||
gyroConfig()->gyro_isr_update = false;
|
||||
#endif
|
||||
|
||||
if (gyroConfig()->gyro_lpf != GYRO_LPF_256HZ && gyroConfig()->gyro_lpf != GYRO_LPF_NONE) {
|
||||
pidConfig()->pid_process_denom = 1; // When gyro set to 1khz always set pid speed 1:1 to sampling speed
|
||||
gyroConfig()->gyro_sync_denom = 1;
|
||||
|
|
|
@ -66,7 +66,11 @@
|
|||
|
||||
gyro_t gyro; // gyro access functions
|
||||
|
||||
#if defined(GYRO_USES_SPI) && defined(USE_MPU_DATA_READY_SIGNAL)
|
||||
static volatile int32_t gyroADC[XYZ_AXIS_COUNT];
|
||||
#else
|
||||
static int32_t gyroADC[XYZ_AXIS_COUNT];
|
||||
#endif
|
||||
|
||||
static int32_t gyroZero[XYZ_AXIS_COUNT] = { 0, 0, 0 };
|
||||
static const gyroConfig_t *gyroConfig;
|
||||
|
@ -391,7 +395,8 @@ static bool gyroUpdateISR(gyroDev_t* gyroDev)
|
|||
float gyroADCf = (float)gyroADC[axis] * gyroDev->scale;
|
||||
gyroADCf = softLpfFilterApplyFn(softLpfFilter[axis], gyroADCf);
|
||||
gyroADCf = notchFilter1ApplyFn(notchFilter1[axis], gyroADCf);
|
||||
gyro.gyroADCf[axis] = notchFilter2ApplyFn(notchFilter2[axis], gyroADCf);
|
||||
gyroADCf = notchFilter2ApplyFn(notchFilter2[axis], gyroADCf);
|
||||
gyro.gyroADCf[axis] = gyroADCf;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue