1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-19 22:35:19 +03:00

Change Index List

Change from using WP .P3 to dedicated geospatial WP list list array
This commit is contained in:
breadoven 2021-02-28 11:26:34 +00:00
parent 94e199ecd9
commit 36974174aa
3 changed files with 4 additions and 11 deletions

View file

@ -1385,11 +1385,7 @@ static void osdDisplayAdjustableDecimalValue(uint8_t elemPosX, uint8_t elemPosY,
int8_t getGeoWaypointNumber(int8_t waypointIndex) int8_t getGeoWaypointNumber(int8_t waypointIndex)
{ {
if (posControl.waypointList[waypointIndex].action == NAV_WP_ACTION_JUMP) { return posControl.geoWaypointList[waypointIndex];
return posControl.waypointList[waypointIndex - 1].p3;
} else {
return posControl.waypointList[waypointIndex].p3;
}
} }
static bool osdDrawSingleElement(uint8_t item) static bool osdDrawSingleElement(uint8_t item)

View file

@ -2837,17 +2837,13 @@ void setWaypoint(uint8_t wpNumber, const navWaypoint_t * wpData)
if (wpNumber == (posControl.waypointCount + 1) || wpNumber == 1) { if (wpNumber == (posControl.waypointCount + 1) || wpNumber == 1) {
posControl.waypointList[wpNumber - 1] = *wpData; posControl.waypointList[wpNumber - 1] = *wpData;
if(wpData->action == NAV_WP_ACTION_SET_POI || wpData->action == NAV_WP_ACTION_SET_HEAD || wpData->action == NAV_WP_ACTION_JUMP) { if(wpData->action == NAV_WP_ACTION_SET_POI || wpData->action == NAV_WP_ACTION_SET_HEAD || wpData->action == NAV_WP_ACTION_JUMP) {
nonGeoWaypointCount += 1; nonGeoWaypointCount += 1;
if(wpData->action == NAV_WP_ACTION_JUMP) { if(wpData->action == NAV_WP_ACTION_JUMP) {
posControl.waypointList[wpNumber - 1].p1 -= 1; // make index (vice WP #) posControl.waypointList[wpNumber - 1].p1 -= 1; // make index (vice WP #)
} else {
posControl.waypointList[wpNumber - 1].p3 = wpNumber - nonGeoWaypointCount;
} }
} else {
posControl.waypointList[wpNumber - 1].p3 = wpNumber - nonGeoWaypointCount;
} }
posControl.geoWaypointList[wpNumber - 1] = wpNumber - nonGeoWaypointCount;
posControl.waypointCount = wpNumber; posControl.waypointCount = wpNumber;
posControl.waypointListValid = (wpData->flag == NAV_WP_FLAG_LAST); posControl.waypointListValid = (wpData->flag == NAV_WP_FLAG_LAST);

View file

@ -356,7 +356,8 @@ typedef struct {
navWaypoint_t waypointList[NAV_MAX_WAYPOINTS]; navWaypoint_t waypointList[NAV_MAX_WAYPOINTS];
bool waypointListValid; bool waypointListValid;
int8_t waypointCount; int8_t waypointCount;
int8_t geoWaypointCount; // total geospatial WPs in mission int8_t geoWaypointCount; // total geospatial WPs in mission
int8_t geoWaypointList[NAV_MAX_WAYPOINTS]; // holds realigned geospacial WP numbering index
navWaypointPosition_t activeWaypoint; // Local position and initial bearing, filled on waypoint activation navWaypointPosition_t activeWaypoint; // Local position and initial bearing, filled on waypoint activation
int8_t activeWaypointIndex; int8_t activeWaypointIndex;