AP_Mission: lat/lng == 0 bug fix

was using wrong logic to check for lat/lng == 0
This commit is contained in:
Tom Pittenger 2015-08-26 22:42:42 -07:00 committed by Andrew Tridgell
parent 81f8358705
commit 15b242832e

View File

@ -375,7 +375,7 @@ bool AP_Mission::set_current_cmd(uint16_t index)
// save previous nav command index
_prev_nav_cmd_index = _nav_cmd.index;
// save separate previous nav command index if it contains lat,long,alt
if (cmd.content.location.lat != 0 && cmd.content.location.lng != 0) {
if (!(cmd.content.location.lat == 0 && cmd.content.location.lng == 0)) {
_prev_nav_cmd_wp_index = _nav_cmd.index;
}
// set current navigation command and start it
@ -1140,7 +1140,7 @@ bool AP_Mission::advance_current_nav_cmd()
// save previous nav command index
_prev_nav_cmd_index = _nav_cmd.index;
// save separate previous nav command index if it contains lat,long,alt
if (cmd.content.location.lat != 0 && cmd.content.location.lng != 0) {
if (!(cmd.content.location.lat == 0 && cmd.content.location.lng == 0)) {
_prev_nav_cmd_wp_index = _nav_cmd.index;
}
// set current navigation command and start it