comparison Discovery/Src/t3.c @ 387:0dbb74be972f

Merged in Ideenmodellierer/ostc4/MotionDetection (pull request #34) MotionDetection
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Sun, 24 Nov 2019 15:46:58 +0000
parents 39c147e47c1c
children 65c7b009136f
comparison
equal deleted inserted replaced
358:c6a084d1433f 387:0dbb74be972f
56 56
57 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/ 57 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/
58 58
59 /* Private types -------------------------------------------------------------*/ 59 /* Private types -------------------------------------------------------------*/
60 #define TEXTSIZE 16 60 #define TEXTSIZE 16
61 #define NUMBER_OF_VIEWS 7 /* number of views defined in the array below */
61 62
62 const uint8_t t3_customviewsStandard[] = 63 const uint8_t t3_customviewsStandard[] =
63 { 64 {
64 CVIEW_T3_Decostop, 65 CVIEW_T3_Decostop,
65 CVIEW_sensors, 66 CVIEW_sensors,
257 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min); 258 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min);
258 else 259 else
259 depthChangeRate = 200; 260 depthChangeRate = 200;
260 } 261 }
261 start.y = tXl1->WindowY0 - 1; 262 start.y = tXl1->WindowY0 - 1;
263 startZeroLine.y = start.y;
262 for(int i = 0; i<5;i++) 264 for(int i = 0; i<5;i++)
263 { 265 {
264 start.y += 40; 266 start.y += 40;
265 stop.y = start.y; 267 stop.y = start.y;
266 start.x = tXl1->WindowX1 - 1; 268 start.x = tXl1->WindowX1 - 1;
482 484
483 485
484 486
485 void t3_refresh_customview(float depth) 487 void t3_refresh_customview(float depth)
486 { 488 {
489 #if 0
487 if((t3_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) 490 if((t3_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0))
488 t3_change_customview(); 491 t3_change_customview();
489 492 #endif
490 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);
491 } 494 }
492 495
493 496
494 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)
1057 GFX_write_string(&FontT48,&t3c2,text,1); 1060 GFX_write_string(&FontT48,&t3c2,text,1);
1058 } 1061 }
1059 } 1062 }
1060 1063
1061 1064
1062 void t3_change_customview(void) 1065 void t3_change_customview(uint8_t action)
1063 { 1066 {
1064 t3_basics_change_customview(&t3_selection_customview, t3_customviews); 1067 t3_basics_change_customview(&t3_selection_customview, t3_customviews, action);
1065 } 1068 }
1066 1069
1067 1070
1068 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)
1069 { 1072 {
1070 const SDecoinfo * pDecoinfo; 1073 const SDecoinfo * pDecoinfo;
1071 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) 1074 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
1072 pDecoinfo = &stateUsed->decolistBuehlmann; 1075 pDecoinfo = &stateUsed->decolistBuehlmann;
1073 else 1076 else
1074 pDecoinfo = &stateUsed->decolistVPM; 1077 pDecoinfo = &stateUsed->decolistVPM;
1075 1078
1076 const uint8_t *pViews; 1079 uint8_t *pViews;
1077 pViews = tX_customviews; 1080 pViews = tX_customviews;
1078 1081
1079 while((*pViews != CVIEW_T3_END) && (*pViews != *tX_selection_customview)) 1082 uint8_t *pStartView,*pCurView, *pLastView;
1080 {pViews++;} 1083 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */
1081 1084
1082 if(*pViews < CVIEW_T3_END) 1085 pStartView = pViews;
1083 pViews++; 1086 /* set pointer to currently selected view and count number of entries */
1084 1087 while((*pViews != CVIEW_T3_END))
1085 if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) 1088 {
1086 pViews++; 1089 if (*pViews == *tX_selection_customview)
1087 1090 {
1088 if(*pViews == CVIEW_T3_END) 1091 pCurView = pViews;
1089 { 1092 }
1090 *tX_selection_customview = tX_customviews[0]; 1093 pViews++;
1091 } 1094 }
1092 else 1095 pLastView = pViews;
1093 *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;
1094 } 1133 }
1095 1134
1096 1135
1097 void t3_basics_colorscheme_mod(char *text) 1136 void t3_basics_colorscheme_mod(char *text)
1098 { 1137 {
1249 center.y = 116; 1288 center.y = 116;
1250 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); 1289 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030);
1251 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); 1290 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030);
1252 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); 1291 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030);
1253 } 1292 }
1293
1294 uint8_t t3_GetEnabled_customviews()
1295 {
1296 int8_t i;
1297 uint8_t enabledViewCnt = 0;
1298 uint32_t cv_config = settingsGetPointer()->cv_configuration;
1299
1300 i=0;
1301 do
1302 {
1303 if(cv_changelist[i] == CVIEW_sensors) /* at the moment specific big font view may not be selected. Only sensor setting is taken from t7 configuration */
1304 {
1305 if(!CHECK_BIT_THOME(cv_config, cv_changelist[i]))
1306 {
1307 enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */
1308 }
1309 else
1310 {
1311 enabledViewCnt = NUMBER_OF_VIEWS; /* enable all possible views */
1312 }
1313 break;
1314 }
1315 i++;
1316 } while(cv_changelist[i] != CVIEW_END);
1317 if ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0))
1318 {
1319 enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */
1320 }
1321
1322 return enabledViewCnt;
1323 }
1324
1325