mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 01:05:21 +03:00
Merge pull request #10273 from b14ckyy/master
Thoroughly tested in HITL and more mission tests in real flight will be executed over the next weeks.
This commit is contained in:
commit
895be054a9
1 changed files with 6 additions and 1 deletions
|
@ -3703,7 +3703,8 @@ void setWaypoint(uint8_t wpNumber, const navWaypoint_t * wpData)
|
|||
setDesiredPosition(&wpPos.pos, DEGREES_TO_CENTIDEGREES(wpData->p1), waypointUpdateFlags);
|
||||
}
|
||||
// WP #1 - #NAV_MAX_WAYPOINTS - common waypoints - pre-programmed mission
|
||||
else if ((wpNumber >= 1) && (wpNumber <= NAV_MAX_WAYPOINTS) && !ARMING_FLAG(ARMED)) {
|
||||
else if ((wpNumber >= 1) && (wpNumber <= NAV_MAX_WAYPOINTS) && !FLIGHT_MODE(NAV_WP_MODE)) {
|
||||
// WP upload is not allowed why WP mode is active
|
||||
if (wpData->action == NAV_WP_ACTION_WAYPOINT || wpData->action == NAV_WP_ACTION_JUMP || wpData->action == NAV_WP_ACTION_RTH || wpData->action == NAV_WP_ACTION_HOLD_TIME || wpData->action == NAV_WP_ACTION_LAND || wpData->action == NAV_WP_ACTION_SET_POI || wpData->action == NAV_WP_ACTION_SET_HEAD ) {
|
||||
// Only allow upload next waypoint (continue upload mission) or first waypoint (new mission)
|
||||
static int8_t nonGeoWaypointCount = 0;
|
||||
|
@ -3725,6 +3726,10 @@ void setWaypoint(uint8_t wpNumber, const navWaypoint_t * wpData)
|
|||
posControl.geoWaypointCount = posControl.waypointCount - nonGeoWaypointCount;
|
||||
if (posControl.waypointListValid) {
|
||||
nonGeoWaypointCount = 0;
|
||||
// If active WP index is bigger than total mission WP number, reset active WP index (Mission Upload mid flight with interrupted mission) if RESUME is enabled
|
||||
if (posControl.activeWaypointIndex > posControl.waypointCount) {
|
||||
posControl.activeWaypointIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue