GPS, and compass heading error

What do you mean ? do you mean how to calibrate? Im uses the standard 360 degree rotation and I get the offset and scale. Unfortunately, sometimes the conditions are unfavorable and in some places I cannot calibrate the compass perfectly.