mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
make itermRelax into enum
This commit is contained in:
parent
5bdc2ead61
commit
dc929baf75
2 changed files with 13 additions and 4 deletions
|
@ -140,7 +140,7 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
|||
.throttle_boost_cutoff = 15,
|
||||
.iterm_rotation = false,
|
||||
.smart_feedforward = false,
|
||||
.iterm_relax = false,
|
||||
.iterm_relax = ITERM_RELAX_OFF,
|
||||
.iterm_relax_cutoff_low = 3,
|
||||
.iterm_relax_cutoff_high = 15,
|
||||
);
|
||||
|
@ -202,7 +202,7 @@ static FAST_RAM_ZERO_INIT pt1Filter_t dtermLowpass2[2];
|
|||
static FAST_RAM_ZERO_INIT filterApplyFnPtr ptermYawLowpassApplyFn;
|
||||
static FAST_RAM_ZERO_INIT pt1Filter_t ptermYawLowpass;
|
||||
static FAST_RAM_ZERO_INIT pt1Filter_t windupLpf[3][2];
|
||||
static FAST_RAM_ZERO_INIT uint8_t itermRelax;
|
||||
static FAST_RAM_ZERO_INIT itermRelax_e itermRelax;
|
||||
static FAST_RAM_ZERO_INIT uint8_t itermRelaxCutoffLow;
|
||||
static FAST_RAM_ZERO_INIT uint8_t itermRelaxCutoffHigh;
|
||||
|
||||
|
@ -628,7 +628,7 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, const rollAndPitchT
|
|||
|
||||
// -----calculate I component
|
||||
float itermErrorRate;
|
||||
if (itermRelax && (axis < FD_YAW || itermRelax == 2 )) {
|
||||
if (itermRelax && (axis < FD_YAW || itermRelax == ITERM_RELAX_RPY )) {
|
||||
const float gyroTargetLow = pt1FilterApply(&windupLpf[axis][0], currentPidSetpoint);
|
||||
const float gyroTargetHigh = pt1FilterApply(&windupLpf[axis][1], currentPidSetpoint);
|
||||
if (axis < FD_YAW) {
|
||||
|
|
|
@ -76,6 +76,15 @@ typedef struct pid8_s {
|
|||
uint8_t D;
|
||||
} pid8_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ITERM_RELAX_OFF,
|
||||
ITERM_RELAX_RP,
|
||||
ITERM_RELAX_RPY
|
||||
} itermRelax_e;
|
||||
|
||||
|
||||
|
||||
typedef struct pidProfile_s {
|
||||
pid8_t pid[PID_ITEM_COUNT];
|
||||
|
||||
|
@ -118,7 +127,7 @@ typedef struct pidProfile_s {
|
|||
uint8_t smart_feedforward; // takes only the larger of P and the D weight feed forward term if they have the same sign.
|
||||
uint8_t iterm_relax_cutoff_low; // Slowest setpoint response to prevent iterm accumulation
|
||||
uint8_t iterm_relax_cutoff_high; // Fastest setpoint response to prevent iterm accumulation
|
||||
uint8_t iterm_relax; // Enable iterm suppression during stick input
|
||||
itermRelax_e iterm_relax; // Enable iterm suppression during stick input
|
||||
|
||||
} pidProfile_t;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue