mag3110d.c add code to calculate compass bearing

The compass bearing is calculated from a measured reference magnetic vector
(BxN,ByN,BzN) pointing to North using law of cosines. In addition the altitude
(elevation) is estimated from BzN and measured Bz. This calculation does not
work well in all directions. The quality of the compass azimuth is estimated
from the magnitude of measured field compared to the magnitude of the
reference North vector. At too low horizontal field the quality flag is set
to zero too. The azimuth can be corrected with the DECLINATION parameter
in the configuration file.