mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-06-17 20:08:33 +00:00
Prevent negative heading values.
This commit is contained in:
@ -112,7 +112,11 @@ class BackgroundServiceDelegate extends System.ServiceDelegate {
|
|||||||
data.put("speed", Math.round(position.speed));
|
data.put("speed", Math.round(position.speed));
|
||||||
}
|
}
|
||||||
if (position.heading != null) {
|
if (position.heading != null) {
|
||||||
data.put("course", Math.round(position.heading * 180 / Math.PI));
|
var heading = Math.round(position.heading * 180 / Math.PI);
|
||||||
|
while (heading < 0) {
|
||||||
|
heading += 360;
|
||||||
|
}
|
||||||
|
data.put("course", heading);
|
||||||
}
|
}
|
||||||
if (position.altitude != null) {
|
if (position.altitude != null) {
|
||||||
data.put("altitude", Math.round(position.altitude));
|
data.put("altitude", Math.round(position.altitude));
|
||||||
|
Reference in New Issue
Block a user