1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +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:
ctzsnooze 2024-10-12 21:51:40 +11:00
parent 5f4027e0c9
commit 2d9c9877ff
3 changed files with 5 additions and 6 deletions

View file

@ -770,7 +770,6 @@ uint8_t calculateThrottlePercentAbs(void)
}
static bool throttleRaised = false;
bool wasThrottleRaised(void)
{
return throttleRaised;
@ -1053,7 +1052,9 @@ void processRxModes(timeUs_t currentTimeUs)
// and we have Acc for self-levelling
&& sensors(SENSOR_ACC)
// and we have altitude data
&& isAltitudeAvailable()){
&& isAltitudeAvailable()
// prevent activation until after takeoff
&& wasThrottleRaised()) {
if (!FLIGHT_MODE(POS_HOLD_MODE)) {
ENABLE_FLIGHT_MODE(POS_HOLD_MODE);
}

View file

@ -930,10 +930,8 @@ static FAST_CODE_NOINLINE void disarmOnImpact(void)
if (wasThrottleRaised()
// and, either sticks are centred and throttle zeroed,
&& ((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
// 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)
#endif
)) {

View file

@ -93,7 +93,7 @@ extern "C" {
float getMotorMixRange(void) { return simulatedMotorMixRange; }
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]); }
// used by auto-disarm code