Tilt compensating a HMC5883 compass with a MMA7455 Accelerometer

Because i remember seeing a tutorial about it some months ago but can't find it now.

The code above does work

You compensate compasses with an accelerometer