mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
Merge pull request #4616 from martinbudden/bfa_pid_deltat_us
Scaled PID deltaT calculations from us to seconds
This commit is contained in:
commit
e7d2e84348
1 changed files with 4 additions and 4 deletions
|
@ -411,11 +411,11 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
|
|||
const float tpaFactor = getThrottlePIDAttenuation();
|
||||
const float motorMixRange = getMotorMixRange();
|
||||
static timeUs_t crashDetectedAtUs;
|
||||
static timeUs_t previousTime;
|
||||
static timeUs_t previousTimeUs;
|
||||
|
||||
// calculate actual deltaT
|
||||
const float deltaT = currentTimeUs - previousTime;
|
||||
previousTime = currentTimeUs;
|
||||
// calculate actual deltaT in seconds
|
||||
const float deltaT = (currentTimeUs - previousTimeUs) * 0.000001f;
|
||||
previousTimeUs = currentTimeUs;
|
||||
|
||||
// Dynamic ki component to gradually scale back integration when above windup point
|
||||
const float dynKi = MIN((1.0f - motorMixRange) * ITermWindupPointInv, 1.0f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue