comparison 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
comparison
equal deleted inserted replaced
538:b1eee27cd02b 539:d784f281833a
32 #include "externLogbookFlash.h" // for SAMPLESTART and SAMPLESTOP 32 #include "externLogbookFlash.h" // for SAMPLESTART and SAMPLESTOP
33 #include "text_multilanguage.h" // for LANGUAGE_END 33 #include "text_multilanguage.h" // for LANGUAGE_END
34 #include "tHome.h" // for CVIEW_END 34 #include "tHome.h" // for CVIEW_END
35 #include "motion.h" 35 #include "motion.h"
36 #include "t7.h" 36 #include "t7.h"
37 #include "data_central.h"
37 38
38 SSettings Settings; 39 SSettings Settings;
39 40
40 const uint8_t RTErequiredHigh = 2; 41 const uint8_t RTErequiredHigh = 2;
41 const uint8_t RTErequiredLow = 4; 42 const uint8_t RTErequiredLow = 4;
82 83
83 /* always adjust check_and_correct_settings() accordingly 84 /* always adjust check_and_correct_settings() accordingly
84 * There might even be entries with fixed values that have no range 85 * There might even be entries with fixed values that have no range
85 */ 86 */
86 const SSettings SettingsStandard = { 87 const SSettings SettingsStandard = {
87 .header = 0xFFFF001B, 88 .header = 0xFFFF001C,
88 .warning_blink_dsec = 8 * 2, 89 .warning_blink_dsec = 8 * 2,
89 .lastDiveLogId = 0, 90 .lastDiveLogId = 0,
90 .logFlashNextSampleStartAddress = 0, 91 .logFlashNextSampleStartAddress = 0,
91 92
92 .gas[0].oxygen_percentage = 21, 93 .gas[0].oxygen_percentage = 21,
309 .FactoryButtonBalance[2] = 3, 310 .FactoryButtonBalance[2] = 3,
310 .FlipDisplay = 0, 311 .FlipDisplay = 0,
311 .cv_configuration = 0xFFFFFFFF, 312 .cv_configuration = 0xFFFFFFFF,
312 .MotionDetection = MOTION_DETECT_OFF, 313 .MotionDetection = MOTION_DETECT_OFF,
313 .cv_config_BigScreen = 0xFFFFFFFF, 314 .cv_config_BigScreen = 0xFFFFFFFF,
315 .compassInertia = 0,
314 }; 316 };
315 317
316 /* Private function prototypes -----------------------------------------------*/ 318 /* Private function prototypes -----------------------------------------------*/
317 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to); 319 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to);
318 320
462 /* deactivate new views => to be activated by customer */ 464 /* deactivate new views => to be activated by customer */
463 pSettings->cv_config_BigScreen = 0xFFFFFFFF; 465 pSettings->cv_config_BigScreen = 0xFFFFFFFF;
464 pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_Navigation; 466 pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_Navigation;
465 pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_DepthData; 467 pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_DepthData;
466 // no break 468 // no break
469 case 0xFFFF001B:
470 pSettings->compassInertia = 0; /* no inertia */
471 // no break
467 default: 472 default:
468 pSettings->header = pStandard->header; 473 pSettings->header = pStandard->header;
469 break; // no break before!! 474 break; // no break before!!
470 } 475 }
471 } 476 }
1374 corrections++; 1379 corrections++;
1375 } 1380 }
1376 #else 1381 #else
1377 Settings.MotionDetection = MOTION_DETECT_OFF; 1382 Settings.MotionDetection = MOTION_DETECT_OFF;
1378 #endif 1383 #endif
1384
1385 if(Settings.compassInertia > MAX_COMPASS_COMP)
1386 {
1387 Settings.compassInertia = 0;
1388 corrections++;
1389 }
1379 1390
1380 if(corrections > 255) 1391 if(corrections > 255)
1381 return 255; 1392 return 255;
1382 else 1393 else
1383 return (uint8_t)corrections; 1394 return (uint8_t)corrections;