Mercurial > public > ostc4
changeset 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 | 88c626d01ee5 |
children | a9c195be907e |
files | Discovery/Src/t3.c Discovery/Src/t7.c |
diffstat | 2 files changed, 91 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Src/t3.c Sun Sep 13 20:55:54 2020 +0200 +++ b/Discovery/Src/t3.c Sun Sep 13 20:58:37 2020 +0200 @@ -502,11 +502,10 @@ { uint8_t customview_warnings = 0; float depth_meter = 0.0; - char text[30]; + // everything like lines, depth, ascent graph and divetime depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials - // customview if(stateUsed->warnings.numWarnings) customview_warnings = t3_test_customview_warnings(); @@ -698,6 +697,7 @@ const SGasLine * pGasLine; uint8_t oxygen, helium; uint8_t lineNumber; + uint8_t gasPosIdx; /* compass position */ point_t center; @@ -813,6 +813,7 @@ break; case CVIEW_T3_GasList: + gasPosIdx = 0; snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); GFX_write_string(&FontT42,tXc1,text,0); @@ -833,23 +834,42 @@ fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; for(int gasId=1;gasId<=NUM_GASES;gasId++) { +#ifdef ENABLE_UNUSED_GAS_HIDING + if(!pGasLine[gasId].note.ub.off) + { +#endif textpointer = 0; text[textpointer++] = '\003'; - lineNumber = gasId; - if(gasId > 3) + + lineNumber = 1; + + switch(gasPosIdx) { - text[textpointer++] = '\002'; /* display right aligned */ - lineNumber = gasId %4; + case 0: lineNumber = 0; + case 1: + break; + case 4: text[textpointer++] = '\001'; /* display centered */ + break; + case 2: lineNumber = 0; + case 3: text[textpointer++] = '\002'; /* display right aligned */ + default: + break; } - else if(gasId > 1) +#if 0 + if(gasPosIdx < 3) { - text[textpointer++] = '\001'; /* display centered */ - lineNumber = gasId %2; + lineNumber = 1; } + else + { + lineNumber = 0; + } +#endif + gasPosIdx++; fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; if(pGasLine[gasId].note.ub.active == 0) - strcpy(&text[textpointer++],"\021"); + strcpy(&text[textpointer++],"\031"); else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */ { strcpy(&text[textpointer++],"\030"); @@ -867,7 +887,16 @@ oxygen = pGasLine[gasId].oxygen_percentage; helium = pGasLine[gasId].helium_percentage; textpointer += write_gas(&text[textpointer], oxygen, helium); + + if((pGasLine[gasId].depth_meter) && (gasPosIdx < 5)) /* do not show for potential last gas because of formating issues */ + { + textpointer += snprintf(&text[textpointer],7,"\016\016%u%c%c",unit_depth_integer(pGasLine[gasId].depth_meter), unit_depth_char1(), unit_depth_char2()); + } + text[textpointer++] = 0; GFX_write_string(&FontT42, tXc1, text, lineNumber); +#ifdef ENABLE_UNUSED_GAS_HIDING + } +#endif } break; @@ -1186,7 +1215,7 @@ textpointer = 0; - text[textpointer++] = '\021'; + text[textpointer++] = '\031'; text[textpointer++] = TXT_2BYTE; text[textpointer++] = TXT2BYTE_WarnDecoMissed; if(stateUsed->warnings.decoMissed) @@ -1206,7 +1235,7 @@ } text[textpointer++] = '\t'; - text[textpointer++] = '\021'; + text[textpointer++] = '\031'; text[textpointer++] = TXT_2BYTE; text[textpointer++] = TXT2BYTE_WarnPPO2Low; if(stateUsed->warnings.ppO2Low) @@ -1227,7 +1256,7 @@ text[textpointer++] = '\n'; text[textpointer++] = '\r'; - text[textpointer++] = '\021'; + text[textpointer++] = '\031'; text[textpointer++] = TXT_2BYTE; text[textpointer++] = TXT2BYTE_WarnPPO2High; if(stateUsed->warnings.ppO2High) @@ -1247,7 +1276,7 @@ } text[textpointer++] = '\t'; - text[textpointer++] = '\021'; + text[textpointer++] = '\031'; text[textpointer++] = TXT_2BYTE; text[textpointer++] = TXT2BYTE_WarnFallback; if(stateUsed->warnings.fallback) @@ -1268,7 +1297,7 @@ text[textpointer++] = '\n'; text[textpointer++] = '\r'; - text[textpointer++] = '\021'; + text[textpointer++] = '\031'; text[textpointer++] = TXT_2BYTE; text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; if(stateUsed->warnings.sensorLinkLost) @@ -1289,7 +1318,7 @@ /* text[textpointer++] = '\t'; - text[textpointer++] = '\021'; + text[textpointer++] = '\031'; text[textpointer++] = TXT_2BYTE; text[textpointer++] = TXT2BYTE_WarnBatteryLow; if(stateUsed->warnings.lowBattery)
--- a/Discovery/Src/t7.c Sun Sep 13 20:55:54 2020 +0200 +++ b/Discovery/Src/t7.c Sun Sep 13 20:58:37 2020 +0200 @@ -28,7 +28,7 @@ /* Includes ------------------------------------------------------------------*/ #include "t7.h" - +#include "settings.h" #include "data_exchange_main.h" #include "decom.h" #include "gfx_fonts.h" @@ -39,6 +39,7 @@ #include "timer.h" #include "unit.h" #include "motion.h" +#include "configuration.h" /* Private function prototypes -----------------------------------------------*/ @@ -674,6 +675,7 @@ { static float debounceAmbientPressure = 0; char text[256]; + uint8_t loop, textIdx; uint8_t date[3], year,month,day; uint32_t color; uint8_t customview_warnings = 0; @@ -744,16 +746,16 @@ if(Stime.Seconds % 2) snprintf(text,255,"\001%02d:%02d",Stime.Hours,Stime.Minutes); else - snprintf(text,255,"\001%02d\021:\020%02d",Stime.Hours,Stime.Minutes); + snprintf(text,255,"\001%02d\031:\020%02d",Stime.Hours,Stime.Minutes); GFX_write_string(&FontT54,&t7surfaceR,text,3); */ // debug version: if(Stime.Seconds % 2) snprintf(text,255,"\001%02d:%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds); else if(dateNotSet) - snprintf(text,255,"\001\021%02d:%02d:%02d\020",Stime.Hours,Stime.Minutes,Stime.Seconds); + snprintf(text,255,"\001\031%02d:%02d:%02d\020",Stime.Hours,Stime.Minutes,Stime.Seconds); else - snprintf(text,255,"\001%02d\021:\020%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds); + snprintf(text,255,"\001%02d\031:\020%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds); GFX_write_string(&FontT54,&t7surfaceR,text,3); if(settingsGetPointer()->date_format == DDMMYY) @@ -782,7 +784,7 @@ if((Stime.Seconds % 2) || (dateNotSet == 0)) snprintf(text,255,"\001%02d.%02d.%02d",date[0],date[1],date[2]); else - snprintf(text,255,"\001\021%02d.%02d.%02d",date[0],date[1],date[2]); + snprintf(text,255,"\001\031%02d.%02d.%02d",date[0],date[1],date[2]); GFX_write_string(&FontT54,&t7surfaceR,text,5); @@ -799,7 +801,7 @@ text[5] += Sdate.WeekDay; if(!(Stime.Seconds % 2) && (dateNotSet == 1)) - text[1] = '\021'; + text[1] = '\031'; GFX_write_string(&FontT48,&t7surfaceR,text,4); } @@ -967,39 +969,37 @@ } else { - text[0] = '\021'; - text[1] = '1'; - text[2] = '\177'; - text[3] = '\177'; - text[4] = 10; - text[5] = '\021'; - text[6] = '2'; - text[7] = '\177'; - text[8] = '\177'; - text[9] = 10; - text[10] = '\021'; - text[11] = '3'; - text[12] = '\177'; - text[13] = '\177'; - text[14] = 10; - text[15] = '\021'; - text[16] = '4'; - text[17] = '\177'; - text[18] = '\177'; - text[19] = 10; - text[20] = '\021'; - text[21] = '5'; - text[22] = 0; - + textIdx = 0; if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) gasOffset = NUM_OFFSET_DILUENT; else gasOffset = 0; - for(int i=1;i<=5;i++) - { - if(stateUsed->diveSettings.gas[i+gasOffset].note.ub.active) - text[(i-1)*5] -= 1; - } + + /* Display gas setup */ + for(loop = 1; loop <= NUM_GASES; loop++) + { +#ifdef ENABLE_UNUSED_GAS_HIDING + if(stateUsed->diveSettings.gas[loop+gasOffset].note.ub.off) + { + text[textIdx++] = '\021'; + } + else +#endif + if(stateUsed->diveSettings.gas[loop+gasOffset].note.ub.active) + { + text[textIdx++]= '\020'; + } + else + { + text[textIdx++]= '\031'; + } + + text[textIdx++] = '0' + loop; + text[textIdx++] = '\177'; + text[textIdx++] = '\177'; + text[textIdx++] = 10; + } + text[textIdx++] = 0; GFX_write_string(&FontT48,&t7surfaceL,text,6); @@ -1794,9 +1794,13 @@ for(int gasId=1;gasId<=NUM_GASES;gasId++) { textpointer = 0; +#ifdef ENABLE_UNUSED_GAS_HIDING + if(!pGasLine[gasId].note.ub.off) + { +#endif fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; if(pGasLine[gasId].note.ub.active == 0) - strcpy(&text[textpointer++],"\021"); + strcpy(&text[textpointer++],"\031"); else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */ { strcpy(&text[textpointer++],"\030"); @@ -1820,6 +1824,9 @@ textpointer += snprintf(&text[textpointer],7,"\t%u %c%c",unit_depth_integer(pGasLine[gasId].depth_meter), unit_depth_char1(), unit_depth_char2()); } GFX_write_string(&FontT42, &t7cY0free, text, gasId); +#ifdef ENABLE_UNUSED_GAS_HIDING + } +#endif } break; @@ -2248,7 +2255,7 @@ , (nextstopLengthSeconds+59)/60); t7_colorscheme_mod(TextR2); if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) - TextR2[0] = '\021'; + TextR2[0] = '\031'; if(textlength <= 9) GFX_write_string(&FontT105,&t7r2,TextR2,1); else @@ -2276,7 +2283,7 @@ snprintf(TextR3,TEXTSIZE,"\020\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); t7_colorscheme_mod(TextR3); if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) - TextR2[0] = '\021'; + TextR2[0] = '\031'; GFX_write_string(&FontT105,&t7r3,TextR3,1); } else if(pDecoinfo->output_ndl_seconds) @@ -2289,7 +2296,7 @@ snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_ndl_seconds/3600); t7_colorscheme_mod(TextR3); if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) - TextR2[0] = '\021'; + TextR2[0] = '\031'; GFX_write_string(&FontT105,&t7r3,TextR3,1); }