Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4832,6 +4832,16 @@ To vertically adjust the whole OSD and AHI and scrolling bars

---

### osd_hud_flight_direction

To 3D-display the moving destination direction in the hud

| Default | Min | Max |
| --- | --- | --- |
| OFF | OFF | ON |

---

### osd_hud_homepoint

To 3D-display the home point location in the hud
Expand Down
1 change: 1 addition & 0 deletions src/main/cms/cms_menu_osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ static const OSD_Entry menuOsdHud2Entries[] = {

OSD_SETTING_ENTRY("HOMING ARROWS", SETTING_OSD_HUD_HOMING),
OSD_SETTING_ENTRY("HOME POINT", SETTING_OSD_HUD_HOMEPOINT),
OSD_SETTING_ENTRY("FLIGHT DIRECTION", SETTING_OSD_HUD_FLIGHT_DIRECTION),
OSD_SETTING_ENTRY("RADAR MAX AIRCRAFT", SETTING_OSD_HUD_RADAR_DISP),
OSD_SETTING_ENTRY("RADAR MIN RANGE", SETTING_OSD_HUD_RADAR_RANGE_MIN),
OSD_SETTING_ENTRY("RADAR MAX RANGE", SETTING_OSD_HUD_RADAR_RANGE_MAX),
Expand Down
5 changes: 5 additions & 0 deletions src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3512,6 +3512,11 @@ groups:
default_value: OFF
field: hud_homepoint
type: bool
- name: osd_hud_flight_direction
description: "To 3D-display the moving destination direction in the hud"
default_value: OFF
field: hud_flight_direction
type: bool
- name: osd_hud_radar_disp
description: "Maximum count of nearby aircrafts or points of interest to display in the hud, as sent from an ESP32 LoRa module. Set to 0 to disable (show nothing). The nearby aircrafts will appear as markers A, B, C, etc"
default_value: 0
Expand Down
15 changes: 14 additions & 1 deletion src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2754,7 +2754,7 @@ static bool osdDrawSingleElement(uint8_t item)
#endif
) && isImuHeadingValid()) {

if (osdConfig()->hud_homepoint || osdConfig()->hud_radar_disp > 0 || osdConfig()->hud_wp_disp > 0) {
if (osdConfig()->hud_homepoint || osdConfig()->hud_radar_disp > 0 || osdConfig()->hud_wp_disp > 0 || osdConfig()->hud_flight_direction) {
osdHudClear();
}

Expand All @@ -2764,6 +2764,18 @@ static bool osdDrawSingleElement(uint8_t item)
osdHudDrawPoi(GPS_distanceToHome, GPS_directionToHome, -osdGetAltitude() / 100, 0, SYM_HOME, 0 , 0);
}

// -------- POI : Flight direction

if (osdConfig()->hud_flight_direction) {
int vx = getEstimatedActualVelocity(X); // in cm/s
int vy = getEstimatedActualVelocity(Y); // in cm/s
int vz = getEstimatedActualVelocity(Z); // in cm/s

float direction_deg = RADIANS_TO_DEGREES(atan2f((float)vy, (float)vx));
int altitude_relative = (vz / 100);
osdHudDrawPoi(1, (int16_t)direction_deg, altitude_relative, 3, SYM_ALERT, 0, 0);
}

// -------- POI : Nearby aircrafts from ESP32 radar

if (osdConfig()->hud_radar_disp > 0) { // Display the POI from the radar
Expand Down Expand Up @@ -4143,6 +4155,7 @@ PG_RESET_TEMPLATE(osdConfig_t, osdConfig,
.hud_margin_v = SETTING_OSD_HUD_MARGIN_V_DEFAULT,
.hud_homing = SETTING_OSD_HUD_HOMING_DEFAULT,
.hud_homepoint = SETTING_OSD_HUD_HOMEPOINT_DEFAULT,
.hud_flight_direction = SETTING_OSD_HUD_FLIGHT_DIRECTION_DEFAULT,
.hud_radar_disp = SETTING_OSD_HUD_RADAR_DISP_DEFAULT,
.hud_radar_range_min = SETTING_OSD_HUD_RADAR_RANGE_MIN_DEFAULT,
.hud_radar_range_max = SETTING_OSD_HUD_RADAR_RANGE_MAX_DEFAULT,
Expand Down
1 change: 1 addition & 0 deletions src/main/io/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ typedef struct osdConfig_s {
uint8_t hud_margin_v;
bool hud_homing;
bool hud_homepoint;
bool hud_flight_direction;
uint8_t hud_radar_disp;
uint16_t hud_radar_range_min;
uint16_t hud_radar_range_max;
Expand Down
15 changes: 9 additions & 6 deletions src/main/io/osd_hud.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ int8_t radarGetNearestPOI(void)
* Type = 0 : Home point
* Type = 1 : Radar POI, P1: Relative heading, P2: Signal, P3 Cardinal direction
* Type = 2 : Waypoint, P1: WP number, P2: 1=WP+1, 2=WP+2, 3=WP+3
* Type = 3 : Flight direction
*/
void osdHudDrawPoi(uint32_t poiDistance, int16_t poiDirection, int32_t poiAltitude, uint8_t poiType, uint16_t poiSymbol, int16_t poiP1, int16_t poiP2)
{
Expand Down Expand Up @@ -217,7 +218,7 @@ void osdHudDrawPoi(uint32_t poiDistance, int16_t poiDirection, int32_t poiAltitu

// Distance

if (poiType > 0 &&
if (poiType > 0 && poiType != 3 &&
((millis() / 1000) % (osdConfig()->hud_radar_alt_difference_display_time + osdConfig()->hud_radar_distance_display_time) < (osdConfig()->hud_radar_alt_difference_display_time % (osdConfig()->hud_radar_alt_difference_display_time + osdConfig()->hud_radar_distance_display_time)))
) { // For Radar and WPs, display the difference in altitude, then distance. Time is pilot defined
altc = poiAltitude;
Expand Down Expand Up @@ -287,11 +288,13 @@ void osdHudDrawPoi(uint32_t poiDistance, int16_t poiDirection, int32_t poiAltitu
}
}

osdHudWrite(poi_x - 1, poi_y + 1, buff[0], 1);
osdHudWrite(poi_x , poi_y + 1, buff[1], 1);
osdHudWrite(poi_x + 1, poi_y + 1, buff[2], 1);
if (poiType == 1) {
osdHudWrite(poi_x + 2, poi_y + 1, buff[3], 1);
if (poiType != 3){
osdHudWrite(poi_x - 1, poi_y + 1, buff[0], 1);
osdHudWrite(poi_x , poi_y + 1, buff[1], 1);
osdHudWrite(poi_x + 1, poi_y + 1, buff[2], 1);
if (poiType == 1) {
osdHudWrite(poi_x + 2, poi_y + 1, buff[3], 1);
}
}
}

Expand Down
Loading