Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mixer config initialization sequence #9339

Merged
merged 1 commit into from Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/fc/config.c
Expand Up @@ -305,6 +305,7 @@ static void activateConfig(void)
{
activateControlRateConfig();
activateBatteryProfile();
activateMixerConfig();

resetAdjustmentStates();

Expand Down Expand Up @@ -486,7 +487,6 @@ bool setConfigMixerProfile(uint8_t profileIndex)
profileIndex = 0;
}
systemConfigMutable()->current_mixer_profile_index = profileIndex;
// setMixerProfile(profileIndex);
return ret;
}

Expand Down
8 changes: 6 additions & 2 deletions src/main/flight/mixer_profile.c
Expand Up @@ -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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is calling activateMixerConfig() needed here?

Otherwise it looks good.

servosInit();
mixerUpdateStateFlags();
mixerInit();
Expand Down
1 change: 1 addition & 0 deletions src/main/flight/mixer_profile.h
Expand Up @@ -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);