mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 01:05:21 +03:00
Merge pull request #6939 from iNavFlight/avs-glide-slope-osd
Glideslope OSD element
This commit is contained in:
commit
6e180aaa3e
3 changed files with 24 additions and 1 deletions
|
@ -109,7 +109,7 @@
|
|||
|
||||
#define SYM_AH_CH_CENTER 0x7E // 126 Crossair center
|
||||
|
||||
// 0x7F // 127 -
|
||||
#define SYM_GLIDESLOPE 0x7F // 127 Glideslope
|
||||
|
||||
#define SYM_AH_H_START 0x80 // 128 to 136 Horizontal AHI
|
||||
|
||||
|
|
|
@ -1514,6 +1514,27 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
break;
|
||||
}
|
||||
|
||||
case OSD_GLIDESLOPE:
|
||||
{
|
||||
float horizontalSpeed = gpsSol.groundSpeed;
|
||||
float sinkRate = -getEstimatedActualVelocity(Z);
|
||||
static pt1Filter_t gsFilterState;
|
||||
const timeMs_t currentTimeMs = millis();
|
||||
static timeMs_t gsUpdatedTimeMs;
|
||||
float glideSlope = horizontalSpeed / sinkRate;
|
||||
glideSlope = pt1FilterApply4(&gsFilterState, isnormal(glideSlope) ? glideSlope : 200, 0.5, MS2S(currentTimeMs - gsUpdatedTimeMs));
|
||||
gsUpdatedTimeMs = currentTimeMs;
|
||||
|
||||
buff[0] = SYM_GLIDESLOPE;
|
||||
if (glideSlope > 0.0f && glideSlope < 100.0f) {
|
||||
osdFormatCentiNumber(buff + 1, glideSlope * 100.0f, 0, 2, 0, 3);
|
||||
} else {
|
||||
buff[1] = buff[2] = buff[3] = '-';
|
||||
}
|
||||
buff[4] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
case OSD_GPS_LAT:
|
||||
osdFormatCoordinate(buff, SYM_LAT, gpsSol.llh.lat);
|
||||
break;
|
||||
|
@ -2981,6 +3002,7 @@ void pgResetFn_osdLayoutsConfig(osdLayoutsConfig_t *osdLayoutsConfig)
|
|||
osdLayoutsConfig->item_pos[0][OSD_MAIN_BATT_SAG_COMPENSATED_CELL_VOLTAGE] = OSD_POS(12, 1);
|
||||
osdLayoutsConfig->item_pos[0][OSD_GPS_SPEED] = OSD_POS(23, 1);
|
||||
osdLayoutsConfig->item_pos[0][OSD_3D_SPEED] = OSD_POS(23, 1);
|
||||
osdLayoutsConfig->item_pos[0][OSD_GLIDESLOPE] = OSD_POS(23, 2);
|
||||
|
||||
osdLayoutsConfig->item_pos[0][OSD_THROTTLE_POS] = OSD_POS(1, 2) | OSD_VISIBLE_FLAG;
|
||||
osdLayoutsConfig->item_pos[0][OSD_THROTTLE_POS_AUTO_THR] = OSD_POS(6, 2);
|
||||
|
|
|
@ -231,6 +231,7 @@ typedef enum {
|
|||
OSD_PLIMIT_REMAINING_BURST_TIME,
|
||||
OSD_PLIMIT_ACTIVE_CURRENT_LIMIT,
|
||||
OSD_PLIMIT_ACTIVE_POWER_LIMIT,
|
||||
OSD_GLIDESLOPE,
|
||||
OSD_ITEM_COUNT // MUST BE LAST
|
||||
} osd_items_e;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue