1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Move parameter from PID profile to rate profile

This commit is contained in:
Bruce Luckcuck 2018-11-09 08:05:40 -05:00
parent fc189e5850
commit 357d19aa05
5 changed files with 14 additions and 21 deletions

View file

@ -39,6 +39,7 @@
#include "drivers/sound_beeper.h"
#include "drivers/time.h"
#include "fc/controlrate_profile.h"
#include "fc/core.h"
#include "fc/rc.h"
@ -175,7 +176,6 @@ void resetPidProfile(pidProfile_t *pidProfile)
.launchControlAngleLimit = 0,
.launchControlGain = 40,
.launchControlAllowTriggerReset = true,
.tpaMode = TPA_MODE_PD,
);
#ifdef USE_DYN_LPF
pidProfile->dterm_lowpass_hz = 120;
@ -435,10 +435,6 @@ static FAST_RAM_ZERO_INIT uint8_t launchControlAngleLimit;
static FAST_RAM_ZERO_INIT float launchControlKi;
#endif
#ifdef USE_TPA_MODE
static FAST_RAM_ZERO_INIT uint8_t tpaMode;
#endif
void pidResetIterm(void)
{
for (int axis = 0; axis < 3; axis++) {
@ -581,10 +577,6 @@ void pidInitConfig(const pidProfile_t *pidProfile)
}
launchControlKi = ITERM_SCALE * pidProfile->launchControlGain;
#endif
#ifdef USE_TPA_MODE
tpaMode = pidProfile->tpaMode;
#endif
}
void pidInit(const pidProfile_t *pidProfile)
@ -1058,7 +1050,7 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, const rollAndPitchT
const float tpaFactor = getThrottlePIDAttenuation();
#ifdef USE_TPA_MODE
const float tpaFactorKp = (tpaMode == TPA_MODE_PD) ? tpaFactor : 1.0f;
const float tpaFactorKp = (currentControlRateProfile->tpaMode == TPA_MODE_PD) ? tpaFactor : 1.0f;
#else
const float tpaFactorKp = tpaFactor;
#endif