Mercurial > public > ostc4
diff Discovery/Src/settings.c @ 539:d784f281833a
Added inertia simulation for compass heading:
In previous version calculated compass values were directly used for visualization of the compass. This causes a fast changing (jumping) of values. With the inertia introduction the compass behalfs more like an analog compass. The final value is reached slowly and the displayed values are more stable.
For configuration a new menu item has been added to the compass menu allowing to switch inertia off (default), small and large inertia simulation
author | Ideenmodellierer |
---|---|
date | Sat, 10 Oct 2020 16:59:18 +0200 |
parents | 02e7e11fdbe8 |
children | 6fbf7cd391cb |
line wrap: on
line diff
--- a/Discovery/Src/settings.c Sat Oct 10 13:51:44 2020 +0200 +++ b/Discovery/Src/settings.c Sat Oct 10 16:59:18 2020 +0200 @@ -34,6 +34,7 @@ #include "tHome.h" // for CVIEW_END #include "motion.h" #include "t7.h" +#include "data_central.h" SSettings Settings; @@ -84,7 +85,7 @@ * There might even be entries with fixed values that have no range */ const SSettings SettingsStandard = { - .header = 0xFFFF001B, + .header = 0xFFFF001C, .warning_blink_dsec = 8 * 2, .lastDiveLogId = 0, .logFlashNextSampleStartAddress = 0, @@ -311,6 +312,7 @@ .cv_configuration = 0xFFFFFFFF, .MotionDetection = MOTION_DETECT_OFF, .cv_config_BigScreen = 0xFFFFFFFF, + .compassInertia = 0, }; /* Private function prototypes -----------------------------------------------*/ @@ -464,6 +466,9 @@ pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_Navigation; pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_DepthData; // no break + case 0xFFFF001B: + pSettings->compassInertia = 0; /* no inertia */ + // no break default: pSettings->header = pStandard->header; break; // no break before!! @@ -1377,6 +1382,12 @@ Settings.MotionDetection = MOTION_DETECT_OFF; #endif + if(Settings.compassInertia > MAX_COMPASS_COMP) + { + Settings.compassInertia = 0; + corrections++; + } + if(corrections > 255) return 255; else