mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Scheduled motor refresh rate
This commit is contained in:
parent
10b629c736
commit
6e96adff0d
13 changed files with 36 additions and 55 deletions
|
@ -164,13 +164,8 @@ void setGyroSamplingSpeed(uint16_t looptime) {
|
|||
#endif
|
||||
masterConfig.gyro_sync_denom = constrain(looptime / gyroSampleRate, 1, maxDivider);
|
||||
|
||||
if (looptime < 1000) {
|
||||
masterConfig.force_motor_pwm_rate = 1;
|
||||
masterConfig.motor_pwm_rate = lrintf(1.0f / (gyroSampleRate * masterConfig.gyro_sync_denom * masterConfig.pid_process_denom * 0.000001f)) + 100;
|
||||
if (!(masterConfig.use_multiShot || masterConfig.use_oneshot42)) masterConfig.motor_pwm_rate = constrain(masterConfig.motor_pwm_rate, 1000, 3800);
|
||||
} else {
|
||||
masterConfig.force_motor_pwm_rate = 0;
|
||||
}
|
||||
masterConfig.motor_pwm_rate = lrintf(1.0f / (gyroSampleRate * masterConfig.gyro_sync_denom * masterConfig.pid_process_denom * 0.000001f));
|
||||
if (!(masterConfig.use_multiShot || masterConfig.use_oneshot42)) masterConfig.motor_pwm_rate = constrain(masterConfig.motor_pwm_rate, 1000, 3800);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue