Navigator: Publish mission triplet only when actually updated

This commit is contained in:
Julian Oes 2013-11-22 14:07:21 +01:00
parent 7892a72f90
commit 5748a9c964
1 changed files with 10 additions and 10 deletions

View File

@ -468,16 +468,6 @@ Navigator::task_main()
advance_current_mission_item();
}
}
/* lazily publish the setpoint only once available */
if (_triplet_pub > 0) {
/* publish the attitude setpoint */
orb_publish(ORB_ID(mission_item_triplet), _triplet_pub, &_mission_item_triplet);
} else {
/* advertise and publish */
_triplet_pub = orb_advertise(ORB_ID(mission_item_triplet), &_mission_item_triplet);
}
}
perf_end(_loop_perf);
@ -721,6 +711,16 @@ Navigator::update_mission_item_triplet()
_mission_item_triplet.next_valid = true;
}
}
/* lazily publish the mission triplet only once available */
if (_triplet_pub > 0) {
/* publish the mission triplet */
orb_publish(ORB_ID(mission_item_triplet), _triplet_pub, &_mission_item_triplet);
} else {
/* advertise and publish */
_triplet_pub = orb_advertise(ORB_ID(mission_item_triplet), &_mission_item_triplet);
}
}
void