1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 12:25:20 +03:00

Merge pull request #9608 from etracer65/fix_mixer_profile_init

Fix initialization of mixer related pidProfile settings
This commit is contained in:
Michael Keller 2020-03-21 01:09:06 +13:00 committed by GitHub
commit 02c92a034c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View file

@ -814,6 +814,7 @@ void changePidProfile(uint8_t pidProfileIndex)
pidInit(currentPidProfile); pidInit(currentPidProfile);
initEscEndpoints(); initEscEndpoints();
mixerInitProfile();
} }
beeperConfirmationBeeps(pidProfileIndex + 1); beeperConfirmationBeeps(pidProfileIndex + 1);

View file

@ -347,6 +347,16 @@ void initEscEndpoints(void)
rcCommandThrottleRange = PWM_RANGE_MAX - PWM_RANGE_MIN; rcCommandThrottleRange = PWM_RANGE_MAX - PWM_RANGE_MIN;
} }
// Initialize pidProfile related mixer settings
void mixerInitProfile(void)
{
#ifdef USE_DYN_IDLE
idleMinMotorRps = currentPidProfile->idle_min_rpm * 100.0f / 60.0f;
idleMaxIncrease = currentPidProfile->idle_max_increase * 0.001f;
idleP = currentPidProfile->idle_p * 0.0001f;
#endif
}
void mixerInit(mixerMode_e mixerMode) void mixerInit(mixerMode_e mixerMode)
{ {
currentMixerMode = mixerMode; currentMixerMode = mixerMode;
@ -357,12 +367,12 @@ void mixerInit(mixerMode_e mixerMode)
mixerTricopterInit(); mixerTricopterInit();
} }
#endif #endif
#ifdef USE_DYN_IDLE #ifdef USE_DYN_IDLE
idleMinMotorRps = currentPidProfile->idle_min_rpm * 100.0f / 60.0f;
idleMaxIncrease = currentPidProfile->idle_max_increase * 0.001f;
idleThrottleOffset = motorConfig()->digitalIdleOffsetValue * 0.0001f; idleThrottleOffset = motorConfig()->digitalIdleOffsetValue * 0.0001f;
idleP = currentPidProfile->idle_p * 0.0001f;
#endif #endif
mixerInitProfile();
} }
#ifdef USE_LAUNCH_CONTROL #ifdef USE_LAUNCH_CONTROL

View file

@ -101,6 +101,7 @@ bool areMotorsRunning(void);
void mixerLoadMix(int index, motorMixer_t *customMixers); void mixerLoadMix(int index, motorMixer_t *customMixers);
void initEscEndpoints(void); void initEscEndpoints(void);
void mixerInit(mixerMode_e mixerMode); void mixerInit(mixerMode_e mixerMode);
void mixerInitProfile(void);
void mixerConfigureOutput(void); void mixerConfigureOutput(void);