@@ -329,7 +329,7 @@ void osdDrawArtificialHorizonLine(displayCanvas_t *canvas, float pitchAngle, flo
329329 displayCanvasContextPop (canvas );
330330}
331331
332- static bool osdCanvasDrawArtificialHorizonWidget (displayPort_t * display , displayCanvas_t * canvas , const osdDrawPoint_t * p , float pitchAngle , float rollAngle )
332+ static bool osdCanvasDrawArtificialHorizonWidget (displayPort_t * display , displayCanvas_t * canvas , const osdDrawPoint_t * p , float pitchAngle , float rollAngle , bool isInverted )
333333{
334334 UNUSED (display );
335335 UNUSED (p );
@@ -345,7 +345,12 @@ static bool osdCanvasDrawArtificialHorizonWidget(displayPort_t *display, display
345345 int ahiWidth = osdConfig ()-> ahi_width ;
346346 int ahiX = (canvas -> width - ahiWidth ) / 2 ;
347347 int ahiHeight = osdConfig ()-> ahi_height ;
348- int ahiY = ((canvas -> height - ahiHeight ) / 2 ) + osdConfig ()-> ahi_vertical_offset ;
348+ int ahiY = ((canvas -> height - ahiHeight ) / 2 );
349+ if (isInverted )
350+ ahiY -= osdConfig ()-> ahi_vertical_offset ;
351+ else
352+ ahiY += osdConfig ()-> ahi_vertical_offset ;
353+
349354 if (ahiY < 0 ) {
350355 ahiY = 0 ;
351356 }
@@ -397,7 +402,7 @@ static bool osdCanvasDrawArtificialHorizonWidget(displayPort_t *display, display
397402 return false;
398403}
399404
400- void osdCanvasDrawArtificialHorizon (displayPort_t * display , displayCanvas_t * canvas , const osdDrawPoint_t * p , float pitchAngle , float rollAngle )
405+ void osdCanvasDrawArtificialHorizon (displayPort_t * display , displayCanvas_t * canvas , const osdDrawPoint_t * p , float pitchAngle , float rollAngle , bool isInverted )
401406{
402407 UNUSED (display );
403408 UNUSED (p );
@@ -412,7 +417,7 @@ void osdCanvasDrawArtificialHorizon(displayPort_t *display, displayCanvas_t *can
412417 float totalError = fabsf (prevPitchAngle - pitchAngle ) + fabsf (prevRollAngle - rollAngle );
413418 if ((now > nextDrawMinMs && totalError > 0.05f )|| now > nextDrawMaxMs ) {
414419
415- if (!osdCanvasDrawArtificialHorizonWidget (display , canvas , p , pitchAngle , rollAngle )) {
420+ if (!osdCanvasDrawArtificialHorizonWidget (display , canvas , p , pitchAngle , rollAngle , isInverted )) {
416421 switch ((osd_ahi_style_e )osdConfig ()-> ahi_style ) {
417422 case OSD_AHI_STYLE_DEFAULT :
418423 {
0 commit comments