comparison Discovery/Src/settings.c @ 368:50ea68c7a153 MotionDetection

Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
author ideenmodellierer
date Tue, 13 Aug 2019 21:10:46 +0200
parents d4d8d717e9a7
children 75eedde05ff6
comparison
equal deleted inserted replaced
367:e309f78f89a5 368:50ea68c7a153
80 80
81 /* always adjust check_and_correct_settings() accordingly 81 /* always adjust check_and_correct_settings() accordingly
82 * There might even be entries with fixed values that have no range 82 * There might even be entries with fixed values that have no range
83 */ 83 */
84 const SSettings SettingsStandard = { 84 const SSettings SettingsStandard = {
85 .header = 0xFFFF0019, 85 .header = 0xFFFF001A,
86 .warning_blink_dsec = 8 * 2, 86 .warning_blink_dsec = 8 * 2,
87 .lastDiveLogId = 0, 87 .lastDiveLogId = 0,
88 .logFlashNextSampleStartAddress = 0, 88 .logFlashNextSampleStartAddress = 0,
89 89
90 .gas[0].oxygen_percentage = 21, 90 .gas[0].oxygen_percentage = 21,
305 .FactoryButtonBalance[0] = 3, 305 .FactoryButtonBalance[0] = 3,
306 .FactoryButtonBalance[1] = 3, 306 .FactoryButtonBalance[1] = 3,
307 .FactoryButtonBalance[2] = 3, 307 .FactoryButtonBalance[2] = 3,
308 .FlipDisplay = 0, 308 .FlipDisplay = 0,
309 .cv_configuration = 0xFFFFFFFF, 309 .cv_configuration = 0xFFFFFFFF,
310 .MotionDetection = 0,
310 }; 311 };
311 312
312 /* Private function prototypes -----------------------------------------------*/ 313 /* Private function prototypes -----------------------------------------------*/
313 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to); 314 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to);
314 315
351 SSettings* pSettings = settingsGetPointer(); 352 SSettings* pSettings = settingsGetPointer();
352 const SSettings* pStandard = settingsGetPointerStandard(); 353 const SSettings* pStandard = settingsGetPointerStandard();
353 354
354 pSettings->scooterControl = 0; 355 pSettings->scooterControl = 0;
355 356
357 /* Pointing to the old header data => set new data depending on what had been added since last version */
356 switch(pSettings->header) 358 switch(pSettings->header)
357 { 359 {
358 case 0xFFFF0000: 360 case 0xFFFF0000:
359 case 0xFFFF0001: 361 case 0xFFFF0001:
360 case 0xFFFF0002: 362 case 0xFFFF0002:
448 pSettings->FlipDisplay = 0; 450 pSettings->FlipDisplay = 0;
449 // no break 451 // no break
450 case 0xFFFF0018: 452 case 0xFFFF0018:
451 pSettings->cv_configuration = 0xFFFFFFFF; 453 pSettings->cv_configuration = 0xFFFFFFFF;
452 // no break 454 // no break
455 case 0xFFFF0019:
456 pSettings->MotionDetection = 0;
457 // no break
453 default: 458 default:
454 pSettings->header = pStandard->header; 459 pSettings->header = pStandard->header;
455 break; // no break before!! 460 break; // no break before!!
456 } 461 }
457 } 462 }
1345 if(Settings.FlipDisplay > 1) /* only boolean values allowed */ 1350 if(Settings.FlipDisplay > 1) /* only boolean values allowed */
1346 { 1351 {
1347 Settings.FlipDisplay = 0; 1352 Settings.FlipDisplay = 0;
1348 corrections++; 1353 corrections++;
1349 } 1354 }
1355 if(Settings.MotionDetection > 2) /* At the moment only two detection functions available */
1356 {
1357 Settings.MotionDetection = 0;
1358 corrections++;
1359 }
1350 1360
1351 if(corrections > 255) 1361 if(corrections > 255)
1352 return 255; 1362 return 255;
1353 else 1363 else
1354 return (uint8_t)corrections; 1364 return (uint8_t)corrections;
1397 uint8_t firmwareVersion_16bit_low(void) 1407 uint8_t firmwareVersion_16bit_low(void)
1398 { 1408 {
1399 return ((firmware_FirmwareData.versionSecond & 0x03) << 6) + ((firmware_FirmwareData.versionThird & 0x1F) << 1) + (firmware_FirmwareData.versionBeta & 0x01); 1409 return ((firmware_FirmwareData.versionSecond & 0x03) << 6) + ((firmware_FirmwareData.versionThird & 0x1F) << 1) + (firmware_FirmwareData.versionBeta & 0x01);
1400 } 1410 }
1401 1411
1402 SSettings* settingsGetPointer(void) 1412 inline SSettings* settingsGetPointer(void)
1403 { 1413 {
1404 return &Settings; 1414 return &Settings;
1405 } 1415 }
1406 1416
1407 1417