1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00

Configurable gyro Denominator when gyro_lpf set to OFF

This commit is contained in:
borisbstyle 2016-02-06 13:09:40 +01:00
parent 9f15da0641
commit cdb671b0d6
9 changed files with 46 additions and 51 deletions

View file

@ -41,27 +41,14 @@ bool gyroSyncCheckUpdate(void) {
return getMpuDataStatus(&gyro);
}
void gyroUpdateSampleRate(uint8_t lpf) {
int gyroSamplePeriod, gyroSyncDenominator;
void gyroUpdateSampleRate(uint8_t lpf, uint8_t gyroSyncDenominator) {
int gyroSamplePeriod;
if (!lpf) {
gyroSamplePeriod = 125;
#ifdef STM32F303xC
#ifdef COLIBRI_RACE // Leave out LUX target for now. Need to test 2.6Khz
gyroSyncDenominator = 3; // Sample every 3d gyro measurement 2,6khz
#else
gyroSyncDenominator = 4; // Sample every 4th gyro measurement 2khz
#endif
#else
if (!sensors(SENSOR_ACC) && !sensors(SENSOR_BARO) && !sensors(SENSOR_MAG)) {
gyroSyncDenominator = 4; // Sample every 4th gyro measurement 2khz
} else {
gyroSyncDenominator = 8; // Sample every 8th gyro measurement 1khz
}
#endif
} else {
gyroSamplePeriod = 1000;
gyroSyncDenominator = 1; // Full Sampling 1khz
gyroSyncDenominator = 1; // Always full Sampling 1khz
}
// calculate gyro divider and targetLooptime (expected cycleTime)