comparison Discovery/Src/t3.c @ 518:0a09afac969f

Added T3_gaslist: Big font gas list was shown in gauge mode only. The previous version used the font48. To increase readability the gases are not shown in T42 double size. Added color coding for cv gas list: In previous version only a warning was highlighted using the red color. Now a better gas selection is highlighted in green. Gas without notification is blue while the active gas is shown in white
author Ideenmodellierer
date Sun, 06 Sep 2020 21:17:59 +0200
parents 5185ade91096
children 962d7b2c18c6
comparison
equal deleted inserted replaced
517:85e0945552ce 518:0a09afac969f
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_GasList,
72 CVIEW_T3_Navigation, 73 CVIEW_T3_Navigation,
73 CVIEW_T3_DepthData, 74 CVIEW_T3_DepthData,
74 CVIEW_T3_END 75 CVIEW_T3_END
75 }; 76 };
76 77
131 } 132 }
132 133
133 t3r1.WindowY0 = t3l1.WindowY0; 134 t3r1.WindowY0 = t3l1.WindowY0;
134 t3r1.WindowY1 = t3l1.WindowY1; 135 t3r1.WindowY1 = t3l1.WindowY1;
135 136
137 /* t3c1 is across the complete lower part of the display */
136 t3c1.Image = &t3screen; 138 t3c1.Image = &t3screen;
137 t3c1.WindowNumberOfTextLines = 2; 139 t3c1.WindowNumberOfTextLines = 2;
138 t3c1.WindowLineSpacing = 100; 140 t3c1.WindowLineSpacing = 84 + 5; /* double font + spacing */
139 t3c1.WindowX0 = 0; 141 t3c1.WindowX0 = 0;
140 t3c1.WindowX1 = 799; 142 t3c1.WindowX1 = 799;
141 if(!pSettings->FlipDisplay) 143 if(!pSettings->FlipDisplay)
142 { 144 {
143 t3c1.WindowY0 = 5; 145 t3c1.WindowY0 = 5;
147 { 149 {
148 t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5; 150 t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5;
149 t3c1.WindowY1 = 479 - 5; 151 t3c1.WindowY1 = 479 - 5;
150 } 152 }
151 153
154 /* t3c2 is just showing the lower right part of the display */
152 t3c2.Image = &t3screen; 155 t3c2.Image = &t3screen;
153 t3c2.WindowNumberOfTextLines = 3; 156 t3c2.WindowNumberOfTextLines = 3;
154 t3c2.WindowLineSpacing = t3c1.WindowLineSpacing ; 157 t3c2.WindowLineSpacing = t3c1.WindowLineSpacing ;
155 t3c2.WindowX0 = 370; 158 t3c2.WindowX0 = 370;
156 t3c2.WindowX1 = 799; 159 t3c2.WindowX1 = 799;
198 201
199 /* Private functions ---------------------------------------------------------*/ 202 /* Private functions ---------------------------------------------------------*/
200 203
201 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) 204 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode)
202 { 205 {
203 char text[512]; 206 char text[256];
207 uint8_t textPointer;
204 uint8_t color; 208 uint8_t color;
205 uint8_t depthChangeRate; 209 uint8_t depthChangeRate;
206 uint8_t depthChangeAscent; 210 uint8_t depthChangeAscent;
207 point_t start, stop, startZeroLine; 211 point_t start, stop, startZeroLine;
212 SDivetime Divetime = {0,0,0,0};
208 213
209 SSettings* pSettings; 214 SSettings* pSettings;
210 pSettings = settingsGetPointer(); 215 pSettings = settingsGetPointer();
211 216
212 start.x = 0; 217 start.x = 0;
430 435
431 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds); 436 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds);
432 } 437 }
433 else 438 else
434 { 439 {
435 SDivetime Divetime = {0,0,0, 0};
436
437 Divetime.Total = stateUsed->lifeData.dive_time_seconds; 440 Divetime.Total = stateUsed->lifeData.dive_time_seconds;
438 Divetime.Minutes = Divetime.Total / 60; 441 Divetime.Minutes = Divetime.Total / 60;
439 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); 442 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 );
440 443
441 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); 444 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime);
444 if(Divetime.Minutes < 100) 447 if(Divetime.Minutes < 100)
445 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); 448 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds);
446 else 449 else
447 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes); 450 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes);
448 } 451 }
452 t3_basics_colorscheme_mod(text);
453 GFX_write_string(&FontT105,tXr1,text,1);
449 } 454 }
450 else 455 else
451 { 456 {
452 SDivetime Divetime = {0,0,0, 0}; 457 switch(get_globalState())
453 458 {
454 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; 459 case StDBEAR: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveBearingQ);
455 Divetime.Minutes = Divetime.Total / 60; 460 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
456 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); 461 break;
457 462 case StDRAVG: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveResetAvgQ);
458 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); 463 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
459 GFX_write_string(&FontT42,tXr1,text,0); 464 break;
460 465
461 if(Divetime.Minutes < 100) 466 case StDMGAS:
462 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); 467 textPointer = 0;
463 else 468 text[textPointer++] = '\a';
464 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes); 469 text[textPointer++] = '\001';
465 } 470 text[textPointer++] = ' ';
466 t3_basics_colorscheme_mod(text); 471 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&text[textPointer]);
467 GFX_write_string(&FontT105,tXr1,text,1); 472 text[textPointer++] = '?';
473 text[textPointer++] = ' ';
474 text[textPointer++] = 0;
475 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow);
476 break;
477 default: /* show divetime */
478
479 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time;
480 Divetime.Minutes = Divetime.Total / 60;
481 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 );
482
483 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime);
484 GFX_write_string(&FontT42,tXr1,text,0);
485
486 if(Divetime.Minutes < 100)
487 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds);
488 else
489 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes);
490
491 t3_basics_colorscheme_mod(text);
492 GFX_write_string(&FontT105,tXr1,text,1);
493 break;
494 }
495 }
468 496
469 return depth; 497 return depth;
470 } 498 }
471 499
472 500
473 void t3_refresh_divemode(void) 501 void t3_refresh_divemode(void)
474 { 502 {
475 uint8_t customview_warnings = 0; 503 uint8_t customview_warnings = 0;
476 float depth_meter = 0.0; 504 float depth_meter = 0.0;
477 505 char text[30];
478 // everything like lines, depth, ascent graph and divetime 506 // everything like lines, depth, ascent graph and divetime
479 depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials 507 depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials
508
480 509
481 // customview 510 // customview
482 if(stateUsed->warnings.numWarnings) 511 if(stateUsed->warnings.numWarnings)
483 customview_warnings = t3_test_customview_warnings(); 512 customview_warnings = t3_test_customview_warnings();
484 513
787 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); 816 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist);
788 GFX_write_string(&FontT42,tXc1,text,0); 817 GFX_write_string(&FontT42,tXc1,text,0);
789 818
790 textpointer = 0; 819 textpointer = 0;
791 tXc2->WindowX0 = 0; 820 tXc2->WindowX0 = 0;
792 tXc2->WindowTab = 800/2; 821 tXc2->WindowTab = 800/3; // /2
793 822
794 if(pSettings->FlipDisplay) 823 if(pSettings->FlipDisplay)
795 { 824 {
796 tXc2->WindowY1 = 0; 825 tXc2->WindowY1 = 0;
797 } 826 }
803 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; 832 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100;
804 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; 833 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100;
805 for(int gasId=1;gasId<=NUM_GASES;gasId++) 834 for(int gasId=1;gasId<=NUM_GASES;gasId++)
806 { 835 {
807 textpointer = 0; 836 textpointer = 0;
837 text[textpointer++] = '\003';
808 lineNumber = gasId; 838 lineNumber = gasId;
809 if(gasId > 3) 839 if(gasId > 3)
810 { 840 {
811 text[textpointer++] = '\t'; 841 text[textpointer++] = '\002'; /* display right aligned */
812 lineNumber = gasId - 3; 842 lineNumber = gasId %4;
813 } 843 }
844 else if(gasId > 1)
845 {
846 text[textpointer++] = '\001'; /* display centered */
847 lineNumber = gasId %2;
848 }
849
814 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; 850 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100;
815 if(pGasLine[gasId].note.ub.active == 0) 851 if(pGasLine[gasId].note.ub.active == 0)
816 strcpy(&text[textpointer++],"\021"); 852 strcpy(&text[textpointer++],"\021");
853 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */
854 {
855 strcpy(&text[textpointer++],"\030");
856 }
817 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) 857 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow))
818 strcpy(&text[textpointer++],"\025"); 858 strcpy(&text[textpointer++],"\025");
859 else if(actualBetterGasId() == gasId)
860 {
861 strcpy(&text[textpointer++],"\026"); /* Highlight better gas */
862 }
819 else 863 else
820 strcpy(&text[textpointer++],"\030"); 864 strcpy(&text[textpointer++],"\023"); /* Blue for travel or deco without special state */
821 865
822 text[textpointer++] = ' '; 866 text[textpointer++] = ' ';
823 oxygen = pGasLine[gasId].oxygen_percentage; 867 oxygen = pGasLine[gasId].oxygen_percentage;
824 helium = pGasLine[gasId].helium_percentage; 868 helium = pGasLine[gasId].helium_percentage;
825 textpointer += write_gas(&text[textpointer], oxygen, helium); 869 textpointer += write_gas(&text[textpointer], oxygen, helium);
826 GFX_write_string(&FontT42, tXc2, text, lineNumber); 870 GFX_write_string(&FontT42, tXc1, text, lineNumber);
827 } 871 }
828 break; 872 break;
829 873
830 case CVIEW_T3_Temperature: 874 case CVIEW_T3_Temperature:
831 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); 875 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature);
1552 enabledViewCnt += increment; 1596 enabledViewCnt += increment;
1553 } 1597 }
1554 return enabledViewCnt; 1598 return enabledViewCnt;
1555 } 1599 }
1556 1600
1557 1601 uint8_t t3_getCustomView(void)
1602 {
1603 return t3_selection_customview;
1604 }