1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 01:35:35 +03:00

ACC/GYRO: Cleanups. Thanks to @martinbudden for the idea and most of the code

This commit is contained in:
Konstantin Sharlaimov (DigitalEntity) 2016-05-09 10:50:47 +10:00
parent 1b1c446980
commit cf46cf6098
24 changed files with 78 additions and 91 deletions

View file

@ -745,8 +745,7 @@ void reconfigureAlignment(sensorAlignmentConfig_t *sensorAlignmentConfig)
}
bool sensorsAutodetect(sensorAlignmentConfig_t *sensorAlignmentConfig, uint8_t gyroLpf, uint8_t accHardwareToUse, uint8_t magHardwareToUse, uint8_t baroHardwareToUse,
int16_t magDeclinationFromConfig,
uint32_t looptime, uint8_t gyroSync, uint8_t gyroSyncDenominator) {
int16_t magDeclinationFromConfig) {
int16_t deg, min;
@ -770,9 +769,8 @@ bool sensorsAutodetect(sensorAlignmentConfig_t *sensorAlignmentConfig, uint8_t g
// Now time to init things, acc first
if (sensors(SENSOR_ACC))
acc.init();
// this is safe because either mpu6050 or mpu3050 or lg3d20 sets it, and in case of fail, we never get here.
gyroUpdateSampleRate(looptime, gyroLpf, gyroSync, gyroSyncDenominator); // Set gyro sampling rate divider before initialization
acc.init(&acc);
gyro.init(gyroLpf);
detectMag(magHardwareToUse);