Skip to content

Commit 78f5741

Browse files
committed
add extra function with only one symbol, invert vertical
1 parent 4208b46 commit 78f5741

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/main/io/osd.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2766,7 +2766,7 @@ static bool osdDrawSingleElement(uint8_t item)
27662766
#endif
27672767
) && isImuHeadingValid()) {
27682768

2769-
if (osdConfig()->hud_homepoint || osdConfig()->hud_radar_disp > 0 || osdConfig()->hud_wp_disp > 0) {
2769+
if (osdConfig()->hud_homepoint || osdConfig()->hud_radar_disp > 0 || osdConfig()->hud_wp_disp > 0 || osdConfig()->hud_flight_direction) {
27702770
osdHudClear();
27712771
}
27722772

@@ -2776,6 +2776,23 @@ static bool osdDrawSingleElement(uint8_t item)
27762776
osdHudDrawPoi(GPS_distanceToHome, GPS_directionToHome, -osdGetAltitude() / 100, 0, SYM_HOME, 0 , 0);
27772777
}
27782778

2779+
// -------- POI : Flight direction
2780+
2781+
if (osdConfig()->hud_flight_direction) {
2782+
int vx = getEstimatedActualVelocity(X); // in cm/s
2783+
int vy = getEstimatedActualVelocity(Y); // in cm/s
2784+
int vz = getEstimatedActualVelocity(Z); // in cm/s
2785+
2786+
// Nur Richtung anzeigen, keine Vorausschau mehr
2787+
float direction_deg = RADIANS_TO_DEGREES(atan2f((float)vy, (float)vx));
2788+
int altitude_relative = (vz / 100);
2789+
2790+
// Flugrichtung nur darstellen, wenn relevante Bewegung vorhanden ist
2791+
//osdHudDrawPoi(0, (int16_t)direction_deg, altitude_relative, 0, SYM_ALERT, 0, 0);
2792+
osdHudDrawDirection((int16_t)direction_deg, altitude_relative, SYM_ALERT);
2793+
2794+
}
2795+
27792796
// -------- POI : Nearby aircrafts from ESP32 radar
27802797

27812798
if (osdConfig()->hud_radar_disp > 0) { // Display the POI from the radar
@@ -4155,6 +4172,7 @@ PG_RESET_TEMPLATE(osdConfig_t, osdConfig,
41554172
.hud_margin_v = SETTING_OSD_HUD_MARGIN_V_DEFAULT,
41564173
.hud_homing = SETTING_OSD_HUD_HOMING_DEFAULT,
41574174
.hud_homepoint = SETTING_OSD_HUD_HOMEPOINT_DEFAULT,
4175+
.hud_flight_direction = SETTING_OSD_HUD_FLIGHT_DIRECTION_DEFAULT,
41584176
.hud_radar_disp = SETTING_OSD_HUD_RADAR_DISP_DEFAULT,
41594177
.hud_radar_range_min = SETTING_OSD_HUD_RADAR_RANGE_MIN_DEFAULT,
41604178
.hud_radar_range_max = SETTING_OSD_HUD_RADAR_RANGE_MAX_DEFAULT,

src/main/io/osd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ typedef struct osdConfig_s {
430430
uint8_t hud_margin_v;
431431
bool hud_homing;
432432
bool hud_homepoint;
433+
bool hud_flight_direction;
433434
uint8_t hud_radar_disp;
434435
uint16_t hud_radar_range_min;
435436
uint16_t hud_radar_range_max;

src/main/io/osd_hud.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ void osdHudDrawCrosshair(displayCanvas_t *canvas, uint8_t px, uint8_t py);
2828
void osdHudDrawHoming(uint8_t px, uint8_t py);
2929
void osdHudDrawDirection(int16_t poiDirection, int32_t poiAltitude, uint16_t poiSymbol);
3030
void osdHudDrawPoi(uint32_t poiDistance, int16_t poiDirection, int32_t poiAltitude, uint8_t poiType, uint16_t poiSymbol, int16_t poiP1, int16_t poiP2);
31+
void osdHudDrawDirection(int16_t poiDirection, int32_t poiAltitude, uint16_t poiSymbol);
3132
int8_t radarGetNearestPOI(void);

0 commit comments

Comments
 (0)