mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
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:
parent
09e8234117
commit
741674c759
1 changed files with 5 additions and 5 deletions
|
@ -192,7 +192,6 @@ bool magForceDisable = false;
|
||||||
static bool newGPSData = false;
|
static bool newGPSData = false;
|
||||||
|
|
||||||
rescueState_s rescueState;
|
rescueState_s rescueState;
|
||||||
altitudeMode_e altitudeMode;
|
|
||||||
throttle_s throttle;
|
throttle_s throttle;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -602,16 +601,17 @@ void updateGPSRescueState(void)
|
||||||
newDescentDistanceM = gpsRescueConfig()->descentDistanceM;
|
newDescentDistanceM = gpsRescueConfig()->descentDistanceM;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (altitudeMode) {
|
switch (gpsRescueConfig()->altitudeMode) {
|
||||||
case MAX_ALT:
|
|
||||||
newAltitude = MAX(gpsRescueConfig()->initialAltitudeM * 100, rescueState.sensor.maxAltitudeCm + 1500);
|
|
||||||
break;
|
|
||||||
case FIXED_ALT:
|
case FIXED_ALT:
|
||||||
newAltitude = gpsRescueConfig()->initialAltitudeM * 100;
|
newAltitude = gpsRescueConfig()->initialAltitudeM * 100;
|
||||||
break;
|
break;
|
||||||
case CURRENT_ALT:
|
case CURRENT_ALT:
|
||||||
newAltitude = rescueState.sensor.currentAltitudeCm;
|
newAltitude = rescueState.sensor.currentAltitudeCm;
|
||||||
break;
|
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
|
//Calculate angular coefficient and offset for equation of line from 2 points needed for RESCUE_LANDING_APPROACH
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue