mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Made float parameter calculation static.
This commit is contained in:
parent
df4b09e874
commit
40a2bee492
3 changed files with 15 additions and 4 deletions
|
@ -128,6 +128,9 @@ int16_t motor_disarmed[MAX_SUPPORTED_MOTORS];
|
||||||
mixerMode_e currentMixerMode;
|
mixerMode_e currentMixerMode;
|
||||||
static motorMixer_t currentMixer[MAX_SUPPORTED_MOTORS];
|
static motorMixer_t currentMixer[MAX_SUPPORTED_MOTORS];
|
||||||
|
|
||||||
|
float pidSumLimit;
|
||||||
|
float pidSumLimitYaw;
|
||||||
|
|
||||||
|
|
||||||
static const motorMixer_t mixerQuadX[] = {
|
static const motorMixer_t mixerQuadX[] = {
|
||||||
{ 1.0f, -1.0f, 1.0f, -1.0f }, // REAR_R
|
{ 1.0f, -1.0f, 1.0f, -1.0f }, // REAR_R
|
||||||
|
@ -391,6 +394,12 @@ void mixerInit(mixerMode_e mixerMode)
|
||||||
initEscEndpoints();
|
initEscEndpoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pidInitMixer(struct pidProfile_s *pidProfile)
|
||||||
|
{
|
||||||
|
pidSumLimit = CONVERT_PARAMETER_TO_FLOAT(pidProfile->pidSumLimit);
|
||||||
|
pidSumLimitYaw = CONVERT_PARAMETER_TO_FLOAT(pidProfile->pidSumLimitYaw);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef USE_QUAD_MIXER_ONLY
|
#ifndef USE_QUAD_MIXER_ONLY
|
||||||
|
|
||||||
void mixerConfigureOutput(void)
|
void mixerConfigureOutput(void)
|
||||||
|
@ -555,13 +564,13 @@ void mixTable(pidProfile_t *pidProfile)
|
||||||
// Calculate and Limit the PIDsum
|
// Calculate and Limit the PIDsum
|
||||||
scaledAxisPIDf[FD_ROLL] =
|
scaledAxisPIDf[FD_ROLL] =
|
||||||
constrainf((axisPID_P[FD_ROLL] + axisPID_I[FD_ROLL] + axisPID_D[FD_ROLL]) / PID_MIXER_SCALING,
|
constrainf((axisPID_P[FD_ROLL] + axisPID_I[FD_ROLL] + axisPID_D[FD_ROLL]) / PID_MIXER_SCALING,
|
||||||
-CONVERT_PARAMETER_TO_FLOAT(pidProfile->pidSumLimit), CONVERT_PARAMETER_TO_FLOAT(pidProfile->pidSumLimit));
|
-pidSumLimit, pidSumLimit);
|
||||||
scaledAxisPIDf[FD_PITCH] =
|
scaledAxisPIDf[FD_PITCH] =
|
||||||
constrainf((axisPID_P[FD_PITCH] + axisPID_I[FD_PITCH] + axisPID_D[FD_PITCH]) / PID_MIXER_SCALING,
|
constrainf((axisPID_P[FD_PITCH] + axisPID_I[FD_PITCH] + axisPID_D[FD_PITCH]) / PID_MIXER_SCALING,
|
||||||
-CONVERT_PARAMETER_TO_FLOAT(pidProfile->pidSumLimit), CONVERT_PARAMETER_TO_FLOAT(pidProfile->pidSumLimit));
|
-pidSumLimit, pidSumLimit);
|
||||||
scaledAxisPIDf[FD_YAW] =
|
scaledAxisPIDf[FD_YAW] =
|
||||||
constrainf((axisPID_P[FD_YAW] + axisPID_I[FD_YAW]) / PID_MIXER_SCALING,
|
constrainf((axisPID_P[FD_YAW] + axisPID_I[FD_YAW]) / PID_MIXER_SCALING,
|
||||||
-CONVERT_PARAMETER_TO_FLOAT(pidProfile->pidSumLimit), CONVERT_PARAMETER_TO_FLOAT(pidProfile->pidSumLimitYaw));
|
-pidSumLimitYaw, pidSumLimitYaw);
|
||||||
|
|
||||||
// Calculate voltage compensation
|
// Calculate voltage compensation
|
||||||
const float vbatCompensationFactor = (pidProfile->vbatPidCompensation) ? calculateVbatPidCompensation() : 1.0f;
|
const float vbatCompensationFactor = (pidProfile->vbatPidCompensation) ? calculateVbatPidCompensation() : 1.0f;
|
||||||
|
|
|
@ -128,11 +128,12 @@ bool mixerIsOutputSaturated(int axis, float errorRate);
|
||||||
|
|
||||||
void mixerLoadMix(int index, motorMixer_t *customMixers);
|
void mixerLoadMix(int index, motorMixer_t *customMixers);
|
||||||
void mixerInit(mixerMode_e mixerMode);
|
void mixerInit(mixerMode_e mixerMode);
|
||||||
|
struct pidProfile_s;
|
||||||
|
void pidInitMixer(struct pidProfile_s *pidProfile);
|
||||||
|
|
||||||
void mixerConfigureOutput(void);
|
void mixerConfigureOutput(void);
|
||||||
|
|
||||||
void mixerResetDisarmedMotors(void);
|
void mixerResetDisarmedMotors(void);
|
||||||
struct pidProfile_s;
|
|
||||||
void mixTable(struct pidProfile_s *pidProfile);
|
void mixTable(struct pidProfile_s *pidProfile);
|
||||||
void syncMotors(bool enabled);
|
void syncMotors(bool enabled);
|
||||||
void writeMotors(void);
|
void writeMotors(void);
|
||||||
|
|
|
@ -277,6 +277,7 @@ void pidInit(const pidProfile_t *pidProfile)
|
||||||
pidSetTargetLooptime(gyro.targetLooptime * pidConfig()->pid_process_denom); // Initialize pid looptime
|
pidSetTargetLooptime(gyro.targetLooptime * pidConfig()->pid_process_denom); // Initialize pid looptime
|
||||||
pidInitFilters(pidProfile);
|
pidInitFilters(pidProfile);
|
||||||
pidInitConfig(pidProfile);
|
pidInitConfig(pidProfile);
|
||||||
|
pidInitMixer(pidProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculates strength of horizon leveling; 0 = none, 1.0 = most leveling
|
// calculates strength of horizon leveling; 0 = none, 1.0 = most leveling
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue