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)){ if (!(osdConfig()->pan_servo_pwm2centideg == 0)){
panHomeDirOffset = osdPanServoHomeDirectionOffset(); 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); osdDrawDirArrow(osdDisplayPort, osdGetDisplayPortCanvas(), OSD_DRAW_POINT_GRID(elemPosX, elemPosY), homeDirection);
} }
} else { } else {
@ -1789,7 +1790,7 @@ static bool osdDrawSingleElement(uint8_t item)
buff[1] = SYM_HEADING; buff[1] = SYM_HEADING;
if (isImuHeadingValid() && navigationPositionEstimateIsHealthy()) { 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); tfp_sprintf(buff + 2, "%4d", h);
} else { } else {
strcpy(buff + 2, "----"); strcpy(buff + 2, "----");
@ -3987,7 +3988,7 @@ static void osdShowStatsPage1(void)
displayWrite(osdDisplayPort, statNameX, top, "DISARMED BY :"); displayWrite(osdDisplayPort, statNameX, top, "DISARMED BY :");
displayWrite(osdDisplayPort, statValuesX, top++, disarmReasonStr[getDisarmReason()]); displayWrite(osdDisplayPort, statValuesX, top++, disarmReasonStr[getDisarmReason()]);
if (savingSettings == true) { if (savingSettings == true) {
displayWrite(osdDisplayPort, statNameX, top++, OSD_MESSAGE_STR(OSD_MSG_SAVING_SETTNGS)); displayWrite(osdDisplayPort, statNameX, top++, OSD_MESSAGE_STR(OSD_MSG_SAVING_SETTNGS));
} else if (notify_settings_saved > 0) { } else if (notify_settings_saved > 0) {
@ -3997,7 +3998,7 @@ static void osdShowStatsPage1(void)
displayWrite(osdDisplayPort, statNameX, top++, OSD_MESSAGE_STR(OSD_MSG_SETTINGS_SAVED)); displayWrite(osdDisplayPort, statNameX, top++, OSD_MESSAGE_STR(OSD_MSG_SETTINGS_SAVED));
} }
} }
displayCommitTransaction(osdDisplayPort); displayCommitTransaction(osdDisplayPort);
} }