mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
Rename 'isAirmodeActive()' to 'airmodeIsEnabled()'.
This commit is contained in:
parent
6206f034a8
commit
817bb2ed86
6 changed files with 15 additions and 14 deletions
|
@ -578,7 +578,7 @@ bool processRx(timeUs_t currentTimeUs)
|
||||||
const throttleStatus_e throttleStatus = calculateThrottleStatus();
|
const throttleStatus_e throttleStatus = calculateThrottleStatus();
|
||||||
const uint8_t throttlePercent = calculateThrottlePercent();
|
const uint8_t throttlePercent = calculateThrottlePercent();
|
||||||
|
|
||||||
if (isAirmodeActive() && ARMING_FLAG(ARMED)) {
|
if (airmodeIsEnabled() && ARMING_FLAG(ARMED)) {
|
||||||
if (throttlePercent >= rxConfig()->airModeActivateThreshold) {
|
if (throttlePercent >= rxConfig()->airModeActivateThreshold) {
|
||||||
airmodeIsActivated = true; // Prevent iterm from being reset
|
airmodeIsActivated = true; // Prevent iterm from being reset
|
||||||
}
|
}
|
||||||
|
@ -618,7 +618,7 @@ bool processRx(timeUs_t currentTimeUs)
|
||||||
// - sticks are active and have deflection greater than runaway_takeoff_deactivate_stick_percent
|
// - sticks are active and have deflection greater than runaway_takeoff_deactivate_stick_percent
|
||||||
// - pidSum on all axis is less then runaway_takeoff_deactivate_pidlimit
|
// - pidSum on all axis is less then runaway_takeoff_deactivate_pidlimit
|
||||||
bool inStableFlight = false;
|
bool inStableFlight = false;
|
||||||
if (!featureIsEnabled(FEATURE_MOTOR_STOP) || isAirmodeActive() || (throttleStatus != THROTTLE_LOW)) { // are motors running?
|
if (!featureIsEnabled(FEATURE_MOTOR_STOP) || airmodeIsEnabled() || (throttleStatus != THROTTLE_LOW)) { // are motors running?
|
||||||
const uint8_t lowThrottleLimit = pidConfig()->runaway_takeoff_deactivate_throttle;
|
const uint8_t lowThrottleLimit = pidConfig()->runaway_takeoff_deactivate_throttle;
|
||||||
const uint8_t midThrottleLimit = constrain(lowThrottleLimit * 2, lowThrottleLimit * 2, RUNAWAY_TAKEOFF_HIGH_THROTTLE_PERCENT);
|
const uint8_t midThrottleLimit = constrain(lowThrottleLimit * 2, lowThrottleLimit * 2, RUNAWAY_TAKEOFF_HIGH_THROTTLE_PERCENT);
|
||||||
if ((((throttlePercent >= lowThrottleLimit) && areSticksActive(RUNAWAY_TAKEOFF_DEACTIVATE_STICK_PERCENT)) || (throttlePercent >= midThrottleLimit))
|
if ((((throttlePercent >= lowThrottleLimit) && areSticksActive(RUNAWAY_TAKEOFF_DEACTIVATE_STICK_PERCENT)) || (throttlePercent >= midThrottleLimit))
|
||||||
|
@ -674,7 +674,7 @@ bool processRx(timeUs_t currentTimeUs)
|
||||||
&& featureIsEnabled(FEATURE_MOTOR_STOP)
|
&& featureIsEnabled(FEATURE_MOTOR_STOP)
|
||||||
&& !STATE(FIXED_WING)
|
&& !STATE(FIXED_WING)
|
||||||
&& !featureIsEnabled(FEATURE_3D)
|
&& !featureIsEnabled(FEATURE_3D)
|
||||||
&& !isAirmodeActive()
|
&& !airmodeIsEnabled()
|
||||||
) {
|
) {
|
||||||
if (isUsingSticksForArming()) {
|
if (isUsingSticksForArming()) {
|
||||||
if (throttleStatus == THROTTLE_LOW) {
|
if (throttleStatus == THROTTLE_LOW) {
|
||||||
|
@ -872,7 +872,7 @@ static FAST_CODE void subTaskPidController(timeUs_t currentTimeUs)
|
||||||
&& !runawayTakeoffCheckDisabled
|
&& !runawayTakeoffCheckDisabled
|
||||||
&& !flipOverAfterCrashMode
|
&& !flipOverAfterCrashMode
|
||||||
&& !runawayTakeoffTemporarilyDisabled
|
&& !runawayTakeoffTemporarilyDisabled
|
||||||
&& (!featureIsEnabled(FEATURE_MOTOR_STOP) || isAirmodeActive() || (calculateThrottleStatus() != THROTTLE_LOW))) {
|
&& (!featureIsEnabled(FEATURE_MOTOR_STOP) || airmodeIsEnabled() || (calculateThrottleStatus() != THROTTLE_LOW))) {
|
||||||
|
|
||||||
if (((fabsf(pidData[FD_PITCH].Sum) >= RUNAWAY_TAKEOFF_PIDSUM_THRESHOLD)
|
if (((fabsf(pidData[FD_PITCH].Sum) >= RUNAWAY_TAKEOFF_PIDSUM_THRESHOLD)
|
||||||
|| (fabsf(pidData[FD_ROLL].Sum) >= RUNAWAY_TAKEOFF_PIDSUM_THRESHOLD)
|
|| (fabsf(pidData[FD_ROLL].Sum) >= RUNAWAY_TAKEOFF_PIDSUM_THRESHOLD)
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
boxBitmask_t rcModeActivationMask; // one bit per mode defined in boxId_e
|
boxBitmask_t rcModeActivationMask; // one bit per mode defined in boxId_e
|
||||||
static boxBitmask_t stickyModesEverDisabled;
|
static boxBitmask_t stickyModesEverDisabled;
|
||||||
|
|
||||||
static bool airmodeActive;
|
static bool airmodeEnabled;
|
||||||
|
|
||||||
PG_REGISTER_ARRAY(modeActivationCondition_t, MAX_MODE_ACTIVATION_CONDITION_COUNT, modeActivationConditions,
|
PG_REGISTER_ARRAY(modeActivationCondition_t, MAX_MODE_ACTIVATION_CONDITION_COUNT, modeActivationConditions,
|
||||||
PG_MODE_ACTIVATION_PROFILE, 1);
|
PG_MODE_ACTIVATION_PROFILE, 1);
|
||||||
|
@ -60,8 +60,8 @@ void rcModeUpdate(boxBitmask_t *newState)
|
||||||
rcModeActivationMask = *newState;
|
rcModeActivationMask = *newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAirmodeActive(void) {
|
bool airmodeIsEnabled(void) {
|
||||||
return airmodeActive;
|
return airmodeEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isRangeActive(uint8_t auxChannelIndex, const channelRange_t *range) {
|
bool isRangeActive(uint8_t auxChannelIndex, const channelRange_t *range) {
|
||||||
|
@ -139,7 +139,7 @@ void updateActivatedModes(void)
|
||||||
|
|
||||||
rcModeUpdate(&newMask);
|
rcModeUpdate(&newMask);
|
||||||
|
|
||||||
airmodeActive = featureIsEnabled(FEATURE_AIRMODE) || IS_RC_MODE_ACTIVE(BOXAIRMODE);
|
airmodeEnabled = featureIsEnabled(FEATURE_AIRMODE) || IS_RC_MODE_ACTIVE(BOXAIRMODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isModeActivationConditionPresent(boxId_e modeId)
|
bool isModeActivationConditionPresent(boxId_e modeId)
|
||||||
|
|
|
@ -126,7 +126,7 @@ typedef struct modeActivationProfile_s {
|
||||||
bool IS_RC_MODE_ACTIVE(boxId_e boxId);
|
bool IS_RC_MODE_ACTIVE(boxId_e boxId);
|
||||||
void rcModeUpdate(boxBitmask_t *newState);
|
void rcModeUpdate(boxBitmask_t *newState);
|
||||||
|
|
||||||
bool isAirmodeActive(void);
|
bool airmodeIsEnabled(void);
|
||||||
|
|
||||||
bool isRangeActive(uint8_t auxChannelIndex, const channelRange_t *range);
|
bool isRangeActive(uint8_t auxChannelIndex, const channelRange_t *range);
|
||||||
void updateActivatedModes(void);
|
void updateActivatedModes(void);
|
||||||
|
|
|
@ -712,6 +712,7 @@ static void applyMixToMotors(float motorMix[MAX_SUPPORTED_MOTORS])
|
||||||
} else {
|
} else {
|
||||||
motorOutput = constrain(motorOutput, motorRangeMin, motorRangeMax);
|
motorOutput = constrain(motorOutput, motorRangeMin, motorRangeMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
motor[i] = motorOutput;
|
motor[i] = motorOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,7 +789,7 @@ FAST_CODE_NOINLINE void mixTable(timeUs_t currentTimeUs, uint8_t vbatPidCompensa
|
||||||
#ifdef USE_YAW_SPIN_RECOVERY
|
#ifdef USE_YAW_SPIN_RECOVERY
|
||||||
// 50% throttle provides the maximum authority for yaw recovery when airmode is not active.
|
// 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.
|
// When airmode is active the throttle setting doesn't impact recovery authority.
|
||||||
if (yawSpinDetected && !isAirmodeActive()) {
|
if (yawSpinDetected && !airmodeIsEnabled()) {
|
||||||
throttle = 0.5f; //
|
throttle = 0.5f; //
|
||||||
}
|
}
|
||||||
#endif // USE_YAW_SPIN_RECOVERY
|
#endif // USE_YAW_SPIN_RECOVERY
|
||||||
|
@ -835,11 +836,11 @@ FAST_CODE_NOINLINE void mixTable(timeUs_t currentTimeUs, uint8_t vbatPidCompensa
|
||||||
motorMix[i] /= motorMixRange;
|
motorMix[i] /= motorMixRange;
|
||||||
}
|
}
|
||||||
// Get the maximum correction by setting offset to center when airmode enabled
|
// Get the maximum correction by setting offset to center when airmode enabled
|
||||||
if (isAirmodeActive()) {
|
if (airmodeIsEnabled()) {
|
||||||
throttle = 0.5f;
|
throttle = 0.5f;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isAirmodeActive() || throttle > 0.5f) { // Only automatically adjust throttle when airmode enabled. Airmode logic is always active on high throttle
|
if (airmodeIsEnabled() || throttle > 0.5f) { // Only automatically adjust throttle when airmode enabled. Airmode logic is always active on high throttle
|
||||||
const float throttleLimitOffset = motorMixRange / 2.0f;
|
const float throttleLimitOffset = motorMixRange / 2.0f;
|
||||||
throttle = constrainf(throttle, 0.0f + throttleLimitOffset, 1.0f - throttleLimitOffset);
|
throttle = constrainf(throttle, 0.0f + throttleLimitOffset, 1.0f - throttleLimitOffset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -637,7 +637,7 @@ static bool osdDrawSingleElement(uint8_t item)
|
||||||
strcpy(buff, "HOR ");
|
strcpy(buff, "HOR ");
|
||||||
} else if (IS_RC_MODE_ACTIVE(BOXACROTRAINER)) {
|
} else if (IS_RC_MODE_ACTIVE(BOXACROTRAINER)) {
|
||||||
strcpy(buff, "ATRN");
|
strcpy(buff, "ATRN");
|
||||||
} else if (isAirmodeActive()) {
|
} else if (airmodeIsEnabled()) {
|
||||||
strcpy(buff, "AIR ");
|
strcpy(buff, "AIR ");
|
||||||
} else {
|
} else {
|
||||||
strcpy(buff, "ACRO");
|
strcpy(buff, "ACRO");
|
||||||
|
|
|
@ -268,7 +268,7 @@ void crsfFrameFlightMode(sbuf_t *dst)
|
||||||
|
|
||||||
// use same logic as OSD, so telemetry displays same flight text as OSD
|
// use same logic as OSD, so telemetry displays same flight text as OSD
|
||||||
const char *flightMode = "ACRO";
|
const char *flightMode = "ACRO";
|
||||||
if (isAirmodeActive()) {
|
if (airmodeIsEnabled()) {
|
||||||
flightMode = "AIR";
|
flightMode = "AIR";
|
||||||
}
|
}
|
||||||
if (FLIGHT_MODE(FAILSAFE_MODE)) {
|
if (FLIGHT_MODE(FAILSAFE_MODE)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue