mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Merge pull request #5172 from etracer65/runaway_takeoff_disable_benchtest
Runaway Takeoff Prevention - temporarily disable during configurator bench testing
This commit is contained in:
commit
b0ade55c95
3 changed files with 23 additions and 0 deletions
|
@ -127,6 +127,7 @@ static timeUs_t runawayTakeoffDeactivateUs = 0;
|
|||
static timeUs_t runawayTakeoffAccumulatedUs = 0;
|
||||
static bool runawayTakeoffCheckDisabled = false;
|
||||
static timeUs_t runawayTakeoffTriggerUs = 0;
|
||||
static bool runawayTakeoffTemporarilyDisabled = false;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -444,6 +445,14 @@ bool areSticksActive(uint8_t stickPercentLimit)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// allow temporarily disabling runaway takeoff prevention if we are connected
|
||||
// to the configurator and the ARMING_DISABLED_MSP flag is cleared.
|
||||
void runawayTakeoffTemporaryDisable(uint8_t disableFlag)
|
||||
{
|
||||
runawayTakeoffTemporarilyDisabled = disableFlag;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -530,6 +539,7 @@ bool processRx(timeUs_t currentTimeUs)
|
|||
&& pidConfig()->runaway_takeoff_prevention
|
||||
&& !runawayTakeoffCheckDisabled
|
||||
&& !flipOverAfterCrashMode
|
||||
&& !runawayTakeoffTemporarilyDisabled
|
||||
&& !STATE(FIXED_WING)) {
|
||||
|
||||
// Determine if we're in "flight"
|
||||
|
@ -767,6 +777,7 @@ static void subTaskPidController(timeUs_t currentTimeUs)
|
|||
&& pidConfig()->runaway_takeoff_prevention
|
||||
&& !runawayTakeoffCheckDisabled
|
||||
&& !flipOverAfterCrashMode
|
||||
&& !runawayTakeoffTemporarilyDisabled
|
||||
&& (!feature(FEATURE_MOTOR_STOP) || isAirmodeActive() || (calculateThrottleStatus() != THROTTLE_LOW))) {
|
||||
|
||||
const float runawayTakeoffThreshold = pidConfig()->runaway_takeoff_threshold * 10.0f;
|
||||
|
|
|
@ -48,3 +48,5 @@ void updateRcCommands(void);
|
|||
|
||||
void taskMainPidLoop(timeUs_t currentTimeUs);
|
||||
bool isFlipOverAfterCrashMode(void);
|
||||
|
||||
void runawayTakeoffTemporaryDisable(uint8_t disableFlag);
|
||||
|
|
|
@ -1777,13 +1777,23 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
case MSP_SET_ARMING_DISABLED:
|
||||
{
|
||||
const uint8_t command = sbufReadU8(src);
|
||||
uint8_t disableRunawayTakeoff = 0;
|
||||
if (sbufBytesRemaining(src)) {
|
||||
disableRunawayTakeoff = sbufReadU8(src);
|
||||
}
|
||||
if (command) {
|
||||
setArmingDisabled(ARMING_DISABLED_MSP);
|
||||
if (ARMING_FLAG(ARMED)) {
|
||||
disarm();
|
||||
}
|
||||
#ifdef USE_RUNAWAY_TAKEOFF
|
||||
runawayTakeoffTemporaryDisable(false);
|
||||
#endif
|
||||
} else {
|
||||
unsetArmingDisabled(ARMING_DISABLED_MSP);
|
||||
#ifdef USE_RUNAWAY_TAKEOFF
|
||||
runawayTakeoffTemporaryDisable(disableRunawayTakeoff);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue