Fix GPS Rescue altitude mode behavior

Fixed unassigned variable controlling the altitude mode. Unassigned value was defaulting to 0 forcing `MAX_ALT` mode at all times instead of the user setting.
This commit is contained in:
Bruce Luckcuck 2020-02-01 10:30:23 -05:00
parent 09e8234117
commit 741674c759
1 changed files with 5 additions and 5 deletions

View File

@ -192,7 +192,6 @@ bool magForceDisable = false;
static bool newGPSData = false;
rescueState_s rescueState;
altitudeMode_e altitudeMode;
throttle_s throttle;
/*
@ -602,16 +601,17 @@ void updateGPSRescueState(void)
newDescentDistanceM = gpsRescueConfig()->descentDistanceM;
}
switch (altitudeMode) {
case MAX_ALT:
newAltitude = MAX(gpsRescueConfig()->initialAltitudeM * 100, rescueState.sensor.maxAltitudeCm + 1500);
break;
switch (gpsRescueConfig()->altitudeMode) {
case FIXED_ALT:
newAltitude = gpsRescueConfig()->initialAltitudeM * 100;
break;
case CURRENT_ALT:
newAltitude = rescueState.sensor.currentAltitudeCm;
break;
case MAX_ALT:
default:
newAltitude = MAX(gpsRescueConfig()->initialAltitudeM * 100, rescueState.sensor.maxAltitudeCm + 1500);
break;
}
//Calculate angular coefficient and offset for equation of line from 2 points needed for RESCUE_LANDING_APPROACH