Mercurial > public > ostc4
changeset 386:39c147e47c1c MotionDetection
Added key direction awarness to t3, t5 and t6 views:
In case of big font views the handling of motion events were not considered, As results all events caused a menu change in th same direction.
author | ideenmodellierer |
---|---|
date | Mon, 21 Oct 2019 21:16:53 +0200 |
parents | 0cd862e501f6 |
children | 0dbb74be972f |
files | Discovery/Inc/t3.h Discovery/Inc/t5_gauge.h Discovery/Inc/t6_apnea.h Discovery/Inc/tHome.h Discovery/Src/t3.c Discovery/Src/t5_gauge.c Discovery/Src/t6_apnea.c Discovery/Src/tHome.c |
diffstat | 8 files changed, 68 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Inc/t3.h Mon Oct 21 18:37:43 2019 +0200 +++ b/Discovery/Inc/t3.h Mon Oct 21 21:16:53 2019 +0200 @@ -35,7 +35,7 @@ /* Exported functions --------------------------------------------------------*/ void t3_init(void); void t3_refresh(void); -void t3_change_customview(void); +void t3_change_customview(uint8_t action); uint8_t t3_GetEnabled_customviews(); #endif /* T3_H */
--- a/Discovery/Inc/t5_gauge.h Mon Oct 21 18:37:43 2019 +0200 +++ b/Discovery/Inc/t5_gauge.h Mon Oct 21 21:16:53 2019 +0200 @@ -35,7 +35,7 @@ /* Exported functions --------------------------------------------------------*/ void t5_init(void); void t5_refresh(void); -void t5_change_customview(void); +void t5_change_customview(uint8_t action); uint8_t t5_getCustomView(void); #endif /* T5_H */
--- a/Discovery/Inc/t6_apnea.h Mon Oct 21 18:37:43 2019 +0200 +++ b/Discovery/Inc/t6_apnea.h Mon Oct 21 21:16:53 2019 +0200 @@ -35,6 +35,6 @@ /* Exported functions --------------------------------------------------------*/ void t6_init(void); void t6_refresh(void); -void t6_change_customview(void); +void t6_change_customview(uint8_t action); #endif /* T6_H */
--- a/Discovery/Inc/tHome.h Mon Oct 21 18:37:43 2019 +0200 +++ b/Discovery/Inc/tHome.h Mon Oct 21 21:16:53 2019 +0200 @@ -134,7 +134,7 @@ void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode); //void _findNextStop(const uint16_t *list, uint8_t *depthOut, uint16_t *lengthOut); void t3_basics_colorscheme_mod(char *text); -void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews); +void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews, uint8_t action); uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn);
--- a/Discovery/Src/t3.c Mon Oct 21 18:37:43 2019 +0200 +++ b/Discovery/Src/t3.c Mon Oct 21 21:16:53 2019 +0200 @@ -260,6 +260,7 @@ depthChangeRate = 200; } start.y = tXl1->WindowY0 - 1; + startZeroLine.y = start.y; for(int i = 0; i<5;i++) { start.y += 40; @@ -485,9 +486,10 @@ void t3_refresh_customview(float depth) { +#if 0 if((t3_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) t3_change_customview(); - +#endif t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, stateUsedWrite->diveSettings.diveMode); } @@ -1060,13 +1062,13 @@ } -void t3_change_customview(void) +void t3_change_customview(uint8_t action) { - t3_basics_change_customview(&t3_selection_customview, t3_customviews); + t3_basics_change_customview(&t3_selection_customview, t3_customviews, action); } -void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews) +void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews, uint8_t action) { const SDecoinfo * pDecoinfo; if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) @@ -1074,24 +1076,60 @@ else pDecoinfo = &stateUsed->decolistVPM; - const uint8_t *pViews; + uint8_t *pViews; pViews = tX_customviews; - while((*pViews != CVIEW_T3_END) && (*pViews != *tX_selection_customview)) - {pViews++;} + uint8_t *pStartView,*pCurView, *pLastView; + uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ - if(*pViews < CVIEW_T3_END) - pViews++; + pStartView = pViews; + /* set pointer to currently selected view and count number of entries */ + while((*pViews != CVIEW_T3_END)) + { + if (*pViews == *tX_selection_customview) + { + pCurView = pViews; + } + pViews++; + } + pLastView = pViews; + pViews = pCurView; + + do + { + iterate = 0; + if((action == ACTION_BUTTON_ENTER) || (action == ACTION_PITCH_POS)) + { + if(*pViews != CVIEW_T3_END) + pViews++; - if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) - pViews++; + if(*pViews == CVIEW_T3_END) + { + pViews = pStartView; + } + } + else + { + if(pViews == pStartView) + { + pViews = pLastView - 1; + } + else + { + pViews--; + } + } + if((*pViews == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) + { + iterate = 1; + } + if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) + { + iterate = 1; + } + }while (iterate == 1); - if(*pViews == CVIEW_T3_END) - { - *tX_selection_customview = tX_customviews[0]; - } - else - *tX_selection_customview = *pViews; + *tX_selection_customview = *pViews; }
--- a/Discovery/Src/t5_gauge.c Mon Oct 21 18:37:43 2019 +0200 +++ b/Discovery/Src/t5_gauge.c Mon Oct 21 21:16:53 2019 +0200 @@ -285,16 +285,16 @@ } -void t5_change_customview(void) +void t5_change_customview(uint8_t action) { - t3_basics_change_customview(&t5_selection_customview, t5_customviews); + t3_basics_change_customview(&t5_selection_customview, t5_customviews, action); } void t5_refresh_customview(float depth) { - if((t5_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) - t5_change_customview(); + // if((t5_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) + // t5_change_customview(); t3_basics_refresh_customview(depth, t5_selection_customview, &t5screen, &t5c1, &t5c2, DIVEMODE_Gauge); }
--- a/Discovery/Src/t6_apnea.c Mon Oct 21 18:37:43 2019 +0200 +++ b/Discovery/Src/t6_apnea.c Mon Oct 21 21:16:53 2019 +0200 @@ -301,9 +301,9 @@ -void t6_change_customview(void) +void t6_change_customview(uint8_t action) { - t3_basics_change_customview(&t6_selection_customview, t6_customviews); + t3_basics_change_customview(&t6_selection_customview, t6_customviews, action); } @@ -311,9 +311,6 @@ { uint8_t customViewLeftSide = CVIEW_T3_MaxDepth; - if((t6_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) - t6_change_customview(); - if(t6_getCustomView() == CVIEW_T3_ApnoeSurfaceInfo) customViewLeftSide = CVIEW_T3_ApnoeSurfaceInfo;
--- a/Discovery/Src/tHome.c Mon Oct 21 18:37:43 2019 +0200 +++ b/Discovery/Src/tHome.c Mon Oct 21 21:16:53 2019 +0200 @@ -349,13 +349,13 @@ t7_change_customview(action); else if(settingsGetPointer()->design == 3) - t3_change_customview(); + t3_change_customview(action); else if(settingsGetPointer()->design == 5) - t5_change_customview(); + t5_change_customview(action); else if(settingsGetPointer()->design == 6) - t6_change_customview(); + t6_change_customview(action); }