Translate magnetic heading from compass to true heading
@zeenix
Submitted by Zeeshan Ali
Description
I just pushed changes to get heading from IIO compass. That interface gives us raw magnetic heading and geoclue is supposed to provide true heading so obviously we need to translate. It's not the simplest of formula though:
"/* FIXME: *
- IIO compass gives us raw magnetic heading so we need to translate it
- to true heading here. Some pointers on that from elad:
- A Python implementation:
- https://github.com/cmweiss/geomag/blob/master/geomag/geomag/geomag.py
- It seems to use the magnetic model from NOAA:
- http://www.ngdc.noaa.gov/geomag/WMM/
- C implementation: http://www.ngdc.noaa.gov/geomag/WMM/soft.shtml */
From: http://cgit.freedesktop.org/geoclue/tree/src/gclue-compass.c#n251