comparison Discovery/Src/t3.c @ 511:5185ade91096

Minor adaptions in page layout: WindowLineSpacing was used to establish a small separation from y0. This caused problems in string visualization (line > 1). To avoid the the window parameters have been adapted and WindowLineSpacing set to an value allowing two lines of data Removed instrumentation for BigFon_V2
author Ideenmodellierer
date Sun, 30 Aug 2020 17:30:54 +0200
parents 734f7ad46bca
children 0a09afac969f
comparison
equal deleted inserted replaced
510:0004704906d0 511:5185ade91096
67 CVIEW_Compass, 67 CVIEW_Compass,
68 CVIEW_T3_MaxDepth, 68 CVIEW_T3_MaxDepth,
69 CVIEW_T3_StopWatch, 69 CVIEW_T3_StopWatch,
70 CVIEW_T3_TTS, 70 CVIEW_T3_TTS,
71 CVIEW_T3_ppO2andGas, 71 CVIEW_T3_ppO2andGas,
72 CVIEW_T3_Navigation,
73 CVIEW_T3_DepthData,
72 CVIEW_T3_END 74 CVIEW_T3_END
73 }; 75 };
74
75 #ifdef ENABLE_BIGFONT_VX
76 const uint8_t t3_customviewsV2[] =
77 {
78 CVIEW_T3_Decostop,
79 CVIEW_sensors,
80 CVIEW_T3_Navigation,
81 CVIEW_T3_DepthData,
82 CVIEW_T3_TTS,
83 CVIEW_T3_ppO2andGas,
84 CVIEW_T3_END
85 };
86 #endif
87 76
88 /* Private function prototypes -----------------------------------------------*/ 77 /* Private function prototypes -----------------------------------------------*/
89 void t3_refresh_divemode(void); 78 void t3_refresh_divemode(void);
90 79
91 uint8_t t3_test_customview_warnings(void); 80 uint8_t t3_test_customview_warnings(void);
144 t3r1.WindowY0 = t3l1.WindowY0; 133 t3r1.WindowY0 = t3l1.WindowY0;
145 t3r1.WindowY1 = t3l1.WindowY1; 134 t3r1.WindowY1 = t3l1.WindowY1;
146 135
147 t3c1.Image = &t3screen; 136 t3c1.Image = &t3screen;
148 t3c1.WindowNumberOfTextLines = 2; 137 t3c1.WindowNumberOfTextLines = 2;
149 t3c1.WindowLineSpacing = t3l1.WindowLineSpacing; 138 t3c1.WindowLineSpacing = 100;
150 t3c1.WindowX0 = 0; 139 t3c1.WindowX0 = 0;
151 t3c1.WindowX1 = 799; 140 t3c1.WindowX1 = 799;
152 if(!pSettings->FlipDisplay) 141 if(!pSettings->FlipDisplay)
153 { 142 {
154 t3c1.WindowY0 = 0; 143 t3c1.WindowY0 = 5;
155 t3c1.WindowY1 = BigFontSeperationTopBottom - 5; 144 t3c1.WindowY1 = BigFontSeperationTopBottom - 5;
156 } 145 }
157 else 146 else
158 { 147 {
159 t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5; 148 t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5;
160 t3c1.WindowY1 = 479; 149 t3c1.WindowY1 = 479 - 5;
161 } 150 }
162 151
163 t3c2.Image = &t3screen; 152 t3c2.Image = &t3screen;
164 t3c2.WindowNumberOfTextLines = 3; 153 t3c2.WindowNumberOfTextLines = 3;
165 t3c2.WindowLineSpacing = 58; 154 t3c2.WindowLineSpacing = t3c1.WindowLineSpacing ;
166 t3c2.WindowX0 = 370; 155 t3c2.WindowX0 = 370;
167 t3c2.WindowX1 = 799; 156 t3c2.WindowX1 = 799;
168 t3c2.WindowY0 = t3c1.WindowY0; 157 t3c2.WindowY0 = t3c1.WindowY0;
169 t3c2.WindowY1 = t3c1.WindowY1; 158 t3c2.WindowY1 = t3c1.WindowY1;
170 t3c2.WindowTab = 600; 159 t3c2.WindowTab = 600;
1015 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage); 1004 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage);
1016 t3_basics_colorscheme_mod(text); 1005 t3_basics_colorscheme_mod(text);
1017 GFX_write_string(&FontT48,tXc1,text,0); 1006 GFX_write_string(&FontT48,tXc1,text,0);
1018 break; 1007 break;
1019 1008
1020 #ifdef ENABLE_BIGFONT_VX
1021 case CVIEW_T3_Navigation: 1009 case CVIEW_T3_Navigation:
1022 Stopwatch.Total = timer_Stopwatch_GetTime(); 1010 Stopwatch.Total = timer_Stopwatch_GetTime();
1023 Stopwatch.Minutes = Stopwatch.Total / 60; 1011 Stopwatch.Minutes = Stopwatch.Total / 60;
1024 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); 1012 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 );
1025 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); 1013 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter();
1033 tXc2->WindowX1 = 800; 1021 tXc2->WindowX1 = 800;
1034 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */ 1022 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */
1035 } 1023 }
1036 1024
1037 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); 1025 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch);
1038 GFX_write_string(&FontT42,tXc2,text,0); 1026 GFX_write_string(&FontT42,tXc1,text,0);
1039 snprintf(text,TEXTSIZE,"\030\016\002%01.1f",unit_depth_float(fAverageDepth)); 1027 snprintf(text,TEXTSIZE,"\030\016\002%01.1f",unit_depth_float(fAverageDepth));
1040 GFX_write_string(&FontT105,tXc2,text,0); 1028 GFX_write_string(&FontT105,tXc1,text,0);
1041 if(!pSettings->FlipDisplay) 1029 if(!pSettings->FlipDisplay)
1042 { 1030 {
1043 tXc2->WindowY0 = 100; 1031 tXc2->WindowY0 = 100;
1044 } 1032 }
1045 else 1033 else
1046 { 1034 {
1047 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ 1035 tXc2->WindowY1 -= 100; /* jump to upper of two lines */
1048 } 1036 }
1049 1037
1050 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); 1038 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds);
1051 GFX_write_string(&FontT105,tXc2,text,0); 1039 GFX_write_string(&FontT105,tXc1,text,1);
1052 1040
1053 1041
1054 center.x = 400; 1042 center.x = 400;
1055 center.y = 116; 1043 center.y = 116;
1056 1044
1097 { 1085 {
1098 GFX_write_string(&FontT105,tXc1,text,0); 1086 GFX_write_string(&FontT105,tXc1,text,0);
1099 } 1087 }
1100 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; 1088 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter;
1101 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); 1089 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth);
1102 GFX_write_string(&FontT42,tXc2,text,0); 1090 GFX_write_string(&FontT42,tXc1,text,0);
1103 1091
1104 snprintf(text,TEXTSIZE,"\020\003\016\002\%01.1f",unit_depth_float(fAverageDepthAbsolute)); 1092 snprintf(text,TEXTSIZE,"\020\003\016\002\%01.1f",unit_depth_float(fAverageDepthAbsolute));
1105 GFX_write_string(&FontT105,tXc2,text,0); 1093 GFX_write_string(&FontT105,tXc1,text,0);
1106 break; 1094 break;
1107 #endif
1108 } 1095 }
1109 1096
1110 1097
1111 1098
1112 tXc1->WindowX0 = tempWinX0; 1099 tXc1->WindowX0 = tempWinX0;
1148 1135
1149 lineFree = 1; 1136 lineFree = 1;
1150 more = 0; 1137 more = 0;
1151 1138
1152 textpointerMain = 0; 1139 textpointerMain = 0;
1153 textMain[textpointerMain++] = '\025'; 1140 textMain[textpointerMain++] = '\025'; /* red */
1154 textMain[textpointerMain++] = '\003'; 1141 textMain[textpointerMain++] = '\003'; /* doublesize */
1155 1142
1156 textpointer = 0; 1143 textpointer = 0;
1157 1144
1158 text[textpointer++] = '\021'; 1145 text[textpointer++] = '\021';
1159 text[textpointer++] = TXT_2BYTE; 1146 text[textpointer++] = TXT_2BYTE;
1288 else 1275 else
1289 text[textpointer++] = 'X'; 1276 text[textpointer++] = 'X';
1290 text[textpointer] = 0; 1277 text[textpointer] = 0;
1291 } 1278 }
1292 */ 1279 */
1293 GFX_write_string(&FontT48,&t3c1,textMain,1); 1280 GFX_write_string(&FontT48,&t3c1,textMain,0);
1294 if(more) 1281 if(more)
1295 { 1282 {
1296 GFX_write_string(&FontT48,&t3c2,text,1); 1283 GFX_write_string(&FontT48,&t3c2,text,0);
1297 } 1284 }
1298 } 1285 }
1299 1286
1300 uint8_t t3_customview_disabled(uint8_t view) 1287 uint8_t t3_customview_disabled(uint8_t view)
1301 { 1288 {
1302 uint8_t i = 0; 1289 uint8_t i = 0;
1303 uint8_t cv_disabled = 0; 1290 uint8_t cv_disabled = 0;
1304 const uint8_t *pcv_changelist; 1291 const uint8_t *pcv_changelist;
1305 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; 1292 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen;
1306 1293
1307 #ifdef ENABLE_BIGFONT_VX 1294 pcv_changelist = cv_changelist_BS;
1308 if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2)
1309 {
1310 pcv_changelist = cv_changelist_BSV2;
1311 }
1312 else
1313 #endif
1314 {
1315 pcv_changelist = cv_changelist_BS;
1316 }
1317 1295
1318 while(pcv_changelist[i] != CVIEW_T3_END) 1296 while(pcv_changelist[i] != CVIEW_T3_END)
1319 { 1297 {
1320 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i])) 1298 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i]))
1321 { 1299 {
1334 return cv_disabled; 1312 return cv_disabled;
1335 } 1313 }
1336 1314
1337 void t3_change_customview(uint8_t action) 1315 void t3_change_customview(uint8_t action)
1338 { 1316 {
1339 #ifdef ENABLE_BIGFONT_VX 1317
1340 if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2)
1341 {
1342 t3_basics_change_customview(&t3_selection_customview, t3_customviewsV2, action);
1343 }
1344 else
1345 {
1346 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action);
1347 }
1348 #else
1349 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); 1318 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action);
1350 #endif 1319 }
1351 } 1320
1352 1321
1353 1322 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action)
1354 void t3_basics_change_customview(uint8_t *tX_selection_customview, uint8_t *tX_customviews, uint8_t action)
1355 { 1323 {
1356 const SDecoinfo * pDecoinfo; 1324 const SDecoinfo * pDecoinfo;
1357 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) 1325 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
1358 pDecoinfo = &stateUsed->decolistBuehlmann; 1326 pDecoinfo = &stateUsed->decolistBuehlmann;
1359 else 1327 else
1360 pDecoinfo = &stateUsed->decolistVPM; 1328 pDecoinfo = &stateUsed->decolistVPM;
1361 1329
1362 uint8_t curView; 1330 uint8_t curViewIdx = 0xff;
1363 uint8_t *pViews; 1331 uint8_t index = 0;
1364 pViews = tX_customviews; 1332 uint8_t lastViewIdx = 0;
1365
1366 uint8_t *pStartView,*pCurView, *pLastView;
1367 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ 1333 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */
1368 1334
1369 pStartView = pViews;
1370 curView = CVIEW_T3_END;
1371 /* set pointer to currently selected view and count number of entries */ 1335 /* set pointer to currently selected view and count number of entries */
1372 while((*pViews != CVIEW_T3_END)) 1336 while((tX_customviews[index] != CVIEW_T3_END))
1373 { 1337 {
1374 if (*pViews == *tX_selection_customview) 1338 if (tX_customviews[index] == *tX_selection_customview)
1375 { 1339 {
1376 pCurView = pViews; 1340 curViewIdx = index;
1377 curView = *pViews;
1378 } 1341 }
1379 pViews++; 1342 index++;
1380 } 1343 }
1381 if(curView == CVIEW_T3_END) /* called with unknown view */ 1344 if(curViewIdx == 0xff) /* called with unknown view */
1382 { 1345 {
1383 *tX_selection_customview = CVIEW_T3_Decostop; 1346 curViewIdx = 0;
1384 pCurView = pStartView; 1347 *tX_selection_customview = tX_customviews[index];
1385 } 1348 }
1386 pLastView = pViews; 1349 lastViewIdx = index;
1387 pViews = pCurView; 1350 index = curViewIdx;
1388
1389 do 1351 do
1390 { 1352 {
1391 iterate = 0; 1353 iterate = 0;
1392 switch(action) 1354 switch(action)
1393 { 1355 {
1394 case ACTION_BUTTON_ENTER: 1356 case ACTION_BUTTON_ENTER:
1395 case ACTION_PITCH_POS: 1357 case ACTION_PITCH_POS:
1396 1358
1397 if(*pViews != CVIEW_T3_END) 1359 if(tX_customviews[index] != CVIEW_T3_END)
1398 pViews++;
1399
1400 if(*pViews == CVIEW_T3_END)
1401 { 1360 {
1402 pViews = pStartView; 1361 index++;
1362 }
1363 if(tX_customviews[index] == CVIEW_T3_END)
1364 {
1365 index = 0;
1403 } 1366 }
1404 break; 1367 break;
1405 case ACTION_PITCH_NEG: 1368 case ACTION_PITCH_NEG:
1406 if(pViews == pStartView) 1369 if(index == 0)
1407 { 1370 {
1408 pViews = pLastView - 1; 1371 index = lastViewIdx - 1;
1409 } 1372 }
1410 else 1373 else
1411 { 1374 {
1412 pViews--; 1375 index--;
1413 } 1376 }
1414 break; 1377 break;
1415 default: 1378 default:
1416 break; 1379 break;
1417 } 1380 }
1418 1381
1419 if(t3_customview_disabled(*pViews)) 1382 if(t3_customview_disabled(tX_customviews[index]))
1420 { 1383 {
1421 iterate = 1; 1384 iterate = 1;
1422 } 1385 }
1423 if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) 1386 if((tX_customviews[index] == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds)
1424 { 1387 {
1425 iterate = 1; 1388 iterate = 1;
1426 } 1389 }
1427 if((iterate) && (action == ACTION_END)) 1390 if((iterate) && (action == ACTION_END))
1428 { 1391 {
1429 action = ACTION_BUTTON_ENTER; 1392 action = ACTION_BUTTON_ENTER;
1430 } 1393 }
1431 }while (iterate == 1); 1394 }while (iterate == 1);
1432 1395
1433 *tX_selection_customview = *pViews; 1396 *tX_selection_customview = tX_customviews[index];
1434 } 1397 }
1435 1398
1436 1399
1437 void t3_basics_colorscheme_mod(char *text) 1400 void t3_basics_colorscheme_mod(char *text)
1438 { 1401 {
1574 { 1537 {
1575 uint8_t *pViews; 1538 uint8_t *pViews;
1576 uint8_t increment = 1; 1539 uint8_t increment = 1;
1577 uint8_t enabledViewCnt = 0; 1540 uint8_t enabledViewCnt = 0;
1578 1541
1579 #ifdef ENABLE_BIGFONT_VX 1542 pViews = (uint8_t*)t3_customviewsStandard;
1580 if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2)
1581 {
1582 pViews = (uint8_t*)t3_customviewsV2;
1583 }
1584 else
1585 {
1586 pViews = (uint8_t*)t3_customviewsStandard;
1587 }
1588
1589 while((*pViews != CVIEW_T3_END)) 1543 while((*pViews != CVIEW_T3_END))
1590 { 1544 {
1591 increment = 1; 1545 increment = 1;
1592 /* check if view is enabled */ 1546 /* check if view is enabled */
1593 if(t3_customview_disabled(*pViews)) 1547 if(t3_customview_disabled(*pViews))
1595 increment = 0; 1549 increment = 0;
1596 } 1550 }
1597 pViews++; 1551 pViews++;
1598 enabledViewCnt += increment; 1552 enabledViewCnt += increment;
1599 } 1553 }
1600 #else
1601
1602 uint8_t i=0;
1603 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen;
1604 pcv_changelist = cv_changelist_BS;
1605 do
1606 {
1607 if(pcv_changelist[i] == CVIEW_sensors) /* at the moment specific big font view may not be selected. Only sensor setting is taken from t7 configuration */
1608 {
1609 if(!CHECK_BIT_THOME(cv_config, pcv_changelist[i]))
1610 {
1611 enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */
1612 }
1613 else
1614 {
1615 enabledViewCnt = NUMBER_OF_VIEWS; /* enable all possible views */
1616 }
1617 break;
1618 }
1619 i++;
1620 } while(pcv_changelist[i] != CVIEW_T3_END);
1621 if ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0))
1622 {
1623 enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */
1624 }
1625 #endif
1626 return enabledViewCnt; 1554 return enabledViewCnt;
1627 } 1555 }
1628 1556
1629 1557