Add gps rescue altitude mode to CMS (#8318)

Add gps rescue altitude mode to CMS
This commit is contained in:
Michael Keller 2019-05-23 23:28:09 +12:00 committed by GitHub
commit e54ef4815a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -356,7 +356,7 @@ static const char * const lookupTableThrottleLimitType[] = {
static const char * const lookupTableRescueSanityType[] = {
"RESCUE_SANITY_OFF", "RESCUE_SANITY_ON", "RESCUE_SANITY_FS_ONLY"
};
static const char * const lookupTableRescueAltitudeMode[] = {
const char * const lookupTableRescueAltitudeMode[] = {
"MAX_ALT", "FIXED_ALT", "CURRENT_ALT"
};
#endif

View File

@ -242,3 +242,5 @@ extern const char * const lookupTableMagHardware[];
extern const char * const lookupTableRangefinderHardware[];
extern const char * const lookupTableLedstripColors[];
extern const char * const lookupTableRescueAltitudeMode[];

View File

@ -27,6 +27,8 @@
#ifdef USE_CMS_GPS_RESCUE_MENU
#include "cli/settings.h"
#include "cms/cms.h"
#include "cms/cms_types.h"
#include "cms/cms_menu_gps_rescue.h"
@ -53,6 +55,7 @@ static uint16_t gpsRescueConfig_velP, gpsRescueConfig_velI, gpsRescueConfig_velD
static uint16_t gpsRescueConfig_yawP;
static uint16_t gpsRescueConfig_targetLandingAltitudeM;
static uint16_t gpsRescueConfig_targetLandingDistanceM;
static uint8_t gpsRescueConfig_altitudeMode;
static long cms_menuGpsRescuePidOnEnter(void)
{
@ -130,6 +133,7 @@ static long cmsx_menuGpsRescueOnEnter(void)
gpsRescueConfig_allowArmingWithoutFix = gpsRescueConfig()->allowArmingWithoutFix;
gpsRescueConfig_targetLandingDistanceM = gpsRescueConfig()->targetLandingDistanceM;
gpsRescueConfig_targetLandingAltitudeM = gpsRescueConfig()->targetLandingAltitudeM;
gpsRescueConfig_altitudeMode = gpsRescueConfig()->altitudeMode;
return 0;
}
@ -151,7 +155,7 @@ static long cmsx_menuGpsRescueOnExit(const OSD_Entry *self)
gpsRescueConfigMutable()->allowArmingWithoutFix = gpsRescueConfig_allowArmingWithoutFix;
gpsRescueConfigMutable()->targetLandingDistanceM = gpsRescueConfig_targetLandingDistanceM;
gpsRescueConfigMutable()->targetLandingAltitudeM = gpsRescueConfig_targetLandingAltitudeM;
gpsRescueConfigMutable()->altitudeMode = gpsRescueConfig_altitudeMode;
return 0;
}
@ -162,16 +166,17 @@ const OSD_Entry cmsx_menuGpsRescueEntries[] =
{ "ANGLE", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_angle, 0, 200 ,1 }, 0 },
{ "MIN DIST HOME M", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_minRescueDth, 50, 1000 ,1 }, 0 },
{ "INITAL ALT M", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_initialAltitudeM, 20, 100, 1 }, 0 },
{ "ALTITUDE MODE" , OME_TAB, NULL, &(OSD_TAB_t) { &gpsRescueConfig_altitudeMode, 2, lookupTableRescueAltitudeMode}, 0 },
{ "DESCENT DIST M", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_descentDistanceM, 30, 500, 1 }, 0 },
{ "LANDING ALT M", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_targetLandingAltitudeM, 3, 10, 1 }, 0 },
{ "LANDING DIST M", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_targetLandingDistanceM, 5, 15, 1 }, 0 },
{ "GROUND SPEED C/M", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_rescueGroundspeed, 30, 3000, 1 }, 0 },
{ "GROUND SPEED CM/S", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_rescueGroundspeed, 30, 3000, 1 }, 0 },
{ "THROTTLE MIN", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_throttleMin, 1000, 2000, 1 }, 0 },
{ "THROTTLE MAX", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_throttleMax, 1000, 2000, 1 }, 0 },
{ "THROTTLE HOV", OME_UINT16, NULL, &(OSD_UINT16_t){ &gpsRescueConfig_throttleHover, 1000, 2000, 1 }, 0 },
{ "ARM WITHOUT FIX", OME_Bool, NULL, &gpsRescueConfig_allowArmingWithoutFix, 0 },
{ "MIN SATELITES", OME_UINT8, NULL, &(OSD_UINT8_t){ &gpsRescueConfig_minSats, 5, 50, 1 }, 0 },
{ "GPS RESCUE PID", OME_Submenu, cmsMenuChange, &cms_menuGpsRescuePid, 0},
{ "GPS RESCUE PID", OME_Submenu, cmsMenuChange, &cms_menuGpsRescuePid, 0},
{"BACK", OME_Back, NULL, NULL, 0},
{NULL, OME_END, NULL, NULL, 0}