comparison Discovery/Src/t3.c @ 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 427ae9f8e28e
children 65c7b009136f
comparison
equal deleted inserted replaced
385:0cd862e501f6 386:39c147e47c1c
258 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min); 258 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min);
259 else 259 else
260 depthChangeRate = 200; 260 depthChangeRate = 200;
261 } 261 }
262 start.y = tXl1->WindowY0 - 1; 262 start.y = tXl1->WindowY0 - 1;
263 startZeroLine.y = start.y;
263 for(int i = 0; i<5;i++) 264 for(int i = 0; i<5;i++)
264 { 265 {
265 start.y += 40; 266 start.y += 40;
266 stop.y = start.y; 267 stop.y = start.y;
267 start.x = tXl1->WindowX1 - 1; 268 start.x = tXl1->WindowX1 - 1;
483 484
484 485
485 486
486 void t3_refresh_customview(float depth) 487 void t3_refresh_customview(float depth)
487 { 488 {
489 #if 0
488 if((t3_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) 490 if((t3_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0))
489 t3_change_customview(); 491 t3_change_customview();
490 492 #endif
491 t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, stateUsedWrite->diveSettings.diveMode); 493 t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, stateUsedWrite->diveSettings.diveMode);
492 } 494 }
493 495
494 496
495 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) 497 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode)
1058 GFX_write_string(&FontT48,&t3c2,text,1); 1060 GFX_write_string(&FontT48,&t3c2,text,1);
1059 } 1061 }
1060 } 1062 }
1061 1063
1062 1064
1063 void t3_change_customview(void) 1065 void t3_change_customview(uint8_t action)
1064 { 1066 {
1065 t3_basics_change_customview(&t3_selection_customview, t3_customviews); 1067 t3_basics_change_customview(&t3_selection_customview, t3_customviews, action);
1066 } 1068 }
1067 1069
1068 1070
1069 void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews) 1071 void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews, uint8_t action)
1070 { 1072 {
1071 const SDecoinfo * pDecoinfo; 1073 const SDecoinfo * pDecoinfo;
1072 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) 1074 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
1073 pDecoinfo = &stateUsed->decolistBuehlmann; 1075 pDecoinfo = &stateUsed->decolistBuehlmann;
1074 else 1076 else
1075 pDecoinfo = &stateUsed->decolistVPM; 1077 pDecoinfo = &stateUsed->decolistVPM;
1076 1078
1077 const uint8_t *pViews; 1079 uint8_t *pViews;
1078 pViews = tX_customviews; 1080 pViews = tX_customviews;
1079 1081
1080 while((*pViews != CVIEW_T3_END) && (*pViews != *tX_selection_customview)) 1082 uint8_t *pStartView,*pCurView, *pLastView;
1081 {pViews++;} 1083 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */
1082 1084
1083 if(*pViews < CVIEW_T3_END) 1085 pStartView = pViews;
1084 pViews++; 1086 /* set pointer to currently selected view and count number of entries */
1085 1087 while((*pViews != CVIEW_T3_END))
1086 if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) 1088 {
1087 pViews++; 1089 if (*pViews == *tX_selection_customview)
1088 1090 {
1089 if(*pViews == CVIEW_T3_END) 1091 pCurView = pViews;
1090 { 1092 }
1091 *tX_selection_customview = tX_customviews[0]; 1093 pViews++;
1092 } 1094 }
1093 else 1095 pLastView = pViews;
1094 *tX_selection_customview = *pViews; 1096 pViews = pCurView;
1097
1098 do
1099 {
1100 iterate = 0;
1101 if((action == ACTION_BUTTON_ENTER) || (action == ACTION_PITCH_POS))
1102 {
1103 if(*pViews != CVIEW_T3_END)
1104 pViews++;
1105
1106 if(*pViews == CVIEW_T3_END)
1107 {
1108 pViews = pStartView;
1109 }
1110 }
1111 else
1112 {
1113 if(pViews == pStartView)
1114 {
1115 pViews = pLastView - 1;
1116 }
1117 else
1118 {
1119 pViews--;
1120 }
1121 }
1122 if((*pViews == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0))
1123 {
1124 iterate = 1;
1125 }
1126 if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds)
1127 {
1128 iterate = 1;
1129 }
1130 }while (iterate == 1);
1131
1132 *tX_selection_customview = *pViews;
1095 } 1133 }
1096 1134
1097 1135
1098 void t3_basics_colorscheme_mod(char *text) 1136 void t3_basics_colorscheme_mod(char *text)
1099 { 1137 {