# HG changeset patch # User Ideenmodellierer # Date 1746562059 -7200 # Node ID 08f76d3e985657ad91b900ede32241192499320f # Parent 3bcf592e9cc95512275d0c008154b5659e9c7cbf Bugfix: Pitch compensation The pitch was not calculated correct during calibration process. As result the heading value is sensetive to pitch movment. The issue has been solved by applying the correct formular for calculation. diff -r 3bcf592e9cc9 -r 08f76d3e9856 Small_CPU/Src/compass.c --- a/Small_CPU/Src/compass.c Tue May 06 12:57:33 2025 +0200 +++ b/Small_CPU/Src/compass.c Tue May 06 22:07:39 2025 +0200 @@ -1107,7 +1107,7 @@ sinPhi = sinf(Phi); cosPhi = cosf(Phi); - Teta = atan2((double)accel_DX_f, sqrt((double)accel_DY_f * accel_DY_f + (double)accel_DZ_f * accel_DZ_f)); + Teta = atanf(-(float)accel_DX_f/(accel_DY_f * sinPhi + accel_DZ_f * cosPhi)); compass_pitch = Teta * (180.0 / PI); sinTeta = sinf(Teta);