Mercurial > public > ostc4
comparison Discovery/Src/data_central.c @ 1007:65d35e66efb9 GasConsumption
Improve compass calibration dialog:
The previous calibration dialog showed some "magic" numbers and a 60 second count down. The new version is trying to guide the user through the calibration process: first rotate pitch, then roll and at last yaw angle. A step to the next angle is taken when enough data per angle is collected (change from red to green). To enable the yaw visualization a simple calibration is done while rotating the axis.
The function behind the calibration was not modified => the suggested process can be ignored and the same handling as the with old dialog may be applied. With the new process the dialog may be left early. Anyhow it will still be left after 60 seconds and the fine calibration is performed in the same way as before.
| author | Ideenmodellierer |
|---|---|
| date | Mon, 05 May 2025 21:02:34 +0200 |
| parents | 9b418e63dbc2 |
| children | 5924a2d1d3ba |
comparison
equal
deleted
inserted
replaced
| 1006:75f958ca5d0e | 1007:65d35e66efb9 |
|---|---|
| 841 | 841 |
| 842 void compass_Inertia(float newHeading) | 842 void compass_Inertia(float newHeading) |
| 843 { | 843 { |
| 844 float newTarget = newHeading; | 844 float newTarget = newHeading; |
| 845 | 845 |
| 846 if(settingsGetPointer()->compassInertia == 0) | 846 if((newHeading > 0.0) && (newHeading < 360)) |
| 847 { | 847 { |
| 848 compass_compensated = newHeading; | 848 if(settingsGetPointer()->compassInertia == 0) |
| 849 } | 849 { |
| 850 else | 850 compass_compensated = newHeading; |
| 851 { | 851 } |
| 852 if((compass_compensated > 270.0) && (newHeading < 90.0)) /* transition passing 0 clockwise */ | 852 else |
| 853 { | 853 { |
| 854 newTarget = newHeading + 360.0; | 854 if((compass_compensated > 270.0) && (newHeading < 90.0)) /* transition passing 0 clockwise */ |
| 855 } | 855 { |
| 856 | 856 newTarget = newHeading + 360.0; |
| 857 if((compass_compensated < 90.0) && (newHeading > 270.0)) /* transition passing 0 counter clockwise */ | 857 } |
| 858 { | 858 |
| 859 newTarget = newHeading - 360.0; | 859 if((compass_compensated < 90.0) && (newHeading > 270.0)) /* transition passing 0 counter clockwise */ |
| 860 } | 860 { |
| 861 | 861 newTarget = newHeading - 360.0; |
| 862 compass_compensated = compass_compensated + ((newTarget - compass_compensated) / (COMPASS_FRACTION * (settingsGetPointer()->compassInertia))); | 862 } |
| 863 if(compass_compensated < 0.0) | 863 |
| 864 { | 864 compass_compensated = compass_compensated + ((newTarget - compass_compensated) / (COMPASS_FRACTION * (settingsGetPointer()->compassInertia))); |
| 865 compass_compensated += 360.0; | 865 if(compass_compensated < 0.0) |
| 866 } | 866 { |
| 867 if(compass_compensated >= 360.0) | 867 compass_compensated += 360.0; |
| 868 { | 868 } |
| 869 compass_compensated -= 360.0; | 869 if(compass_compensated >= 360.0) |
| 870 { | |
| 871 compass_compensated -= 360.0; | |
| 872 } | |
| 870 } | 873 } |
| 871 } | 874 } |
| 872 } | 875 } |
| 873 | 876 |
| 874 float compass_getCompensated() | 877 float compass_getCompensated() |
