mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 03:50:02 +03:00
Merge pull request #7254 from TonyBlit/gps_crosstrack_checks
Sanity checks flyaway/stalled only done in crosstrack phase
This commit is contained in:
commit
27dda737ad
1 changed files with 10 additions and 8 deletions
|
@ -353,17 +353,19 @@ static void performSanityChecks()
|
||||||
|
|
||||||
previousTimeUs = currentTimeUs;
|
previousTimeUs = currentTimeUs;
|
||||||
|
|
||||||
secondsStalled = constrain(secondsStalled + ((rescueState.sensor.groundSpeed < 150) ? 1 : -1), 0, 20);
|
if (rescueState.phase == RESCUE_CROSSTRACK) {
|
||||||
|
secondsStalled = constrain(secondsStalled + ((rescueState.sensor.groundSpeed < 150) ? 1 : -1), 0, 20);
|
||||||
|
|
||||||
if (secondsStalled == 20) {
|
if (secondsStalled == 20) {
|
||||||
rescueState.failure = RESCUE_STALLED;
|
rescueState.failure = RESCUE_STALLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
secondsFlyingAway = constrain(secondsFlyingAway + ((lastDistanceToHomeM < rescueState.sensor.distanceToHomeM) ? 1 : -1), 0, 10);
|
secondsFlyingAway = constrain(secondsFlyingAway + ((lastDistanceToHomeM < rescueState.sensor.distanceToHomeM) ? 1 : -1), 0, 10);
|
||||||
lastDistanceToHomeM = rescueState.sensor.distanceToHomeM;
|
lastDistanceToHomeM = rescueState.sensor.distanceToHomeM;
|
||||||
|
|
||||||
if (secondsFlyingAway == 10) {
|
if (secondsFlyingAway == 10) {
|
||||||
rescueState.failure = RESCUE_FLYAWAY;
|
rescueState.failure = RESCUE_FLYAWAY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
secondsLowSats = constrain(secondsLowSats + ((rescueState.sensor.numSat < gpsRescueConfig()->minSats) ? 1 : -1), 0, 10);
|
secondsLowSats = constrain(secondsLowSats + ((rescueState.sensor.numSat < gpsRescueConfig()->minSats) ? 1 : -1), 0, 10);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue