Merge pull request #9900 from EggsBenedict/gps_rescue_altitude_buffer
This commit is contained in:
commit
7c50a3f364
|
@ -952,6 +952,7 @@ const clivalue_t valueTable[] = {
|
||||||
#ifdef USE_GPS_RESCUE
|
#ifdef USE_GPS_RESCUE
|
||||||
// PG_GPS_RESCUE
|
// PG_GPS_RESCUE
|
||||||
{ "gps_rescue_angle", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 200 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, angle) },
|
{ "gps_rescue_angle", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 200 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, angle) },
|
||||||
|
{ "gps_rescue_alt_buffer", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 100 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, rescueAltitudeBufferM) },
|
||||||
{ "gps_rescue_initial_alt", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 20, 100 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, initialAltitudeM) },
|
{ "gps_rescue_initial_alt", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 20, 100 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, initialAltitudeM) },
|
||||||
{ "gps_rescue_descent_dist", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 30, 500 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, descentDistanceM) },
|
{ "gps_rescue_descent_dist", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 30, 500 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, descentDistanceM) },
|
||||||
{ "gps_rescue_landing_alt", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 3, 10 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, targetLandingAltitudeM) },
|
{ "gps_rescue_landing_alt", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 3, 10 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, targetLandingAltitudeM) },
|
||||||
|
|
|
@ -177,6 +177,7 @@ PG_RESET_TEMPLATE(gpsRescueConfig_t, gpsRescueConfig,
|
||||||
.altitudeMode = MAX_ALT,
|
.altitudeMode = MAX_ALT,
|
||||||
.ascendRate = 500,
|
.ascendRate = 500,
|
||||||
.descendRate = 150,
|
.descendRate = 150,
|
||||||
|
.rescueAltitudeBufferM = 15,
|
||||||
);
|
);
|
||||||
|
|
||||||
static uint16_t rescueThrottle;
|
static uint16_t rescueThrottle;
|
||||||
|
@ -606,11 +607,11 @@ void updateGPSRescueState(void)
|
||||||
newAltitude = gpsRescueConfig()->initialAltitudeM * 100;
|
newAltitude = gpsRescueConfig()->initialAltitudeM * 100;
|
||||||
break;
|
break;
|
||||||
case CURRENT_ALT:
|
case CURRENT_ALT:
|
||||||
newAltitude = rescueState.sensor.currentAltitudeCm;
|
newAltitude = rescueState.sensor.currentAltitudeCm + gpsRescueConfig()->rescueAltitudeBufferM * 100;
|
||||||
break;
|
break;
|
||||||
case MAX_ALT:
|
case MAX_ALT:
|
||||||
default:
|
default:
|
||||||
newAltitude = MAX(gpsRescueConfig()->initialAltitudeM * 100, rescueState.sensor.maxAltitudeCm + 1500);
|
newAltitude = MAX(gpsRescueConfig()->initialAltitudeM * 100, rescueState.sensor.maxAltitudeCm + gpsRescueConfig()->rescueAltitudeBufferM * 100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,4 +747,3 @@ bool gpsRescueDisableMag(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ typedef struct gpsRescue_s {
|
||||||
uint8_t altitudeMode;
|
uint8_t altitudeMode;
|
||||||
uint16_t ascendRate;
|
uint16_t ascendRate;
|
||||||
uint16_t descendRate;
|
uint16_t descendRate;
|
||||||
|
uint16_t rescueAltitudeBufferM; //meters
|
||||||
} gpsRescueConfig_t;
|
} gpsRescueConfig_t;
|
||||||
|
|
||||||
PG_DECLARE(gpsRescueConfig_t, gpsRescueConfig);
|
PG_DECLARE(gpsRescueConfig_t, gpsRescueConfig);
|
||||||
|
|
Loading…
Reference in New Issue