mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Avoid necessity for pidInitMixer
This commit is contained in:
parent
533734a58d
commit
6c8b0f3adf
3 changed files with 3 additions and 15 deletions
|
@ -120,9 +120,6 @@ float 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
|
||||||
|
@ -379,12 +376,6 @@ void mixerInit(mixerMode_e mixerMode)
|
||||||
initEscEndpoints();
|
initEscEndpoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pidInitMixer(const 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)
|
||||||
|
@ -591,11 +582,11 @@ void mixTable(uint8_t vbatPidCompensation)
|
||||||
|
|
||||||
// Calculate and Limit the PIDsum
|
// Calculate and Limit the PIDsum
|
||||||
float scaledAxisPidRoll =
|
float scaledAxisPidRoll =
|
||||||
constrainf(axisPID_P[FD_ROLL] + axisPID_I[FD_ROLL] + axisPID_D[FD_ROLL], -pidSumLimit, pidSumLimit) / PID_MIXER_SCALING;
|
constrainf(axisPID_P[FD_ROLL] + axisPID_I[FD_ROLL] + axisPID_D[FD_ROLL], -currentPidProfile->pidSumLimit, currentPidProfile->pidSumLimit) / PID_MIXER_SCALING;
|
||||||
float scaledAxisPidPitch =
|
float scaledAxisPidPitch =
|
||||||
constrainf(axisPID_P[FD_PITCH] + axisPID_I[FD_PITCH] + axisPID_D[FD_PITCH], -pidSumLimit, pidSumLimit) / PID_MIXER_SCALING;
|
constrainf(axisPID_P[FD_PITCH] + axisPID_I[FD_PITCH] + axisPID_D[FD_PITCH], -currentPidProfile->pidSumLimit, currentPidProfile->pidSumLimit) / PID_MIXER_SCALING;
|
||||||
float scaledAxisPidYaw =
|
float scaledAxisPidYaw =
|
||||||
constrainf(axisPID_P[FD_YAW] + axisPID_I[FD_YAW], -pidSumLimitYaw, pidSumLimitYaw) / PID_MIXER_SCALING;
|
constrainf(axisPID_P[FD_YAW] + axisPID_I[FD_YAW], -currentPidProfile->pidSumLimitYaw, currentPidProfile->pidSumLimitYaw) / PID_MIXER_SCALING;
|
||||||
if (isMotorsReversed()) {
|
if (isMotorsReversed()) {
|
||||||
scaledAxisPidRoll = -scaledAxisPidRoll;
|
scaledAxisPidRoll = -scaledAxisPidRoll;
|
||||||
scaledAxisPidPitch = -scaledAxisPidPitch;
|
scaledAxisPidPitch = -scaledAxisPidPitch;
|
||||||
|
|
|
@ -113,8 +113,6 @@ 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(const struct pidProfile_s *pidProfile);
|
|
||||||
|
|
||||||
void mixerConfigureOutput(void);
|
void mixerConfigureOutput(void);
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,6 @@ 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