Mercurial > public > ostc4
comparison Discovery/Src/motion.c @ 642:c737cf5d9067
Do not show focus indicator in case motion detection is suspended:
Motion detection will be suspended in case the diver is operating the OSTC using the buttons. In previous versions the focus indicator was shown even the motion detection was not active => may cause confusion. The indicator is now only shown in case the detection is active
Added hystresis for switching between sector views:
In previous versions small jitter at the angle signal could cause fast switching of the custom view. An offset has now been added to avoid this scenario
author | Ideenmodellierer |
---|---|
date | Wed, 24 Mar 2021 21:28:41 +0100 |
parents | 189f945ae4ba |
children | ff2b393e290f |
comparison
equal
deleted
inserted
replaced
641:ed5422ac4ffb | 642:c737cf5d9067 |
---|---|
275 } | 275 } |
276 | 276 |
277 /* Map the current pitch value to a sector and create button event in case the sector is left */ | 277 /* Map the current pitch value to a sector and create button event in case the sector is left */ |
278 detectionState_t detectSectorButtonEvent(float focusOffset) | 278 detectionState_t detectSectorButtonEvent(float focusOffset) |
279 { | 279 { |
280 static uint8_t lastTargetSector = 0xFF; | |
281 static float lastfocusOffset = 0.0; | |
282 | |
280 uint8_t newTargetSector; | 283 uint8_t newTargetSector; |
281 | 284 |
282 newTargetSector = GetSectorForFocus(focusOffset); | 285 newTargetSector = GetSectorForFocus(focusOffset); |
283 | 286 |
284 if(settingsGetPointer()->design == 3) /* Big font view ? */ | 287 /* take a small hysteresis into account to avoid fast display changes (flicker) */ |
285 { | 288 if((newTargetSector != lastTargetSector) && (fabsf(focusOffset - lastfocusOffset) > (sectorDetection.size / 3))) |
286 t3_select_customview(GetCVForSector(newTargetSector)); | 289 { |
287 } | 290 lastfocusOffset = focusOffset; |
288 else | 291 if(settingsGetPointer()->design == 3) /* Big font view ? */ |
289 { | 292 { |
290 t7_select_customview(GetCVForSector(newTargetSector)); | 293 t3_select_customview(GetCVForSector(newTargetSector)); |
291 } | 294 } |
292 | 295 else |
296 { | |
297 t7_select_customview(GetCVForSector(newTargetSector)); | |
298 } | |
299 } | |
293 return DETECT_NOTHING; | 300 return DETECT_NOTHING; |
294 } | 301 } |
295 | 302 |
296 /* Check if pitch is not in center position and trigger a button action if needed */ | 303 /* Check if pitch is not in center position and trigger a button action if needed */ |
297 detectionState_t detectScrollButtonEvent(float focusOffset) | 304 detectionState_t detectScrollButtonEvent(float focusOffset) |
732 void resetFocusState(void) | 739 void resetFocusState(void) |
733 { | 740 { |
734 inFocus = 0; | 741 inFocus = 0; |
735 } | 742 } |
736 | 743 |
744 uint8_t viewDetectionSuspended(void) | |
745 { | |
746 uint8_t retVal = 0; | |
747 | |
748 if(suspendMotionDetectionSec) | |
749 { | |
750 retVal = 1; | |
751 } | |
752 return retVal; | |
753 } | |
754 | |
737 void suspendMotionDetection(uint8_t seconds) | 755 void suspendMotionDetection(uint8_t seconds) |
738 { | 756 { |
739 suspendMotionDetectionSec = seconds * 10; /* detection function is called every 100ms */ | 757 suspendMotionDetectionSec = seconds * 10; /* detection function is called every 100ms */ |
740 } | 758 } |
741 | 759 |