Have you left any tools, spanners, screwdrivers with magnetic tips to the blades etc., anywhere near your transmitting compass, albeit by mistake? Makes a huge difference once the interference has been removed !!
One of my 'daily checks' prior to leaving port is to ensure that the autopilot digital compass reading is the same as the magnetic compass. This fault occurred whilst on passage - that is, everything had been normal .....................
1. but the alignment failed/changed whilst we were motoring along not touching anything............................
2. The best part was that COG was accurate.
1. Could anything that might have had a magnetic influence have moved, perhaps caused by the boat rolling, might you have put something in the vicinity of your transmitting compass, and then later moved it away without realising the affect it had on your compass?
2. With respect, COG surely would have been determined by your chart plotters calculation between successive GPS positions rather than by any input from your transmitting compass.
Hope you find the cause of the glitch, and if you do, please let us know. Good luck.