comparison Discovery/Src/t3.c @ 527:962d7b2c18c6

Do not show gases in "Off" state in custom gas list: May be added / removed from code using "ENABLE_UNUSED_GAS_HIDING"
author Ideenmodellierer
date Sun, 13 Sep 2020 20:58:37 +0200
parents 0a09afac969f
children 0e1db77b2aca
comparison
equal deleted inserted replaced
526:88c626d01ee5 527:962d7b2c18c6
500 500
501 void t3_refresh_divemode(void) 501 void t3_refresh_divemode(void)
502 { 502 {
503 uint8_t customview_warnings = 0; 503 uint8_t customview_warnings = 0;
504 float depth_meter = 0.0; 504 float depth_meter = 0.0;
505 char text[30]; 505
506 // everything like lines, depth, ascent graph and divetime 506 // everything like lines, depth, ascent graph and divetime
507 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
509 508
510 // customview 509 // customview
511 if(stateUsed->warnings.numWarnings) 510 if(stateUsed->warnings.numWarnings)
512 customview_warnings = t3_test_customview_warnings(); 511 customview_warnings = t3_test_customview_warnings();
513 512
696 // CVIEW_T3_GasList 695 // CVIEW_T3_GasList
697 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; 696 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth;
698 const SGasLine * pGasLine; 697 const SGasLine * pGasLine;
699 uint8_t oxygen, helium; 698 uint8_t oxygen, helium;
700 uint8_t lineNumber; 699 uint8_t lineNumber;
700 uint8_t gasPosIdx;
701 701
702 /* compass position */ 702 /* compass position */
703 point_t center; 703 point_t center;
704 704
705 // CVIEW_T3_StopWatch 705 // CVIEW_T3_StopWatch
811 GFX_write_string(&FontT105,tXc1,text,0); 811 GFX_write_string(&FontT105,tXc1,text,0);
812 812
813 break; 813 break;
814 814
815 case CVIEW_T3_GasList: 815 case CVIEW_T3_GasList:
816 gasPosIdx = 0;
816 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); 817 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist);
817 GFX_write_string(&FontT42,tXc1,text,0); 818 GFX_write_string(&FontT42,tXc1,text,0);
818 819
819 textpointer = 0; 820 textpointer = 0;
820 tXc2->WindowX0 = 0; 821 tXc2->WindowX0 = 0;
831 else 832 else
832 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; 833 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100;
833 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; 834 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100;
834 for(int gasId=1;gasId<=NUM_GASES;gasId++) 835 for(int gasId=1;gasId<=NUM_GASES;gasId++)
835 { 836 {
837 #ifdef ENABLE_UNUSED_GAS_HIDING
838 if(!pGasLine[gasId].note.ub.off)
839 {
840 #endif
836 textpointer = 0; 841 textpointer = 0;
837 text[textpointer++] = '\003'; 842 text[textpointer++] = '\003';
838 lineNumber = gasId; 843
839 if(gasId > 3) 844 lineNumber = 1;
840 { 845
841 text[textpointer++] = '\002'; /* display right aligned */ 846 switch(gasPosIdx)
842 lineNumber = gasId %4; 847 {
843 } 848 case 0: lineNumber = 0;
844 else if(gasId > 1) 849 case 1:
845 { 850 break;
846 text[textpointer++] = '\001'; /* display centered */ 851 case 4: text[textpointer++] = '\001'; /* display centered */
847 lineNumber = gasId %2; 852 break;
848 } 853 case 2: lineNumber = 0;
854 case 3: text[textpointer++] = '\002'; /* display right aligned */
855 default:
856 break;
857 }
858 #if 0
859 if(gasPosIdx < 3)
860 {
861 lineNumber = 1;
862 }
863 else
864 {
865 lineNumber = 0;
866 }
867 #endif
868 gasPosIdx++;
849 869
850 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; 870 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100;
851 if(pGasLine[gasId].note.ub.active == 0) 871 if(pGasLine[gasId].note.ub.active == 0)
852 strcpy(&text[textpointer++],"\021"); 872 strcpy(&text[textpointer++],"\031");
853 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */ 873 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */
854 { 874 {
855 strcpy(&text[textpointer++],"\030"); 875 strcpy(&text[textpointer++],"\030");
856 } 876 }
857 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) 877 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow))
865 885
866 text[textpointer++] = ' '; 886 text[textpointer++] = ' ';
867 oxygen = pGasLine[gasId].oxygen_percentage; 887 oxygen = pGasLine[gasId].oxygen_percentage;
868 helium = pGasLine[gasId].helium_percentage; 888 helium = pGasLine[gasId].helium_percentage;
869 textpointer += write_gas(&text[textpointer], oxygen, helium); 889 textpointer += write_gas(&text[textpointer], oxygen, helium);
890
891 if((pGasLine[gasId].depth_meter) && (gasPosIdx < 5)) /* do not show for potential last gas because of formating issues */
892 {
893 textpointer += snprintf(&text[textpointer],7,"\016\016%u%c%c",unit_depth_integer(pGasLine[gasId].depth_meter), unit_depth_char1(), unit_depth_char2());
894 }
895 text[textpointer++] = 0;
870 GFX_write_string(&FontT42, tXc1, text, lineNumber); 896 GFX_write_string(&FontT42, tXc1, text, lineNumber);
897 #ifdef ENABLE_UNUSED_GAS_HIDING
898 }
899 #endif
871 } 900 }
872 break; 901 break;
873 902
874 case CVIEW_T3_Temperature: 903 case CVIEW_T3_Temperature:
875 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); 904 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature);
1184 textMain[textpointerMain++] = '\025'; /* red */ 1213 textMain[textpointerMain++] = '\025'; /* red */
1185 textMain[textpointerMain++] = '\003'; /* doublesize */ 1214 textMain[textpointerMain++] = '\003'; /* doublesize */
1186 1215
1187 textpointer = 0; 1216 textpointer = 0;
1188 1217
1189 text[textpointer++] = '\021'; 1218 text[textpointer++] = '\031';
1190 text[textpointer++] = TXT_2BYTE; 1219 text[textpointer++] = TXT_2BYTE;
1191 text[textpointer++] = TXT2BYTE_WarnDecoMissed; 1220 text[textpointer++] = TXT2BYTE_WarnDecoMissed;
1192 if(stateUsed->warnings.decoMissed) 1221 if(stateUsed->warnings.decoMissed)
1193 { 1222 {
1194 text[textpointer - 3] = '\025'; 1223 text[textpointer - 3] = '\025';
1204 more++; 1233 more++;
1205 } 1234 }
1206 } 1235 }
1207 1236
1208 text[textpointer++] = '\t'; 1237 text[textpointer++] = '\t';
1209 text[textpointer++] = '\021'; 1238 text[textpointer++] = '\031';
1210 text[textpointer++] = TXT_2BYTE; 1239 text[textpointer++] = TXT_2BYTE;
1211 text[textpointer++] = TXT2BYTE_WarnPPO2Low; 1240 text[textpointer++] = TXT2BYTE_WarnPPO2Low;
1212 if(stateUsed->warnings.ppO2Low) 1241 if(stateUsed->warnings.ppO2Low)
1213 { 1242 {
1214 text[textpointer - 3] = '\025'; 1243 text[textpointer - 3] = '\025';
1225 } 1254 }
1226 } 1255 }
1227 1256
1228 text[textpointer++] = '\n'; 1257 text[textpointer++] = '\n';
1229 text[textpointer++] = '\r'; 1258 text[textpointer++] = '\r';
1230 text[textpointer++] = '\021'; 1259 text[textpointer++] = '\031';
1231 text[textpointer++] = TXT_2BYTE; 1260 text[textpointer++] = TXT_2BYTE;
1232 text[textpointer++] = TXT2BYTE_WarnPPO2High; 1261 text[textpointer++] = TXT2BYTE_WarnPPO2High;
1233 if(stateUsed->warnings.ppO2High) 1262 if(stateUsed->warnings.ppO2High)
1234 { 1263 {
1235 text[textpointer - 3] = '\025'; 1264 text[textpointer - 3] = '\025';
1245 more++; 1274 more++;
1246 } 1275 }
1247 } 1276 }
1248 1277
1249 text[textpointer++] = '\t'; 1278 text[textpointer++] = '\t';
1250 text[textpointer++] = '\021'; 1279 text[textpointer++] = '\031';
1251 text[textpointer++] = TXT_2BYTE; 1280 text[textpointer++] = TXT_2BYTE;
1252 text[textpointer++] = TXT2BYTE_WarnFallback; 1281 text[textpointer++] = TXT2BYTE_WarnFallback;
1253 if(stateUsed->warnings.fallback) 1282 if(stateUsed->warnings.fallback)
1254 { 1283 {
1255 text[textpointer - 3] = '\025'; 1284 text[textpointer - 3] = '\025';
1266 } 1295 }
1267 } 1296 }
1268 1297
1269 text[textpointer++] = '\n'; 1298 text[textpointer++] = '\n';
1270 text[textpointer++] = '\r'; 1299 text[textpointer++] = '\r';
1271 text[textpointer++] = '\021'; 1300 text[textpointer++] = '\031';
1272 text[textpointer++] = TXT_2BYTE; 1301 text[textpointer++] = TXT_2BYTE;
1273 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; 1302 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost;
1274 if(stateUsed->warnings.sensorLinkLost) 1303 if(stateUsed->warnings.sensorLinkLost)
1275 { 1304 {
1276 text[textpointer - 3] = '\025'; 1305 text[textpointer - 3] = '\025';
1287 } 1316 }
1288 } 1317 }
1289 1318
1290 /* 1319 /*
1291 text[textpointer++] = '\t'; 1320 text[textpointer++] = '\t';
1292 text[textpointer++] = '\021'; 1321 text[textpointer++] = '\031';
1293 text[textpointer++] = TXT_2BYTE; 1322 text[textpointer++] = TXT_2BYTE;
1294 text[textpointer++] = TXT2BYTE_WarnBatteryLow; 1323 text[textpointer++] = TXT2BYTE_WarnBatteryLow;
1295 if(stateUsed->warnings.lowBattery) 1324 if(stateUsed->warnings.lowBattery)
1296 { 1325 {
1297 text[textpointer - 3] = '\025'; 1326 text[textpointer - 3] = '\025';