mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-21 15:25:29 +03:00
check that jump target WPs are geo-referenced (#5666)
This commit is contained in:
parent
5b83dbb066
commit
93e349ec3b
1 changed files with 6 additions and 0 deletions
|
@ -3243,6 +3243,7 @@ navArmingBlocker_e navigationIsBlockingArming(bool *usedBypass)
|
||||||
* First WP can't be JUMP
|
* First WP can't be JUMP
|
||||||
* Can't jump to immediately adjacent WPs (pointless)
|
* Can't jump to immediately adjacent WPs (pointless)
|
||||||
* Can't jump beyond WP list
|
* Can't jump beyond WP list
|
||||||
|
* Only jump to geo-referenced WP types
|
||||||
*/
|
*/
|
||||||
if (posControl.waypointCount > 0) {
|
if (posControl.waypointCount > 0) {
|
||||||
for (uint8_t wp = 0; wp < posControl.waypointCount ; wp++){
|
for (uint8_t wp = 0; wp < posControl.waypointCount ; wp++){
|
||||||
|
@ -3250,6 +3251,11 @@ navArmingBlocker_e navigationIsBlockingArming(bool *usedBypass)
|
||||||
if((wp == 0) || ((posControl.waypointList[wp].p1 > (wp-2)) && (posControl.waypointList[wp].p1 < (wp+2)) ) || (posControl.waypointList[wp].p1 >= posControl.waypointCount) || (posControl.waypointList[wp].p2 < -1)) {
|
if((wp == 0) || ((posControl.waypointList[wp].p1 > (wp-2)) && (posControl.waypointList[wp].p1 < (wp+2)) ) || (posControl.waypointList[wp].p1 >= posControl.waypointCount) || (posControl.waypointList[wp].p2 < -1)) {
|
||||||
return NAV_ARMING_BLOCKER_JUMP_WAYPOINT_ERROR;
|
return NAV_ARMING_BLOCKER_JUMP_WAYPOINT_ERROR;
|
||||||
}
|
}
|
||||||
|
/* check for target geo-ref sanity */
|
||||||
|
uint16_t target = posControl.waypointList[wp].p1;
|
||||||
|
if(!(posControl.waypointList[target].action == NAV_WP_ACTION_WAYPOINT || posControl.waypointList[target].action == NAV_WP_ACTION_HOLD_TIME || posControl.waypointList[target].action == NAV_WP_ACTION_LAND)) {
|
||||||
|
return NAV_ARMING_BLOCKER_JUMP_WAYPOINT_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue