Skip to content

location: Fix gclue_location_set_heading_from_prev_location()

Teemu Ikonen requested to merge tpikonen/geoclue:movement-heading into master

I've been running GeoClue with patches which disable setting of "heading" from compass (which is broken in the Pinephone anyway), but noticed that headings derived from movement were really strange.

I fixed the implementation in gclue_location_set_heading_from_prev_location() and added some clarifying comments.

Here's a comparison of the old and new implementations (I reimplemented these in Python, but I think I got them right). The dlon and dlat are differences between current and previous location coordinates.

dlon dlat Old New
+0.0 +2.0 90.0000 0.0000
+1.0 +2.0 63.4349 26.5651
+1.0 +1.0 45.0000 45.0000
+2.0 +1.0 26.5651 63.4349
+2.0 +0.0 0.0000 90.0000
+2.0 -1.0 333.4349 116.5651
+1.0 -1.0 315.0000 135.0000
+1.0 -2.0 296.5651 153.4349
+0.0 -2.0 270.0000 180.0000
-1.0 -2.0 243.4349 206.5651
-1.0 -1.0 225.0000 225.0000
-2.0 -1.0 206.5651 243.4349
-2.0 +0.0 180.0000 270.0000
-2.0 +1.0 153.4349 296.5651
-1.0 +1.0 135.0000 315.0000
-1.0 +2.0 116.5651 333.4349

Merge request reports