comparison Discovery/Src/t7.c @ 448:f7c66593ab82 minor_improvments

Added compile switch to show voltage parallel to charge status percantage Show aging of bottle sensor data by change of text color: Permanent connection is shown white. After two minutes timeout the text is shown red to indicate that the value shall no longer be trusted
author ideenmodellierer
date Mon, 23 Mar 2020 21:13:52 +0100
parents f1257a32f2d4
children 4bd01f48c285
comparison
equal deleted inserted replaced
447:adc4ccbebbb5 448:f7c66593ab82
1006 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[0]); 1006 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[0]);
1007 GFX_write_string(&FontT48,&t7surfaceL,text,7); 1007 GFX_write_string(&FontT48,&t7surfaceL,text,7);
1008 1008
1009 actualGasID = stateUsed->lifeData.actualGas.GasIdInSettings; 1009 actualGasID = stateUsed->lifeData.actualGas.GasIdInSettings;
1010 1010
1011 #ifdef ENABLE_BOTTLE_SENSOR
1011 bottleFirstGas_bar = stateUsed->lifeData.bottle_bar[actualGasID]; 1012 bottleFirstGas_bar = stateUsed->lifeData.bottle_bar[actualGasID];
1012 if(bottleFirstGas_bar) 1013 if(bottleFirstGas_bar)
1013 { 1014 {
1014 snprintf(text,255,"%3u\022\016\016 bar",bottleFirstGas_bar); 1015 snprintf(text,255,"%3u\022\016\016 bar",bottleFirstGas_bar);
1015 GFX_write_string(&FontT48,&t7surfaceL,text,8); 1016 GFX_write_string(&FontT48,&t7surfaceL,text,8);
1016 } 1017 }
1017 1018 #endif
1018 // after gas name :-) 1019 // after gas name :-)
1019 if(actualGasID > gasOffset) // security 1020 if(actualGasID > gasOffset) // security
1020 { 1021 {
1021 if(!pSettings->FlipDisplay) 1022 if(!pSettings->FlipDisplay)
1022 { 1023 {
1089 text[1] = '2'; 1090 text[1] = '2';
1090 } 1091 }
1091 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_WarningRed); 1092 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_WarningRed);
1092 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) 1093 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
1093 { 1094 {
1095 #ifdef ALWAYS_SHOW_VOLTAGE
1094 // show battery percent and voltage 1096 // show battery percent and voltage
1095 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage); 1097 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage);
1098 #else
1099 snprintf(text,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge);
1100 #endif
1096 if(warning_count_high_time) 1101 if(warning_count_high_time)
1097 text[0] = '\a'; 1102 text[0] = '\a';
1098 GFX_write_string(&FontT24,&t7voltage,text,0); 1103 GFX_write_string(&FontT24,&t7voltage,text,0);
1099 } 1104 }
1100 else 1105 else
1107 { 1112 {
1108 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryStandard); 1113 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryStandard);
1109 1114
1110 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) 1115 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
1111 { 1116 {
1117 #ifdef ALWAYS_SHOW_VOLTAGE
1112 // show battery percent and voltage 1118 // show battery percent and voltage
1113 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage); 1119 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage);
1114 // GFX_write_string(&FontT24,&t7batt,text,0); 1120 #else
1121 snprintf(text,16,"\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge);
1122 #endif
1115 GFX_write_string(&FontT24,&t7voltage,text,0); 1123 GFX_write_string(&FontT24,&t7voltage,text,0);
1116 } 1124 }
1117 else 1125 else
1118 { 1126 {
1119 snprintf(text,6,"\f%.1fV",stateUsed->lifeData.battery_voltage); 1127 snprintf(text,6,"\f%.1fV",stateUsed->lifeData.battery_voltage);
2654 break; 2662 break;
2655 #ifdef ENABLE_BOTTLE_SENSOR 2663 #ifdef ENABLE_BOTTLE_SENSOR
2656 case LCC_BottleBar: 2664 case LCC_BottleBar:
2657 headerText[2] = TXT_AtemGasVorrat; 2665 headerText[2] = TXT_AtemGasVorrat;
2658 tinyHeaderFont = 1; 2666 tinyHeaderFont = 1;
2659 snprintf(text,TEXTSIZE,"%d\016\016\017", stateUsed->lifeData.bottle_bar[1]); 2667 snprintf(text,TEXTSIZE,"%d\016\016\017", stateUsed->lifeData.bottle_bar[stateUsed->lifeData.actualGas.GasIdInSettings]);
2660 break; 2668 break;
2661 #endif 2669 #endif
2662 } 2670 }
2663 headerText[3] = 0; 2671 headerText[3] = 0;
2664 2672
2675 { 2683 {
2676 GFX_write_string(&FontT105,&t7l3,text,line); 2684 GFX_write_string(&FontT105,&t7l3,text,line);
2677 } 2685 }
2678 else 2686 else
2679 { 2687 {
2680 agedColor = stateUsed->lifeData.bottle_bar_age_MilliSeconds[1]; 2688 agedColor = stateUsed->lifeData.bottle_bar_age_MilliSeconds[stateUsed->lifeData.actualGas.GasIdInSettings];
2681 if(agedColor > 1200) 2689 if(agedColor > 1200)
2682 { 2690 {
2683 agedColor = 16; 2691 agedColor = CLUT_WarningRed;
2684 } 2692 }
2685 else 2693 else
2686 if(agedColor > 600) 2694 if(agedColor > 600)
2695 {
2696 agedColor = CLUT_MenuLineUnselected;
2697 }
2698 else
2699 if(agedColor > 20)
2687 { 2700 {
2688 agedColor = 9; 2701 agedColor = CLUT_Font031;
2689 } 2702 }
2690 else 2703 else
2691 { 2704 {
2692 agedColor = 0; 2705 agedColor = CLUT_Font020;
2693 } 2706 }
2694 2707
2695 GFX_write_string_color(&FontT105,&t7l3,text,line,agedColor); 2708 GFX_write_string_color(&FontT105,&t7l3,text,line,agedColor);
2696 } 2709 }
2697 #endif 2710 #endif