comparison Discovery/Src/t7.c @ 432:2b4440f75434

show battery percent and voltage and surfacemode. That gives additional information to the user to detect a wrong calibrated battery symbol and helps debugging issues around charging and battery life
author heinrichsweikamp
date Tue, 18 Feb 2020 12:41:45 +0100
parents 73db1565220b
children adb18fe92737
comparison
equal deleted inserted replaced
431:49c3c5f0d0cb 432:2b4440f75434
1087 text[1] = '2'; 1087 text[1] = '2';
1088 } 1088 }
1089 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_WarningRed); 1089 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_WarningRed);
1090 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) 1090 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
1091 { 1091 {
1092 snprintf(text,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); 1092 // show battery percent and voltage
1093 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage);
1093 if(warning_count_high_time) 1094 if(warning_count_high_time)
1094 text[0] = '\a'; 1095 text[0] = '\a';
1095 GFX_write_string(&FontT24,&t7voltage,text,0); 1096 GFX_write_string(&FontT24,&t7voltage,text,0);
1096 } 1097 }
1097 else 1098 else
1104 { 1105 {
1105 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryStandard); 1106 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryStandard);
1106 1107
1107 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) 1108 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
1108 { 1109 {
1109 snprintf(text,16,"\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); 1110 // show battery percent and voltage
1111 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage);
1110 // GFX_write_string(&FontT24,&t7batt,text,0); 1112 // GFX_write_string(&FontT24,&t7batt,text,0);
1111 GFX_write_string(&FontT24,&t7voltage,text,0); 1113 GFX_write_string(&FontT24,&t7voltage,text,0);
1112 } 1114 }
1113 else 1115 else
1114 { 1116 {