I believe those are the same sensors that are used in the Balboa robot, in which case you can use the code I wrote for either a horizontal compass, or a tilt compensated compass, described in this post: Correcting the Balboa magnetometer
The sensor mounting orientation will probably be different, so pay attention to the definition of the vector “p”.