Skip to content

Commit

Permalink
Round rather than truncate when updating GPS_directionToHome
Browse files Browse the repository at this point in the history
Makes taking off in straight line north produce a home direction
of 180º rather than 179º.
  • Loading branch information
fiam committed Jun 7, 2018
1 parent 002ebbd commit 8e419c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/navigation/navigation.c
Original file line number Diff line number Diff line change
Expand Up @@ -2793,7 +2793,7 @@ void onNewGPSData(void)
int32_t dir;
GPS_distance_cm_bearing(gpsSol.llh.lat, gpsSol.llh.lon, GPS_home.lat, GPS_home.lon, &dist, &dir);
GPS_distanceToHome = dist / 100;
GPS_directionToHome = dir / 100;
GPS_directionToHome = lrintf(dir / 100.0f);
} else {
GPS_distanceToHome = 0;
GPS_directionToHome = 0;
Expand Down

0 comments on commit 8e419c6

Please sign in to comment.