mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
TPA delay in ms (for wings) (#13662)
* TPA delay in ms (for wings) * Added comments for time constant * ledvinap's suggestions * tpaFactor local variable (based on ledvinap's suggestions) * pt1FilterGainFromDelay with inlined calculations for cutoff (based on ledvinap's suggestions) * Karatebrot extra review * Pump PG for pidConfig_t * Fixes based on review * Moved tpaLpf to the end of pidRuntime_t
This commit is contained in:
parent
660018b1de
commit
00ca8232d5
10 changed files with 72 additions and 8 deletions
|
@ -88,7 +88,7 @@ FAST_DATA_ZERO_INIT float throttleBoost;
|
|||
pt1Filter_t throttleLpf;
|
||||
#endif
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(pidConfig_t, pidConfig, PG_PID_CONFIG, 3);
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(pidConfig_t, pidConfig, PG_PID_CONFIG, 4);
|
||||
|
||||
#ifndef DEFAULT_PID_PROCESS_DENOM
|
||||
#define DEFAULT_PID_PROCESS_DENOM 1
|
||||
|
@ -230,6 +230,7 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
|||
.ez_landing_threshold = 25,
|
||||
.ez_landing_limit = 15,
|
||||
.ez_landing_speed = 50,
|
||||
.tpa_delay_ms = 0,
|
||||
);
|
||||
|
||||
#ifndef USE_D_MIN
|
||||
|
@ -292,7 +293,18 @@ void pidUpdateTpaFactor(float throttle)
|
|||
} else {
|
||||
tpaRate = pidRuntime.tpaLowMultiplier * (pidRuntime.tpaLowBreakpoint - throttle);
|
||||
}
|
||||
pidRuntime.tpaFactor = 1.0f - tpaRate;
|
||||
|
||||
float tpaFactor = 1.0f - tpaRate;
|
||||
DEBUG_SET(DEBUG_TPA, 0, lrintf(tpaFactor * 1000));
|
||||
|
||||
#ifdef USE_WING
|
||||
if (isFixedWing()) {
|
||||
tpaFactor = pt2FilterApply(&pidRuntime.tpaLpf, tpaFactor);
|
||||
}
|
||||
#endif
|
||||
|
||||
DEBUG_SET(DEBUG_TPA, 1, lrintf(tpaFactor * 1000));
|
||||
pidRuntime.tpaFactor = tpaFactor;
|
||||
}
|
||||
|
||||
void pidUpdateAntiGravityThrottleFilter(float throttle)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue