Merge pull request #1584 from atomiclama/master-bf

Fixed a problem when the motor count for motorInit came from custom mixer
This commit is contained in:
J Blackman 2016-11-19 17:11:35 +11:00 committed by GitHub
commit 25bcaa3a05
5 changed files with 9 additions and 23 deletions

View File

@ -242,11 +242,6 @@ void motorInit(const motorConfig_t *motorConfig, uint16_t idlePulse, uint8_t mot
} }
} }
bool pwmIsSynced(void)
{
return pwmCompleteWritePtr != NULL;
}
pwmOutputPort_t *pwmGetMotors(void) pwmOutputPort_t *pwmGetMotors(void)
{ {
return motors; return motors;

View File

@ -253,11 +253,6 @@ void motorInit(const motorConfig_t *motorConfig, uint16_t idlePulse, uint8_t mot
} }
} }
bool pwmIsSynced(void)
{
return pwmCompleteWritePtr != NULL;
}
pwmOutputPort_t *pwmGetMotors(void) pwmOutputPort_t *pwmGetMotors(void)
{ {
return motors; return motors;

View File

@ -65,7 +65,6 @@ static flight3DConfig_t *flight3DConfig;
static motorConfig_t *motorConfig; static motorConfig_t *motorConfig;
static airplaneConfig_t *airplaneConfig; static airplaneConfig_t *airplaneConfig;
rxConfig_t *rxConfig; rxConfig_t *rxConfig;
static bool syncMotorOutputWithPidLoop = false;
mixerMode_e currentMixerMode; mixerMode_e currentMixerMode;
static motorMixer_t currentMixer[MAX_SUPPORTED_MOTORS]; static motorMixer_t currentMixer[MAX_SUPPORTED_MOTORS];
@ -305,8 +304,6 @@ void mixerConfigureOutput(void)
motorCount = 0; motorCount = 0;
syncMotorOutputWithPidLoop = pwmIsSynced();
if (currentMixerMode == MIXER_CUSTOM || currentMixerMode == MIXER_CUSTOM_TRI || currentMixerMode == MIXER_CUSTOM_AIRPLANE) { if (currentMixerMode == MIXER_CUSTOM || currentMixerMode == MIXER_CUSTOM_TRI || currentMixerMode == MIXER_CUSTOM_AIRPLANE) {
// 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++) {
@ -358,8 +355,6 @@ void mixerLoadMix(int index, motorMixer_t *customMixers)
#else #else
void mixerConfigureOutput(void) void mixerConfigureOutput(void)
{ {
syncMotorOutputWithPidLoop = pwmIsSynced();
motorCount = QUAD_MOTOR_COUNT; motorCount = QUAD_MOTOR_COUNT;
for (uint8_t i = 0; i < motorCount; i++) { for (uint8_t i = 0; i < motorCount; i++) {
@ -384,9 +379,7 @@ void writeMotors(void)
pwmWriteMotor(i, motor[i]); pwmWriteMotor(i, motor[i]);
} }
if (syncMotorOutputWithPidLoop) { pwmCompleteMotorUpdate(motorCount);
pwmCompleteMotorUpdate(motorCount);
}
} }
static void writeAllMotors(int16_t mc) static void writeAllMotors(int16_t mc)

View File

@ -109,6 +109,7 @@ typedef struct airplaneConfig_s {
#define CHANNEL_FORWARDING_DISABLED (uint8_t)0xFF #define CHANNEL_FORWARDING_DISABLED (uint8_t)0xFF
extern uint8_t motorCount;
extern const mixer_t mixers[]; extern const mixer_t mixers[];
extern int16_t motor[MAX_SUPPORTED_MOTORS]; extern int16_t motor[MAX_SUPPORTED_MOTORS];
extern int16_t motor_disarmed[MAX_SUPPORTED_MOTORS]; extern int16_t motor_disarmed[MAX_SUPPORTED_MOTORS];

View File

@ -263,10 +263,15 @@ void init(void)
idlePulse = 0; // brushed motors idlePulse = 0; // brushed motors
} }
mixerConfigureOutput();
#ifdef USE_SERVOS
servoConfigureOutput();
#endif
#ifdef USE_QUAD_MIXER_ONLY #ifdef USE_QUAD_MIXER_ONLY
motorInit(&masterConfig.motorConfig, idlePulse, QUAD_MOTOR_COUNT); motorInit(&masterConfig.motorConfig, idlePulse, QUAD_MOTOR_COUNT);
#else #else
motorInit(&masterConfig.motorConfig, idlePulse, mixers[masterConfig.mixerMode].motorCount); motorInit(&masterConfig.motorConfig, idlePulse, motorCount);
#endif #endif
#ifdef USE_SERVOS #ifdef USE_SERVOS
@ -285,10 +290,7 @@ void init(void)
pwmRxSetInputFilteringMode(masterConfig.inputFilteringMode); pwmRxSetInputFilteringMode(masterConfig.inputFilteringMode);
#endif #endif
mixerConfigureOutput();
#ifdef USE_SERVOS
servoConfigureOutput();
#endif
systemState |= SYSTEM_STATE_MOTORS_READY; systemState |= SYSTEM_STATE_MOTORS_READY;
#ifdef BEEPER #ifdef BEEPER