1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00

Fixed a problem when the motor count for motorInit came from a custom

mixer table lookup which was 0.

1. took the motor count from the loading of the custom mixer table.
2. Moved the mixerconfig to before motorInit as motorInit needs the
motorCount.
3. removed pwmIsSynced checks as this was a order of init problem, and
not required as pwmCompleteMotorUpdate protects itself.
This commit is contained in:
atomiclama 2016-11-17 08:30:05 +00:00
parent 135231f289
commit d4a81879d8
5 changed files with 9 additions and 23 deletions

View file

@ -65,7 +65,6 @@ static flight3DConfig_t *flight3DConfig;
static motorConfig_t *motorConfig;
static airplaneConfig_t *airplaneConfig;
rxConfig_t *rxConfig;
static bool syncMotorOutputWithPidLoop = false;
mixerMode_e currentMixerMode;
static motorMixer_t currentMixer[MAX_SUPPORTED_MOTORS];
@ -301,8 +300,6 @@ void mixerConfigureOutput(void)
motorCount = 0;
syncMotorOutputWithPidLoop = pwmIsSynced();
if (currentMixerMode == MIXER_CUSTOM || currentMixerMode == MIXER_CUSTOM_TRI || currentMixerMode == MIXER_CUSTOM_AIRPLANE) {
// load custom mixer into currentMixer
for (i = 0; i < MAX_SUPPORTED_MOTORS; i++) {
@ -354,8 +351,6 @@ void mixerLoadMix(int index, motorMixer_t *customMixers)
#else
void mixerConfigureOutput(void)
{
syncMotorOutputWithPidLoop = pwmIsSynced();
motorCount = QUAD_MOTOR_COUNT;
for (uint8_t i = 0; i < motorCount; i++) {
@ -380,9 +375,7 @@ void writeMotors(void)
pwmWriteMotor(i, motor[i]);
}
if (syncMotorOutputWithPidLoop) {
pwmCompleteMotorUpdate(motorCount);
}
pwmCompleteMotorUpdate(motorCount);
}
static void writeAllMotors(int16_t mc)