Plane: fix bug with headingLinedUp when loiter.sum_cd was negative.

This commit is contained in:
Samuel Tabor 2019-06-08 13:49:56 +01:00 committed by Andrew Tridgell
parent 30249e8006
commit a56b1dadb9
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ bool ModeLoiter::isHeadingLinedUp(const int32_t bearing_cd)
*/
// Use integer division to get discrete steps
const int32_t expanded_acceptance = 1000 * (plane.loiter.sum_cd / 36000);
const int32_t expanded_acceptance = 1000 * (labs(plane.loiter.sum_cd) / 36000);
if (labs(heading_err_cd) <= 1000 + expanded_acceptance) {
// Want to head in a straight line from _here_ to the next waypoint instead of center of loiter wp