mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 07:15:18 +03:00
Refactored the validation code
- The check is active regardless of the USE_UNCOMMON_MIXER to detect unsupported/insufficiently supported mixers. - Custom mixers always pass the check. - Mixer mode resets to MIXER_CUSTOM if motorCount != 0 but motor array is NULL. - Mixer mode resets to MIXER_CUSTOM_AIRPLANE if useServo but servo count is zero.
This commit is contained in:
parent
0fcccd7a40
commit
0b1383a730
3 changed files with 19 additions and 10 deletions
|
@ -546,11 +546,19 @@ void activateConfig(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;
|
||||
|
||||
if (mixerMode != MIXER_CUSTOM && mixerMode != MIXER_CUSTOM_AIRPLANE && mixerMode != MIXER_CUSTOM_TRI && mixerMode != MIXER_GIMBAL && mixerMode != MIXER_PPM_TO_SERVO && 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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue