From 3f5e7c1dd0c685332eda3ac71a777e1b83c6cc73 Mon Sep 17 00:00:00 2001 From: shota Date: Wed, 4 Oct 2023 11:34:49 +0900 Subject: [PATCH] fix mixer config init sequence --- src/main/fc/config.c | 2 +- src/main/flight/mixer_profile.c | 8 ++++++-- src/main/flight/mixer_profile.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 27ed9eddd00..3950d763762 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -305,6 +305,7 @@ static void activateConfig(void) { activateControlRateConfig(); activateBatteryProfile(); + activateMixerConfig(); resetAdjustmentStates(); @@ -486,7 +487,6 @@ bool setConfigMixerProfile(uint8_t profileIndex) profileIndex = 0; } systemConfigMutable()->current_mixer_profile_index = profileIndex; - // setMixerProfile(profileIndex); return ret; } diff --git a/src/main/flight/mixer_profile.c b/src/main/flight/mixer_profile.c index 3b0b1fd18f3..de1cdecb3bd 100644 --- a/src/main/flight/mixer_profile.c +++ b/src/main/flight/mixer_profile.c @@ -77,11 +77,15 @@ void pgResetFn_mixerProfiles(mixerProfile_t *instance) } } -void mixerConfigInit(void) -{ +void activateMixerConfig(){ currentMixerProfileIndex = getConfigMixerProfile(); currentMixerConfig = *mixerConfig(); nextProfileIndex = (currentMixerProfileIndex + 1) % MAX_MIXER_PROFILE_COUNT; +} + +void mixerConfigInit(void) +{ + activateMixerConfig(); servosInit(); mixerUpdateStateFlags(); mixerInit(); diff --git a/src/main/flight/mixer_profile.h b/src/main/flight/mixer_profile.h index cb040665ce8..bf52d45c3d9 100644 --- a/src/main/flight/mixer_profile.h +++ b/src/main/flight/mixer_profile.h @@ -73,5 +73,6 @@ static inline const mixerProfile_t* mixerProfiles_CopyArray_by_index(int _index) bool outputProfileHotSwitch(int profile_index); bool checkMixerProfileHotSwitchAvalibility(void); +void activateMixerConfig(void); void mixerConfigInit(void); void outputProfileUpdateTask(timeUs_t currentTimeUs); \ No newline at end of file