@@ -113,6 +113,46 @@ int8_t radarGetNearestPOI(void)
113113 return poi ;
114114}
115115
116+ void osdHudDrawDirection (int16_t poiDirection , int32_t poiAltitude , uint16_t poiSymbol )
117+ {
118+ int poi_x = -1 ;
119+ int poi_y = -1 ;
120+ uint8_t center_x , center_y ;
121+
122+ uint8_t minX = osdConfig ()-> hud_margin_h + 2 ;
123+ uint8_t maxX = osdGetDisplayPort ()-> cols - osdConfig ()-> hud_margin_h - 3 ;
124+ uint8_t minY = osdConfig ()-> hud_margin_v ;
125+ uint8_t maxY = osdGetDisplayPort ()-> rows - osdConfig ()-> hud_margin_v - 2 ;
126+
127+ osdCrosshairPosition (& center_x , & center_y );
128+
129+ if (osdConfig ()-> pan_servo_pwm2centideg != 0 ) {
130+ poiDirection += osdGetPanServoOffset ();
131+ }
132+
133+ int16_t error_x = hudWrap180 (poiDirection - DECIDEGREES_TO_DEGREES (osdGetHeading ()));
134+
135+ if ((error_x > - (osdConfig ()-> camera_fov_h / 2 )) && (error_x < osdConfig ()-> camera_fov_h / 2 )) {
136+ // Horizontalposition berechnen
137+ float scaled_x = sin_approx (DEGREES_TO_RADIANS (error_x )) / sin_approx (DEGREES_TO_RADIANS (osdConfig ()-> camera_fov_h / 2 ));
138+ poi_x = center_x + 15 * scaled_x ;
139+
140+ if (poi_x >= minX && poi_x <= maxX ) {
141+ // Vertikalposition berechnen
142+ float poi_angle = atan2_approx (- poiAltitude , 1.0f ); // Abstand fest auf 1
143+ poi_angle = RADIANS_TO_DEGREES (poi_angle );
144+ int16_t plane_angle = attitude .values .pitch / 10 ;
145+ int camera_angle = osdConfig ()-> camera_uptilt ;
146+ int16_t error_y = poi_angle - plane_angle + camera_angle ;
147+ float scaled_y = sin_approx (DEGREES_TO_RADIANS (error_y )) / sin_approx (DEGREES_TO_RADIANS (osdConfig ()-> camera_fov_v / 2 ));
148+ poi_y = constrain (center_y + (osdGetDisplayPort ()-> rows / 2 ) * scaled_y , minY , maxY - 1 );
149+
150+ // Symbol zeichnen
151+ osdHudWrite (poi_x , poi_y , poiSymbol , 1 );
152+ }
153+ }
154+ }
155+
116156/*
117157 * Display a POI as a 3D-marker on the hud
118158 * Distance (m), Direction (°), Altitude (relative, m, negative means below), Heading (°),
0 commit comments