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:
parent
002ebbddff
commit
8e419c616a
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue