comparison Discovery/Src/t7.c @ 693:79ce499e26aa Betatest

Improvment charge percent visualization: The percent display is now clipped to 100.0%. As small deviation may happen between physical battery and the theoretical counter value, percent > 100 may happen. To avoid confusion values > 100% are no longer displayed. In addition a small % has been added to the visualization of the value.
author Ideenmodellierer
date Fri, 05 Aug 2022 16:04:52 +0200
parents 5575f21382d5
children 8c48553a0176
comparison
equal deleted inserted replaced
692:b052e812277c 693:79ce499e26aa
3975 if(lastCharge < localCharge) 3975 if(lastCharge < localCharge)
3976 { 3976 {
3977 speed = (localCharge - lastCharge) * 1000.0 / deltatime; 3977 speed = (localCharge - lastCharge) * 1000.0 / deltatime;
3978 } 3978 }
3979 3979
3980 if(localCharge > 100.0)
3981 {
3982 localCharge = 100.0;
3983 }
3984
3980 lastCharge = localCharge; 3985 lastCharge = localCharge;
3981 } 3986 }
3987
3982 3988
3983 if(deltatime > 1000) 3989 if(deltatime > 1000)
3984 { 3990 {
3985 deltatime = 0; 3991 deltatime = 0;
3986 remainingSec = LogDeltaCharge(speed); 3992 remainingSec = LogDeltaCharge(speed);
4009 } 4015 }
4010 4016
4011 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->chargeStatus != CHARGER_off)) 4017 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->chargeStatus != CHARGER_off))
4012 { 4018 {
4013 snprintf(text,60, 4019 snprintf(text,60,
4014 "\001%0.2f\n\r" 4020 "\001%0.2f\016\016%%\017\n\r"
4015 "\001%c%d\n\r" 4021 "\001%c%d\n\r"
4016 ,stateUsed->lifeData.battery_charge 4022 ,stateUsed->lifeData.battery_charge
4017 ,indicator 4023 ,indicator
4018 ,hoursto100); 4024 ,hoursto100);
4019 } 4025 }