Skip to content

Commit

Permalink
Update osd.c
Browse files Browse the repository at this point in the history
  • Loading branch information
breadoven committed Jun 7, 2021
1 parent 324bd8f commit 2baeb7a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,21 +1380,20 @@ static void osdDisplayAdjustableDecimalValue(uint8_t elemPosX, uint8_t elemPosY,
int8_t getGeoWaypointNumber(int8_t waypointIndex)
{
static int8_t lastWaypointIndex = 1;
static int8_t lastGeoWaypointIndex;
static int8_t geoWaypointIndex;

if (waypointIndex != lastWaypointIndex) {
lastWaypointIndex = waypointIndex;
lastGeoWaypointIndex = waypointIndex;
lastWaypointIndex = geoWaypointIndex = waypointIndex;
for (uint8_t i = 0; i <= waypointIndex; i++) {
if (posControl.waypointList[i].action == NAV_WP_ACTION_SET_POI ||
posControl.waypointList[i].action == NAV_WP_ACTION_SET_HEAD ||
posControl.waypointList[i].action == NAV_WP_ACTION_JUMP) {
lastGeoWaypointIndex -= 1;
geoWaypointIndex -= 1;
}
}
}

return lastGeoWaypointIndex + 1;
return geoWaypointIndex + 1;
}

static bool osdDrawSingleElement(uint8_t item)
Expand Down Expand Up @@ -2371,7 +2370,7 @@ static bool osdDrawSingleElement(uint8_t item)
tfp_sprintf(buff, "%s%c%c", buff, SYM_MAH_MI_0, SYM_MAH_MI_1);
} else {
tfp_sprintf(buff, "%s%c", buff, SYM_AH_MI);
}
}
if (!efficiencyValid) {
buff[0] = buff[1] = buff[2] = '-';
buff[3] = SYM_MAH_MI_0;
Expand All @@ -2385,7 +2384,7 @@ static bool osdDrawSingleElement(uint8_t item)
tfp_sprintf(buff, "%s%c%c", buff, SYM_MAH_KM_0, SYM_MAH_KM_1);
} else {
tfp_sprintf(buff, "%s%c", buff, SYM_AH_KM);
}
}
if (!efficiencyValid) {
buff[0] = buff[1] = buff[2] = '-';
buff[3] = SYM_MAH_KM_0;
Expand Down

0 comments on commit 2baeb7a

Please sign in to comment.