Skip to content

Commit

Permalink
Add OSD item to show heading correction to go home
Browse files Browse the repository at this point in the history
  • Loading branch information
shellixyz committed Jun 21, 2018
1 parent 406e1dc commit 576cd86
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/cms/cms_menu_osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ static const OSD_Entry menuOsdElemsEntries[] =
OSD_ELEMENT_ENTRY("BATT % REM", OSD_BATTERY_REMAINING_PERCENT),
#ifdef USE_GPS
OSD_ELEMENT_ENTRY("HOME DIR", OSD_HOME_DIR),
OSD_ELEMENT_ENTRY("HOME HEAD. ERR", OSD_HOME_HEADING_ERROR),
OSD_ELEMENT_ENTRY("HOME DIST", OSD_HOME_DIST),
OSD_ELEMENT_ENTRY("TRIP DIST", OSD_TRIP_DIST),
OSD_ELEMENT_ENTRY("GPS SPEED", OSD_GPS_SPEED),
Expand Down
11 changes: 11 additions & 0 deletions src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,17 @@ static bool osdDrawSingleElement(uint8_t item)
break;
}

case OSD_HOME_HEADING_ERROR:
{
buff[0] = SYM_HOME;
buff[1] = SYM_HEADING;
int16_t h = lrintf(CENTIDEGREES_TO_DEGREES((float)wrap_18000(DEGREES_TO_CENTIDEGREES((int32_t)GPS_directionToHome) - DECIDEGREES_TO_CENTIDEGREES((int32_t)osdGetHeading()))));
tfp_sprintf(buff + 2, "%4d", h);
buff[6] = SYM_DEGREES;
buff[7] = '\0';
break;
}

case OSD_HOME_DIST:
{
buff[0] = SYM_HOME;
Expand Down
1 change: 1 addition & 0 deletions src/main/io/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ typedef enum {
OSD_MAIN_BATT_SAG_COMPENSATED_CELL_VOLTAGE,
OSD_REMAINING_FLIGHT_TIME_BEFORE_RTH,
OSD_REMAINING_DISTANCE_BEFORE_RTH,
OSD_HOME_HEADING_ERROR,
OSD_ITEM_COUNT // MUST BE LAST
} osd_items_e;

Expand Down

0 comments on commit 576cd86

Please sign in to comment.