changeset 375:4bb5ceebfaf9 MotionDetection

Use Enum values for initialization and setting check: Scroll function could not be restored because of invalid setting plausibility check =>Use enums to determine proper max value for the MotionDetection parameter
author ideenmodellierer
date Tue, 10 Sep 2019 20:51:55 +0200
parents ef1b8579166c
children a90100959871
files Discovery/Inc/motion.h Discovery/Src/settings.c
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/motion.h	Sun Sep 08 13:45:43 2019 +0200
+++ b/Discovery/Inc/motion.h	Tue Sep 10 20:51:55 2019 +0200
@@ -18,7 +18,8 @@
 		MOTION_DETECT_OFF = 0,
 		MOTION_DETECT_SECTOR,
 		MOTION_DETECT_MOVE,
-		MOTION_DETECT_SCROLL
+		MOTION_DETECT_SCROLL,
+		MOTION_DETECT_END
 } MotionDetectMethod_t;
 
 typedef enum
--- a/Discovery/Src/settings.c	Sun Sep 08 13:45:43 2019 +0200
+++ b/Discovery/Src/settings.c	Tue Sep 10 20:51:55 2019 +0200
@@ -32,6 +32,7 @@
 #include "externLogbookFlash.h" // for SAMPLESTART and SAMPLESTOP
 #include "text_multilanguage.h" // for LANGUAGE_END
 #include "tHome.h" // for CVIEW_END
+#include "Motion.h"
 
 SSettings Settings;
 
@@ -307,7 +308,7 @@
     .FactoryButtonBalance[2] = 3,
 	.FlipDisplay = 0,
 	.cv_configuration = 0xFFFFFFFF,
-	.MotionDetection = 0,
+	.MotionDetection = MOTION_DETECT_OFF,
 };
 
 /* Private function prototypes -----------------------------------------------*/
@@ -453,7 +454,7 @@
     	pSettings->cv_configuration = 0xFFFFFFFF;
     	// no break
     case 0xFFFF0019:
-    	pSettings->MotionDetection = 0;
+    	pSettings->MotionDetection = MOTION_DETECT_OFF;
     	// no break
     default:
         pSettings->header = pStandard->header;
@@ -1352,9 +1353,9 @@
     	Settings.FlipDisplay = 0;
 	    corrections++;
    	}
-    if(Settings.MotionDetection > 2) /* At the moment only two detection functions available */
+    if(Settings.MotionDetection >= MOTION_DETECT_END)
    	{
-    	Settings.MotionDetection = 0;
+    	Settings.MotionDetection = MOTION_DETECT_OFF;
 	    corrections++;
    	}