mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-17 13:25:27 +03:00
Update Method
Change from using WP.flag to WP.p3
This commit is contained in:
parent
1a104a8f2a
commit
ec693daeb6
2 changed files with 13 additions and 16 deletions
|
@ -1385,14 +1385,10 @@ static void osdDisplayAdjustableDecimalValue(uint8_t elemPosX, uint8_t elemPosY,
|
|||
|
||||
int8_t getGeoWaypointNumber(int8_t waypointIndex)
|
||||
{
|
||||
if (posControl.waypointList[waypointIndex].flag == NAV_WP_FLAG_LAST) {
|
||||
if ((posControl.waypointList[waypointIndex].action == NAV_WP_ACTION_JUMP || posControl.waypointList[waypointIndex].action == NAV_WP_ACTION_SET_POI || posControl.waypointList[waypointIndex].action == NAV_WP_ACTION_SET_HEAD)) {
|
||||
return posControl.waypointList[waypointIndex - 1].flag;
|
||||
return posControl.waypointList[waypointIndex - 1].p3;
|
||||
} else {
|
||||
return posControl.waypointList[waypointIndex - 1].flag + 1;
|
||||
}
|
||||
} else {
|
||||
return posControl.waypointList[waypointIndex].flag;
|
||||
return posControl.waypointList[waypointIndex].p3;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2837,20 +2837,21 @@ 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_JUMP) {
|
||||
|
||||
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_JUMP) {
|
||||
posControl.waypointList[wpNumber - 1].p1 -= 1; // make index (vice WP #)
|
||||
nonGeoWaypointCount += 1;
|
||||
}
|
||||
if (wpData->action == NAV_WP_ACTION_SET_POI || wpData->action == NAV_WP_ACTION_SET_HEAD) {
|
||||
nonGeoWaypointCount += 1;
|
||||
} else {
|
||||
posControl.waypointList[wpNumber - 1].p3 = wpNumber - nonGeoWaypointCount;
|
||||
}
|
||||
|
||||
posControl.waypointCount = wpNumber;
|
||||
posControl.waypointListValid = (wpData->flag == NAV_WP_FLAG_LAST);
|
||||
posControl.geoWaypointCount = posControl.waypointCount - nonGeoWaypointCount;
|
||||
if (posControl.waypointListValid) {
|
||||
nonGeoWaypointCount = 0;
|
||||
} else {
|
||||
posControl.waypointList[wpNumber - 1].flag = wpNumber - nonGeoWaypointCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue