Skip to content

Commit

Permalink
Fixed minimum satellite detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeller committed Dec 22, 2018
1 parent db8a65a commit a262f91
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/main/flight/gps_rescue.c
Expand Up @@ -281,23 +281,23 @@ void performSanityChecks()
previousTimeUs = currentTimeUs;

if (rescueState.phase == RESCUE_CROSSTRACK) {
// Stalled movement detection
static int8_t gsI = 0;
// Stalled movement detection
static int8_t gsI = 0;

gsI = constrain(gsI + (rescueState.sensor.groundSpeed < 150) ? 1 : -1, -10, 10);
gsI = constrain(gsI + (rescueState.sensor.groundSpeed < 150) ? 1 : -1, -10, 10);

if (gsI == 10) {
rescueState.failure = RESCUE_CRASH_DETECTED;
}
if (gsI == 10) {
rescueState.failure = RESCUE_CRASH_DETECTED;
}
}

// Minimum sat detection
static int8_t msI = 0;
// Minimum sat detection
static int8_t msI = 0;

msI = constrain(msI + (rescueState.sensor.numSat < gpsRescueConfig()->minSats) ? 1 : -1, -5, 5);
msI = constrain(msI + (rescueState.sensor.numSat < gpsRescueConfig()->minSats) ? 1 : -1, -5, 5);

if (msI == 5) {
rescueState.failure = RESCUE_FLYAWAY;
}
if (msI == 5) {
rescueState.failure = RESCUE_FLYAWAY;
}
}

Expand Down

0 comments on commit a262f91

Please sign in to comment.