1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 17:55:30 +03:00

Disable Airmode fully when airmode not active // Adjust default setpoints / pids

This commit is contained in:
borisbstyle 2017-03-22 23:40:15 +01:00
parent 28f9dc6849
commit 00ec17b6a3
2 changed files with 12 additions and 8 deletions

View file

@ -135,10 +135,10 @@ static void resetPidProfile(pidProfile_t *pidProfile)
{ {
pidProfile->P8[ROLL] = 44; pidProfile->P8[ROLL] = 44;
pidProfile->I8[ROLL] = 40; pidProfile->I8[ROLL] = 40;
pidProfile->D8[ROLL] = 20; pidProfile->D8[ROLL] = 30;
pidProfile->P8[PITCH] = 58; pidProfile->P8[PITCH] = 58;
pidProfile->I8[PITCH] = 50; pidProfile->I8[PITCH] = 50;
pidProfile->D8[PITCH] = 22; pidProfile->D8[PITCH] = 35;
pidProfile->P8[YAW] = 70; pidProfile->P8[YAW] = 70;
pidProfile->I8[YAW] = 45; pidProfile->I8[YAW] = 45;
pidProfile->D8[YAW] = 20; pidProfile->D8[YAW] = 20;
@ -174,8 +174,8 @@ static void resetPidProfile(pidProfile_t *pidProfile)
pidProfile->pidAtMinThrottle = PID_STABILISATION_ON; pidProfile->pidAtMinThrottle = PID_STABILISATION_ON;
pidProfile->levelAngleLimit = 55; pidProfile->levelAngleLimit = 55;
pidProfile->levelSensitivity = 55; pidProfile->levelSensitivity = 55;
pidProfile->setpointRelaxRatio = 20; pidProfile->setpointRelaxRatio = 80;
pidProfile->dtermSetpointWeight = 100; pidProfile->dtermSetpointWeight = 60;
pidProfile->yawRateAccelLimit = 10.0f; pidProfile->yawRateAccelLimit = 10.0f;
pidProfile->rateAccelLimit = 0.0f; pidProfile->rateAccelLimit = 0.0f;
pidProfile->itermThrottleThreshold = 350; pidProfile->itermThrottleThreshold = 350;

View file

@ -513,11 +513,15 @@ void mixTable(pidProfile_t *pidProfile)
for (int i = 0; i < motorCount; i++) { for (int i = 0; i < motorCount; i++) {
motorMix[i] /= motorMixRange; motorMix[i] /= motorMixRange;
} }
// Get the maximum correction by setting offset to center // Get the maximum correction by setting offset to center when airmode enabled
throttle = 0.5f; if (isAirmodeActive()) {
throttle = 0.5f;
}
} else { } else {
float throttleLimitOffset = motorMixRange / 2.0f; if (isAirmodeActive()) { // Only automatically adjust throttle during airmode scenario
throttle = constrainf(throttle, 0.0f + throttleLimitOffset, 1.0f - throttleLimitOffset); float throttleLimitOffset = motorMixRange / 2.0f;
throttle = constrainf(throttle, 0.0f + throttleLimitOffset, 1.0f - throttleLimitOffset);
}
} }
// Now add in the desired throttle, but keep in a range that doesn't clip adjusted // Now add in the desired throttle, but keep in a range that doesn't clip adjusted