From 2baeb7acdaae531a73ba4dd3bf5930229affd49b Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Mon, 7 Jun 2021 09:36:10 +0100 Subject: [PATCH] Update osd.c --- src/main/io/osd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 3f6833bbf2b..5e8f16981c4 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -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) @@ -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; @@ -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;