Set heading to 0 when speed is 0.

This commit is contained in:
antirez 2013-01-10 19:03:41 +01:00
parent af4964d72f
commit 539039f037

View File

@ -893,6 +893,8 @@ void decodeModesMessage(struct modesMessage *mm, unsigned char *msg) {
mm->heading = heading * 360 / (M_PI*2); mm->heading = heading * 360 / (M_PI*2);
/* We don't want negative values but a 0-360 scale. */ /* We don't want negative values but a 0-360 scale. */
if (mm->heading < 0) mm->heading += 360; if (mm->heading < 0) mm->heading += 360;
} else {
mm->heading = 0;
} }
} else if (mm->mesub == 3 || mm->mesub == 4) { } else if (mm->mesub == 3 || mm->mesub == 4) {
mm->heading_is_valid = msg[5] & (1<<2); mm->heading_is_valid = msg[5] & (1<<2);