mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-19 14:25:16 +03:00
Merge pull request #4120 from OlivierC-FR/oc_altitude_msl
Adding altitude / sea (from GPS MSL)
This commit is contained in:
commit
bcc897e60d
3 changed files with 22 additions and 2 deletions
|
@ -198,6 +198,7 @@ static const OSD_Entry menuOsdElemsEntries[] =
|
|||
OSD_ELEMENT_ENTRY("VARIO NUM", OSD_VARIO_NUM),
|
||||
#endif // defined
|
||||
OSD_ELEMENT_ENTRY("ALTITUDE", OSD_ALTITUDE),
|
||||
OSD_ELEMENT_ENTRY("ALTITUDE MSL", OSD_ALTITUDE_MSL),
|
||||
#if defined(USE_PITOT)
|
||||
OSD_ELEMENT_ENTRY("AIR SPEED", OSD_AIR_SPEED),
|
||||
#endif
|
||||
|
|
|
@ -821,6 +821,17 @@ static inline int32_t osdGetAltitude(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline int32_t osdGetAltitudeMsl(void)
|
||||
{
|
||||
#if defined(USE_NAV)
|
||||
return getEstimatedActualPosition(Z)+GPS_home.alt;
|
||||
#elif defined(USE_BARO)
|
||||
return baro.alt+GPS_home.alt;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint8_t osdUpdateSidebar(osd_sidebar_scroll_e scroll, osd_sidebar_t *sidebar, timeMs_t currentTimeMs)
|
||||
{
|
||||
// Scroll between SYM_AH_DECORATION_MIN and SYM_AH_DECORATION_MAX.
|
||||
|
@ -1442,6 +1453,13 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
break;
|
||||
}
|
||||
|
||||
case OSD_ALTITUDE_MSL:
|
||||
{
|
||||
int32_t alt = osdGetAltitudeMsl();
|
||||
osdFormatAltitudeSymbol(buff, alt);
|
||||
break;
|
||||
}
|
||||
|
||||
case OSD_ONTIME:
|
||||
{
|
||||
osdFormatOnTime(buff);
|
||||
|
|
|
@ -121,8 +121,9 @@ typedef enum {
|
|||
OSD_MC_VEL_Y_PID_OUTPUTS,
|
||||
OSD_MC_VEL_Z_PID_OUTPUTS,
|
||||
OSD_MC_POS_XYZ_P_OUTPUTS,
|
||||
OSD_3D_SPEED,
|
||||
OSD_TEMPERATURE,
|
||||
OSD_3D_SPEED, // 85
|
||||
OSD_TEMPERATURE, // 86
|
||||
OSD_ALTITUDE_MSL, // 87
|
||||
OSD_ITEM_COUNT // MUST BE LAST
|
||||
} osd_items_e;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue