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

Fixes from review.

This commit is contained in:
mikeller 2018-10-22 12:38:05 +13:00
parent 817bb2ed86
commit feaa082ac3
4 changed files with 9 additions and 8 deletions

View file

@ -712,7 +712,6 @@ static void applyMixToMotors(float motorMix[MAX_SUPPORTED_MOTORS])
} else {
motorOutput = constrain(motorOutput, motorRangeMin, motorRangeMax);
}
motor[i] = motorOutput;
}
@ -786,10 +785,12 @@ FAST_CODE_NOINLINE void mixTable(timeUs_t currentTimeUs, uint8_t vbatPidCompensa
throttle = applyThrottleLimit(throttle);
}
const bool airmodeEnabled = airmodeIsEnabled();
#ifdef USE_YAW_SPIN_RECOVERY
// 50% throttle provides the maximum authority for yaw recovery when airmode is not active.
// When airmode is active the throttle setting doesn't impact recovery authority.
if (yawSpinDetected && !airmodeIsEnabled()) {
if (yawSpinDetected && !airmodeEnabled) {
throttle = 0.5f; //
}
#endif // USE_YAW_SPIN_RECOVERY
@ -836,11 +837,11 @@ FAST_CODE_NOINLINE void mixTable(timeUs_t currentTimeUs, uint8_t vbatPidCompensa
motorMix[i] /= motorMixRange;
}
// Get the maximum correction by setting offset to center when airmode enabled
if (airmodeIsEnabled()) {
if (airmodeEnabled) {
throttle = 0.5f;
}
} else {
if (airmodeIsEnabled() || throttle > 0.5f) { // Only automatically adjust throttle when airmode enabled. Airmode logic is always active on high throttle
if (airmodeEnabled || throttle > 0.5f) { // Only automatically adjust throttle when airmode enabled. Airmode logic is always active on high throttle
const float throttleLimitOffset = motorMixRange / 2.0f;
throttle = constrainf(throttle, 0.0f + throttleLimitOffset, 1.0f - throttleLimitOffset);
}
@ -849,7 +850,7 @@ FAST_CODE_NOINLINE void mixTable(timeUs_t currentTimeUs, uint8_t vbatPidCompensa
if (featureIsEnabled(FEATURE_MOTOR_STOP)
&& ARMING_FLAG(ARMED)
&& !featureIsEnabled(FEATURE_3D)
&& !isAirmodeActive()
&& !airmodeEnabled
&& (rcData[THROTTLE] < rxConfig()->mincheck)) {
// motor_stop handling
applyMotorStop();

View file

@ -972,7 +972,7 @@ extern "C" {
return false;
}
bool isAirmodeActive() {
bool airmodeIsEnabled() {
return false;
}

View file

@ -278,7 +278,7 @@ extern "C" {
bool featureIsEnabled(uint32_t) {return false;}
bool isAirmodeActive(void) {return true;}
bool airmodeIsEnabled(void) {return true;}
mspResult_e mspFcProcessCommand(mspPacket_t *cmd, mspPacket_t *reply, mspPostProcessFnPtr *mspPostProcessFn) {

View file

@ -312,7 +312,7 @@ bool telemetryCheckRxPortShared(const serialPortConfig_t *) {return true;}
portSharing_e determinePortSharing(const serialPortConfig_t *, serialPortFunction_e) {return PORTSHARING_NOT_SHARED;}
bool isAirmodeActive(void) {return airMode;}
bool airmodeIsEnabled(void) {return airMode;}
int32_t getAmperage(void) {
return testAmperage;