1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-13 11:29:56 +03:00
This commit is contained in:
druckgott 2025-07-12 13:48:14 +03:00 committed by GitHub
commit 94a956f875
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 7 deletions

View file

@ -4862,6 +4862,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

View file

@ -422,6 +422,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),

View file

@ -3529,6 +3529,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

View file

@ -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();
}
@ -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
@ -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,

View file

@ -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;

View file

@ -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)
{
@ -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;
@ -287,12 +288,14 @@ void osdHudDrawPoi(uint32_t poiDistance, int16_t poiDirection, int32_t poiAltitu
}
}
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);
}
}
}
/*