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:
parent
94e199ecd9
commit
36974174aa
3 changed files with 4 additions and 11 deletions
|
@ -1385,11 +1385,7 @@ static void osdDisplayAdjustableDecimalValue(uint8_t elemPosX, uint8_t elemPosY,
|
|||
|
||||
int8_t getGeoWaypointNumber(int8_t waypointIndex)
|
||||
{
|
||||
if (posControl.waypointList[waypointIndex].action == NAV_WP_ACTION_JUMP) {
|
||||
return posControl.waypointList[waypointIndex - 1].p3;
|
||||
} else {
|
||||
return posControl.waypointList[waypointIndex].p3;
|
||||
}
|
||||
return posControl.geoWaypointList[waypointIndex];
|
||||
}
|
||||
|
||||
static bool osdDrawSingleElement(uint8_t item)
|
||||
|
|
|
@ -2837,17 +2837,13 @@ void setWaypoint(uint8_t wpNumber, const navWaypoint_t * wpData)
|
|||
|
||||
if (wpNumber == (posControl.waypointCount + 1) || wpNumber == 1) {
|
||||
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) {
|
||||
nonGeoWaypointCount += 1;
|
||||
if(wpData->action == NAV_WP_ACTION_JUMP) {
|
||||
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.waypointListValid = (wpData->flag == NAV_WP_FLAG_LAST);
|
||||
|
|
|
@ -357,6 +357,7 @@ typedef struct {
|
|||
bool waypointListValid;
|
||||
int8_t waypointCount;
|
||||
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
|
||||
int8_t activeWaypointIndex;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue