diff 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
line wrap: on
line diff
--- a/Discovery/Src/t7.c	Mon Mar 23 21:10:02 2020 +0100
+++ b/Discovery/Src/t7.c	Mon Mar 23 21:13:52 2020 +0100
@@ -1008,13 +1008,14 @@
 
         actualGasID = stateUsed->lifeData.actualGas.GasIdInSettings;
 
+#ifdef ENABLE_BOTTLE_SENSOR
         bottleFirstGas_bar = stateUsed->lifeData.bottle_bar[actualGasID];
         if(bottleFirstGas_bar)
         {
             snprintf(text,255,"%3u\022\016\016 bar",bottleFirstGas_bar);
             GFX_write_string(&FontT48,&t7surfaceL,text,8);
         }
-
+#endif
         // after gas name :-)
         if(actualGasID > gasOffset) // security
         {
@@ -1091,8 +1092,12 @@
             GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_WarningRed);
             if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
             {
+#ifdef ALWAYS_SHOW_VOLTAGE
             	// show battery percent and voltage
                 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage);
+#else
+                snprintf(text,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge);
+#endif
                 if(warning_count_high_time)
                     text[0] = '\a';
                 GFX_write_string(&FontT24,&t7voltage,text,0);
@@ -1109,9 +1114,12 @@
 
             if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
             {
+#ifdef ALWAYS_SHOW_VOLTAGE
             	// show battery percent and voltage
                 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage);
-        //        GFX_write_string(&FontT24,&t7batt,text,0);
+#else
+                 snprintf(text,16,"\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge);
+#endif
                 GFX_write_string(&FontT24,&t7voltage,text,0);
             }
             else
@@ -2656,7 +2664,7 @@
     case LCC_BottleBar:
         headerText[2] = TXT_AtemGasVorrat;
         tinyHeaderFont = 1;
-        snprintf(text,TEXTSIZE,"%d\016\016\017", stateUsed->lifeData.bottle_bar[1]);
+        snprintf(text,TEXTSIZE,"%d\016\016\017", stateUsed->lifeData.bottle_bar[stateUsed->lifeData.actualGas.GasIdInSettings]);
         break;
 #endif
     }
@@ -2677,19 +2685,24 @@
     }
     else
     {
-    	agedColor = stateUsed->lifeData.bottle_bar_age_MilliSeconds[1];
+    	agedColor = stateUsed->lifeData.bottle_bar_age_MilliSeconds[stateUsed->lifeData.actualGas.GasIdInSettings];
     	if(agedColor > 1200)
     	{
-    		agedColor = 16;
+    		agedColor = CLUT_WarningRed;
     	}
     	else
     	if(agedColor > 600)
+        {
+        	agedColor = CLUT_MenuLineUnselected;
+        }
+        else
+    	if(agedColor > 20)
     	{
-    		agedColor = 9;
+    		agedColor = CLUT_Font031;
     	}
     	else
     	{
-    		agedColor = 0;
+    		agedColor = CLUT_Font020;
     	}
 
     	GFX_write_string_color(&FontT105,&t7l3,text,line,agedColor);