Mercurial > public > ostc4
comparison Discovery/Src/settings.c @ 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 | 75eedde05ff6 |
| children | 14fd5f35cb50 |
comparison
equal
deleted
inserted
replaced
| 374:ef1b8579166c | 375:4bb5ceebfaf9 |
|---|---|
| 30 #include "settings.h" | 30 #include "settings.h" |
| 31 #include "firmwareEraseProgram.h" // for HARDWAREDATA_ADDRESS | 31 #include "firmwareEraseProgram.h" // for HARDWAREDATA_ADDRESS |
| 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 | 36 |
| 36 SSettings Settings; | 37 SSettings Settings; |
| 37 | 38 |
| 38 const uint8_t RTErequiredHigh = 1; | 39 const uint8_t RTErequiredHigh = 1; |
| 39 const uint8_t RTErequiredLow = 9; | 40 const uint8_t RTErequiredLow = 9; |
| 305 .FactoryButtonBalance[0] = 3, | 306 .FactoryButtonBalance[0] = 3, |
| 306 .FactoryButtonBalance[1] = 3, | 307 .FactoryButtonBalance[1] = 3, |
| 307 .FactoryButtonBalance[2] = 3, | 308 .FactoryButtonBalance[2] = 3, |
| 308 .FlipDisplay = 0, | 309 .FlipDisplay = 0, |
| 309 .cv_configuration = 0xFFFFFFFF, | 310 .cv_configuration = 0xFFFFFFFF, |
| 310 .MotionDetection = 0, | 311 .MotionDetection = MOTION_DETECT_OFF, |
| 311 }; | 312 }; |
| 312 | 313 |
| 313 /* Private function prototypes -----------------------------------------------*/ | 314 /* Private function prototypes -----------------------------------------------*/ |
| 314 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to); | 315 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to); |
| 315 | 316 |
| 451 // no break | 452 // no break |
| 452 case 0xFFFF0018: | 453 case 0xFFFF0018: |
| 453 pSettings->cv_configuration = 0xFFFFFFFF; | 454 pSettings->cv_configuration = 0xFFFFFFFF; |
| 454 // no break | 455 // no break |
| 455 case 0xFFFF0019: | 456 case 0xFFFF0019: |
| 456 pSettings->MotionDetection = 0; | 457 pSettings->MotionDetection = MOTION_DETECT_OFF; |
| 457 // no break | 458 // no break |
| 458 default: | 459 default: |
| 459 pSettings->header = pStandard->header; | 460 pSettings->header = pStandard->header; |
| 460 break; // no break before!! | 461 break; // no break before!! |
| 461 } | 462 } |
| 1350 if(Settings.FlipDisplay > 1) /* only boolean values allowed */ | 1351 if(Settings.FlipDisplay > 1) /* only boolean values allowed */ |
| 1351 { | 1352 { |
| 1352 Settings.FlipDisplay = 0; | 1353 Settings.FlipDisplay = 0; |
| 1353 corrections++; | 1354 corrections++; |
| 1354 } | 1355 } |
| 1355 if(Settings.MotionDetection > 2) /* At the moment only two detection functions available */ | 1356 if(Settings.MotionDetection >= MOTION_DETECT_END) |
| 1356 { | 1357 { |
| 1357 Settings.MotionDetection = 0; | 1358 Settings.MotionDetection = MOTION_DETECT_OFF; |
| 1358 corrections++; | 1359 corrections++; |
| 1359 } | 1360 } |
| 1360 | 1361 |
| 1361 if(corrections > 255) | 1362 if(corrections > 255) |
| 1362 return 255; | 1363 return 255; |
