mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
stop activation until throttle raised, but not require airmode
use wasThrottleRaised in place of isAirmodeActivated where airmode isn't really needed
This commit is contained in:
parent
5f4027e0c9
commit
2d9c9877ff
3 changed files with 5 additions and 6 deletions
|
@ -770,7 +770,6 @@ uint8_t calculateThrottlePercentAbs(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool throttleRaised = false;
|
static bool throttleRaised = false;
|
||||||
|
|
||||||
bool wasThrottleRaised(void)
|
bool wasThrottleRaised(void)
|
||||||
{
|
{
|
||||||
return throttleRaised;
|
return throttleRaised;
|
||||||
|
@ -1053,7 +1052,9 @@ void processRxModes(timeUs_t currentTimeUs)
|
||||||
// and we have Acc for self-levelling
|
// and we have Acc for self-levelling
|
||||||
&& sensors(SENSOR_ACC)
|
&& sensors(SENSOR_ACC)
|
||||||
// and we have altitude data
|
// and we have altitude data
|
||||||
&& isAltitudeAvailable()){
|
&& isAltitudeAvailable()
|
||||||
|
// prevent activation until after takeoff
|
||||||
|
&& wasThrottleRaised()) {
|
||||||
if (!FLIGHT_MODE(POS_HOLD_MODE)) {
|
if (!FLIGHT_MODE(POS_HOLD_MODE)) {
|
||||||
ENABLE_FLIGHT_MODE(POS_HOLD_MODE);
|
ENABLE_FLIGHT_MODE(POS_HOLD_MODE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -930,10 +930,8 @@ static FAST_CODE_NOINLINE void disarmOnImpact(void)
|
||||||
if (wasThrottleRaised()
|
if (wasThrottleRaised()
|
||||||
// and, either sticks are centred and throttle zeroed,
|
// and, either sticks are centred and throttle zeroed,
|
||||||
&& ((getMaxRcDeflectionAbs() < 0.05f && mixerGetRcThrottle() < 0.05f)
|
&& ((getMaxRcDeflectionAbs() < 0.05f && mixerGetRcThrottle() < 0.05f)
|
||||||
// we could test here for stage 2 failsafe (including both landing or GPS Rescue)
|
|
||||||
// this may permit removing the GPS Rescue disarm method altogether
|
|
||||||
#ifdef USE_ALT_HOLD_MODE
|
#ifdef USE_ALT_HOLD_MODE
|
||||||
// or in altitude hold mode, including failsafe landing mode, indirectly
|
// or, in altitude hold mode, where throttle can be non-zero
|
||||||
|| FLIGHT_MODE(ALT_HOLD_MODE)
|
|| FLIGHT_MODE(ALT_HOLD_MODE)
|
||||||
#endif
|
#endif
|
||||||
)) {
|
)) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ extern "C" {
|
||||||
|
|
||||||
float getMotorMixRange(void) { return simulatedMotorMixRange; }
|
float getMotorMixRange(void) { return simulatedMotorMixRange; }
|
||||||
float getSetpointRate(int axis) { return simulatedSetpointRate[axis]; }
|
float getSetpointRate(int axis) { return simulatedSetpointRate[axis]; }
|
||||||
bool wasThrottleRaised(void) { return simulatedThrottleRaised; }
|
bool wasThrottleRaised(void) { return simulatedAirmodeEnabled; }
|
||||||
float getRcDeflectionAbs(int axis) { return fabsf(simulatedRcDeflection[axis]); }
|
float getRcDeflectionAbs(int axis) { return fabsf(simulatedRcDeflection[axis]); }
|
||||||
|
|
||||||
// used by auto-disarm code
|
// used by auto-disarm code
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue