mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Merge pull request #3177 from jflyper/bfdev-reset-unsupported-mixer-to-custom-followup2
Follow up to mixer validation
This commit is contained in:
commit
ae0f735ae1
4 changed files with 21 additions and 11 deletions
|
@ -546,10 +546,19 @@ void activateConfig(void)
|
||||||
|
|
||||||
void validateAndFixConfig(void)
|
void validateAndFixConfig(void)
|
||||||
{
|
{
|
||||||
#if !defined(USE_UNCOMMON_MIXERS) && !defined(USE_QUAD_MIXER_ONLY) && !defined(USE_OSD_SLAVE)
|
#if !defined(USE_QUAD_MIXER_ONLY) && !defined(USE_OSD_SLAVE)
|
||||||
|
// Reset unsupported mixer mode to default.
|
||||||
|
// This check will be gone when motor/servo mixers are loaded dynamically
|
||||||
|
// by configurator as a part of configuration procedure.
|
||||||
|
|
||||||
mixerMode_e mixerMode = mixerConfigMutable()->mixerMode;
|
mixerMode_e mixerMode = mixerConfigMutable()->mixerMode;
|
||||||
if (mixerMode != MIXER_CUSTOM && mixerMode != MIXER_CUSTOM_AIRPLANE && mixerMode != MIXER_CUSTOM_TRI && mixers[mixerMode].motor == NULL) {
|
|
||||||
mixerConfigMutable()->mixerMode = MIXER_CUSTOM;
|
if (!(mixerMode == MIXER_CUSTOM || mixerMode == MIXER_CUSTOM_AIRPLANE || mixerMode == MIXER_CUSTOM_TRI)) {
|
||||||
|
if (mixers[mixerMode].motorCount && mixers[mixerMode].motor == NULL)
|
||||||
|
mixerConfigMutable()->mixerMode = MIXER_CUSTOM;
|
||||||
|
|
||||||
|
if (mixers[mixerMode].useServo && servoMixers[mixerMode].servoRuleCount == 0)
|
||||||
|
mixerConfigMutable()->mixerMode = MIXER_CUSTOM_AIRPLANE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ const mixer_t mixers[] = {
|
||||||
{ 3, true, NULL }, // MIXER_CUSTOM_TRI
|
{ 3, true, NULL }, // MIXER_CUSTOM_TRI
|
||||||
{ 4, false, mixerQuadX1234 },
|
{ 4, false, mixerQuadX1234 },
|
||||||
};
|
};
|
||||||
#endif
|
#endif // !USE_QUAD_MIXER_ONLY
|
||||||
|
|
||||||
static uint16_t disarmMotorOutput, deadbandMotor3dHigh, deadbandMotor3dLow;
|
static uint16_t disarmMotorOutput, deadbandMotor3dHigh, deadbandMotor3dLow;
|
||||||
uint16_t motorOutputHigh, motorOutputLow;
|
uint16_t motorOutputHigh, motorOutputLow;
|
||||||
|
|
|
@ -156,13 +156,6 @@ static const servoMixer_t servoMixerGimbal[] = {
|
||||||
{ SERVO_GIMBAL_ROLL, INPUT_GIMBAL_ROLL, 125, 0, 0, 100, 0 },
|
{ SERVO_GIMBAL_ROLL, INPUT_GIMBAL_ROLL, 125, 0, 0, 100, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Custom mixer configuration
|
|
||||||
typedef struct mixerRules_s {
|
|
||||||
uint8_t servoRuleCount;
|
|
||||||
const servoMixer_t *rule;
|
|
||||||
} mixerRules_t;
|
|
||||||
|
|
||||||
const mixerRules_t servoMixers[] = {
|
const mixerRules_t servoMixers[] = {
|
||||||
{ 0, NULL }, // entry 0
|
{ 0, NULL }, // entry 0
|
||||||
{ COUNT_SERVO_RULES(servoMixerTri), servoMixerTri }, // MULTITYPE_TRI
|
{ COUNT_SERVO_RULES(servoMixerTri), servoMixerTri }, // MULTITYPE_TRI
|
||||||
|
|
|
@ -91,6 +91,14 @@ typedef struct servoMixer_s {
|
||||||
|
|
||||||
PG_DECLARE_ARRAY(servoMixer_t, MAX_SERVO_RULES, customServoMixers);
|
PG_DECLARE_ARRAY(servoMixer_t, MAX_SERVO_RULES, customServoMixers);
|
||||||
|
|
||||||
|
// Custom mixer configuration
|
||||||
|
typedef struct mixerRules_s {
|
||||||
|
uint8_t servoRuleCount;
|
||||||
|
const servoMixer_t *rule;
|
||||||
|
} mixerRules_t;
|
||||||
|
|
||||||
|
extern const mixerRules_t servoMixers[];
|
||||||
|
|
||||||
typedef struct servoParam_s {
|
typedef struct servoParam_s {
|
||||||
uint32_t reversedSources; // the direction of servo movement for each input source of the servo mixer, bit set=inverted
|
uint32_t reversedSources; // the direction of servo movement for each input source of the servo mixer, bit set=inverted
|
||||||
int16_t min; // servo min
|
int16_t min; // servo min
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue