I've been playing with a sparky clone and came to the conclusion that unless a GOOD magnetometer is used, setting up navigation is a real pain. If you experience mag drift in the logs there is no way you can fix this through software settings.
Here are a few links you could use (including posts to my own findings), but as said, the mag must be reliable. Given the low precision of my mag I tried to define a "loose" approach (allow the aircraft to be reasonably off-track) and reduce aggressiveness in navigation corrections, which helped a bit but, the aircraft was then unable to fight against the wind. Tinkering was fun, but unsuccessful. Lesson learned: navigation requires good hardware.
Hope this helps