mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Initialisation order meant that useServos was always false, the problem
was introduced in fd59a4cd52
.
This commit is contained in:
parent
b364a0ea31
commit
07547d35aa
2 changed files with 24 additions and 13 deletions
|
@ -243,21 +243,28 @@ int servoDirection(int nr, int lr)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mixerInit(MultiType mixerConfiguration, motorMixer_t *customMixers, pwmOutputConfiguration_t *pwmOutputConfiguration)
|
static motorMixer_t *customMixers;
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
|
void mixerInit(MultiType mixerConfiguration, motorMixer_t *initialCustomMixers)
|
||||||
|
{
|
||||||
currentMixerConfiguration = mixerConfiguration;
|
currentMixerConfiguration = mixerConfiguration;
|
||||||
|
|
||||||
servoCount = pwmOutputConfiguration->servoCount;
|
customMixers = initialCustomMixers;
|
||||||
|
|
||||||
// enable servos for mixes that require them. note, this shifts motor counts.
|
// enable servos for mixes that require them. note, this shifts motor counts.
|
||||||
useServo = mixers[mixerConfiguration].useServo;
|
useServo = mixers[currentMixerConfiguration].useServo;
|
||||||
// if we want camstab/trig, that also enables servos, even if mixer doesn't
|
// if we want camstab/trig, that also enables servos, even if mixer doesn't
|
||||||
if (feature(FEATURE_SERVO_TILT))
|
if (feature(FEATURE_SERVO_TILT))
|
||||||
useServo = 1;
|
useServo = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (mixerConfiguration == MULTITYPE_CUSTOM) {
|
void mixerUsePWMOutputConfiguration(pwmOutputConfiguration_t *pwmOutputConfiguration)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
servoCount = pwmOutputConfiguration->servoCount;
|
||||||
|
|
||||||
|
if (currentMixerConfiguration == MULTITYPE_CUSTOM) {
|
||||||
// load custom mixer into currentMixer
|
// load custom mixer into currentMixer
|
||||||
for (i = 0; i < MAX_SUPPORTED_MOTORS; i++) {
|
for (i = 0; i < MAX_SUPPORTED_MOTORS; i++) {
|
||||||
// check if done
|
// check if done
|
||||||
|
@ -267,11 +274,11 @@ void mixerInit(MultiType mixerConfiguration, motorMixer_t *customMixers, pwmOutp
|
||||||
numberMotor++;
|
numberMotor++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
numberMotor = mixers[mixerConfiguration].numberMotor;
|
numberMotor = mixers[currentMixerConfiguration].numberMotor;
|
||||||
// copy motor-based mixers
|
// copy motor-based mixers
|
||||||
if (mixers[mixerConfiguration].motor) {
|
if (mixers[currentMixerConfiguration].motor) {
|
||||||
for (i = 0; i < numberMotor; i++)
|
for (i = 0; i < numberMotor; i++)
|
||||||
currentMixer[i] = mixers[mixerConfiguration].motor[i];
|
currentMixer[i] = mixers[currentMixerConfiguration].motor[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,8 +294,8 @@ void mixerInit(MultiType mixerConfiguration, motorMixer_t *customMixers, pwmOutp
|
||||||
}
|
}
|
||||||
|
|
||||||
// set flag that we're on something with wings
|
// set flag that we're on something with wings
|
||||||
if (mixerConfiguration == MULTITYPE_FLYING_WING ||
|
if (currentMixerConfiguration == MULTITYPE_FLYING_WING ||
|
||||||
mixerConfiguration == MULTITYPE_AIRPLANE)
|
currentMixerConfiguration == MULTITYPE_AIRPLANE)
|
||||||
f.FIXED_WING = 1;
|
f.FIXED_WING = 1;
|
||||||
else
|
else
|
||||||
f.FIXED_WING = 0;
|
f.FIXED_WING = 0;
|
||||||
|
@ -586,6 +593,7 @@ void mixTable(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool isMixerUsingServos(void)
|
bool isMixerUsingServos(void)
|
||||||
{
|
{
|
||||||
return useServo;
|
return useServo;
|
||||||
|
|
|
@ -80,7 +80,8 @@ void initTelemetry(void);
|
||||||
void serialInit(serialConfig_t *initialSerialConfig);
|
void serialInit(serialConfig_t *initialSerialConfig);
|
||||||
failsafe_t* failsafeInit(rxConfig_t *intialRxConfig);
|
failsafe_t* failsafeInit(rxConfig_t *intialRxConfig);
|
||||||
pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init);
|
pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init);
|
||||||
void mixerInit(MultiType mixerConfiguration, motorMixer_t *customMixers, pwmOutputConfiguration_t *pwmOutputConfiguration);
|
void mixerInit(MultiType mixerConfiguration, motorMixer_t *customMixers);
|
||||||
|
void mixerUsePWMOutputConfiguration(pwmOutputConfiguration_t *pwmOutputConfiguration);
|
||||||
void rxInit(rxConfig_t *rxConfig, failsafe_t *failsafe);
|
void rxInit(rxConfig_t *rxConfig, failsafe_t *failsafe);
|
||||||
void beepcodeInit(failsafe_t *initialFailsafe);
|
void beepcodeInit(failsafe_t *initialFailsafe);
|
||||||
void gpsInit(serialConfig_t *serialConfig, gpsConfig_t *initialGpsConfig, gpsProfile_t *initialGpsProfile, pidProfile_t *pidProfile);
|
void gpsInit(serialConfig_t *serialConfig, gpsConfig_t *initialGpsConfig, gpsProfile_t *initialGpsProfile, pidProfile_t *pidProfile);
|
||||||
|
@ -160,6 +161,8 @@ void init(void)
|
||||||
LED1_OFF;
|
LED1_OFF;
|
||||||
|
|
||||||
imuInit();
|
imuInit();
|
||||||
|
mixerInit(masterConfig.mixerConfiguration, masterConfig.customMixer);
|
||||||
|
|
||||||
#ifdef MAG
|
#ifdef MAG
|
||||||
if (sensors(SENSOR_MAG))
|
if (sensors(SENSOR_MAG))
|
||||||
compassInit();
|
compassInit();
|
||||||
|
@ -200,7 +203,7 @@ void init(void)
|
||||||
|
|
||||||
pwmOutputConfiguration_t *pwmOutputConfiguration = pwmInit(&pwm_params);
|
pwmOutputConfiguration_t *pwmOutputConfiguration = pwmInit(&pwm_params);
|
||||||
|
|
||||||
mixerInit(masterConfig.mixerConfiguration, masterConfig.customMixer, pwmOutputConfiguration);
|
mixerUsePWMOutputConfiguration(pwmOutputConfiguration);
|
||||||
|
|
||||||
failsafe = failsafeInit(&masterConfig.rxConfig);
|
failsafe = failsafeInit(&masterConfig.rxConfig);
|
||||||
beepcodeInit(failsafe);
|
beepcodeInit(failsafe);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue