1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

Gyro native rate sampling, filtering, and scheduler restructuring

This commit is contained in:
Bruce Luckcuck 2020-01-06 07:52:35 -05:00
parent b11565efbe
commit f584780944
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();