1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 09:45:33 +03:00

Merge pull request #8723 from breadoven/abo_osd_home_direction_fix

Fixed wing OSD home heading arrow and error fix
This commit is contained in:
Paweł Spychalski 2023-01-21 16:35:14 +01:00 committed by GitHub
commit ab50513ef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1769,7 +1769,8 @@ static bool osdDrawSingleElement(uint8_t item)
if (!(osdConfig()->pan_servo_pwm2centideg == 0)){
panHomeDirOffset = osdPanServoHomeDirectionOffset();
}
int homeDirection = GPS_directionToHome - DECIDEGREES_TO_DEGREES(osdGetHeading()) + panHomeDirOffset;
int16_t flightDirection = STATE(AIRPLANE) ? CENTIDEGREES_TO_DEGREES(posControl.actualState.cog) : DECIDEGREES_TO_DEGREES(osdGetHeading());
int homeDirection = GPS_directionToHome - flightDirection + panHomeDirOffset;
osdDrawDirArrow(osdDisplayPort, osdGetDisplayPortCanvas(), OSD_DRAW_POINT_GRID(elemPosX, elemPosY), homeDirection);
}
} else {
@ -1789,7 +1790,7 @@ static bool osdDrawSingleElement(uint8_t item)
buff[1] = SYM_HEADING;
if (isImuHeadingValid() && navigationPositionEstimateIsHealthy()) {
int16_t h = lrintf(CENTIDEGREES_TO_DEGREES((float)wrap_18000(DEGREES_TO_CENTIDEGREES((int32_t)GPS_directionToHome) - DECIDEGREES_TO_CENTIDEGREES((int32_t)osdGetHeading()))));
int16_t h = lrintf(CENTIDEGREES_TO_DEGREES((float)wrap_18000(DEGREES_TO_CENTIDEGREES((int32_t)GPS_directionToHome) - (STATE(AIRPLANE) ? posControl.actualState.cog : DECIDEGREES_TO_CENTIDEGREES((int32_t)osdGetHeading())))));
tfp_sprintf(buff + 2, "%4d", h);
} else {
strcpy(buff + 2, "----");