1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-18 05:45:31 +03:00

Merge pull request #9444 from etracer65/gyro_native_sample_rate

Gyro native rate sampling, filtering, and scheduler restructuring
This commit is contained in:
Michael Keller 2020-02-05 23:21:56 +13:00 committed by GitHub
commit 97704dda58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 718 additions and 421 deletions

View file

@ -724,13 +724,19 @@ void init(void)
systemState |= SYSTEM_STATE_SENSORS_READY;
// gyro.targetLooptime set in sensorsAutodetect(),
// so we are ready to call validateAndFixGyroConfig(), pidInit(), and setAccelerationFilter()
// Set the targetLooptime based on the detected gyro sampleRateHz and pid_process_denom
gyroSetTargetLooptime(pidConfig()->pid_process_denom);
// Validate and correct the gyro config or PID loop time if needed
validateAndFixGyroConfig();
// Now reset the targetLooptime as it's possible for the validation to change the pid_process_denom
gyroSetTargetLooptime(pidConfig()->pid_process_denom);
// Finally initialize the gyro filtering
gyroInitFilters();
pidInit(currentPidProfile);
#ifdef USE_ACC
accInitFilters();
#endif
#ifdef USE_PID_AUDIO
pidAudioInit();