# HG changeset patch # User ideenmodellierer # Date 1568141515 -7200 # Node ID 4bb5ceebfaf9e22b026cd5cf2dbcbe871b87285f # Parent ef1b8579166cda76abdeb873d2c52a12a5f20b5b 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 diff -r ef1b8579166c -r 4bb5ceebfaf9 Discovery/Inc/motion.h --- 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 diff -r ef1b8579166c -r 4bb5ceebfaf9 Discovery/Src/settings.c --- 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++; }