diff 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
line wrap: on
line diff
--- a/Discovery/Src/settings.c	Sat Jul 20 21:42:45 2019 +0200
+++ b/Discovery/Src/settings.c	Tue Aug 13 21:10:46 2019 +0200
@@ -82,7 +82,7 @@
  * There might even be entries with fixed values that have no range
  */
 const SSettings SettingsStandard = {
-    .header = 0xFFFF0019,
+    .header = 0xFFFF001A,
     .warning_blink_dsec = 8 * 2,
     .lastDiveLogId = 0,
     .logFlashNextSampleStartAddress = 0,
@@ -307,6 +307,7 @@
     .FactoryButtonBalance[2] = 3,
 	.FlipDisplay = 0,
 	.cv_configuration = 0xFFFFFFFF,
+	.MotionDetection = 0,
 };
 
 /* Private function prototypes -----------------------------------------------*/
@@ -353,6 +354,7 @@
 
     pSettings->scooterControl = 0;
 
+    /* Pointing to the old header data => set new data depending on what had been added since last version */
     switch(pSettings->header)
     {
     case 0xFFFF0000:
@@ -450,6 +452,9 @@
     case 0xFFFF0018:
     	pSettings->cv_configuration = 0xFFFFFFFF;
     	// no break
+    case 0xFFFF0019:
+    	pSettings->MotionDetection = 0;
+    	// no break
     default:
         pSettings->header = pStandard->header;
         break; // no break before!!
@@ -1347,6 +1352,11 @@
     	Settings.FlipDisplay = 0;
 	    corrections++;
    	}
+    if(Settings.MotionDetection > 2) /* At the moment only two detection functions available */
+   	{
+    	Settings.MotionDetection = 0;
+	    corrections++;
+   	}
 
     if(corrections > 255)
         return 255;
@@ -1399,7 +1409,7 @@
     return ((firmware_FirmwareData.versionSecond & 0x03)  << 6)	+ ((firmware_FirmwareData.versionThird & 0x1F) << 1) + (firmware_FirmwareData.versionBeta & 0x01);
 }
 
-SSettings* settingsGetPointer(void)
+inline SSettings* settingsGetPointer(void)
 {
     return &Settings;
 }