mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
TPA optimisations (#12721)
* TPA optimisations * improvement, thanks @ledvinap * update following review comments, thanks karatebrot and ledvinap * include rx.h in pid_init.c to get PWM_RANGE_MIN * review suggestion
This commit is contained in:
parent
c6b3a1e129
commit
10067ad6ad
4 changed files with 11 additions and 15 deletions
|
@ -40,6 +40,8 @@
|
|||
#include "flight/pid.h"
|
||||
#include "flight/rpm_filter.h"
|
||||
|
||||
#include "rx/rx.h"
|
||||
|
||||
#include "sensors/gyro.h"
|
||||
#include "sensors/sensors.h"
|
||||
|
||||
|
@ -423,6 +425,9 @@ void pidInitConfig(const pidProfile_t *pidProfile)
|
|||
#endif
|
||||
|
||||
pidRuntime.levelRaceMode = pidProfile->level_race_mode;
|
||||
pidRuntime.tpaBreakpoint = constrainf((pidProfile->tpa_breakpoint - PWM_RANGE_MIN) / 1000.0f, 0.0f, 0.99f);
|
||||
// default of 1350 returns 0.35. range limited to 0 to 0.99
|
||||
pidRuntime.tpaMultiplier = (pidProfile->tpa_rate / 100.0f) / (1.0f - pidRuntime.tpaBreakpoint);
|
||||
}
|
||||
|
||||
void pidCopyProfile(uint8_t dstPidProfileIndex, uint8_t srcPidProfileIndex)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue