1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-20 23:05:17 +03:00

Round rather than truncate when updating GPS_directionToHome

Makes taking off in straight line north produce a home direction
of 180º rather than 179º.
This commit is contained in:
Alberto García Hierro 2018-06-07 16:34:16 +01:00
parent 002ebbddff
commit 8e419c616a

View file

@ -2793,7 +2793,7 @@ void onNewGPSData(void)
int32_t dir; int32_t dir;
GPS_distance_cm_bearing(gpsSol.llh.lat, gpsSol.llh.lon, GPS_home.lat, GPS_home.lon, &dist, &dir); GPS_distance_cm_bearing(gpsSol.llh.lat, gpsSol.llh.lon, GPS_home.lat, GPS_home.lon, &dist, &dir);
GPS_distanceToHome = dist / 100; GPS_distanceToHome = dist / 100;
GPS_directionToHome = dir / 100; GPS_directionToHome = lrintf(dir / 100.0f);
} else { } else {
GPS_distanceToHome = 0; GPS_distanceToHome = 0;
GPS_directionToHome = 0; GPS_directionToHome = 0;