A vehicle compass system for compensating for magnetic disturbances caused
by a moveable vehicle accessory includes a magnetic field sensor and a
control circuit coupled to the moveable vehicle accessory and the
magnetic field sensor. The magnetic field sensor is positioned at a
distance from the moveable vehicle accessory and is configured to
determine an orientation of the magnetic field sensor with respect to the
Earth's magnetic field and to generate magnetic field data. The control
circuit is configured to receive a position signal from the moveable
vehicle accessory indicating whether the moveable vehicle accessory is
changing position, to receive magnetic field data from the magnetic field
sensor, to compare first magnetic field data generated prior to the
change in position of the moveable vehicle accessory to second magnetic
field data generated after the change in position of the moveable vehicle
accessory and to generate a correction value based on the comparison of
the first magnetic field data and the second magnetic field data. The
correction value is used to correct for the magnetic disturbance caused
by the moveable vehicle accessory.