Merge pull request #225 from ohmytime/Bugfix
Fix battery value update error
This commit is contained in:
+1
-1
@@ -2948,9 +2948,9 @@ void ShowBattery() {
|
|||||||
float batteryV = ((float)v / 4095.0) * 2.0 * 3.3 * (1056 / 1000.0);
|
float batteryV = ((float)v / 4095.0) * 2.0 * 3.3 * (1056 / 1000.0);
|
||||||
batteryV = constrain(batteryV, 0.0, 5.0);
|
batteryV = constrain(batteryV, 0.0, 5.0);
|
||||||
if (round(batteryV * 100.0) != round(batteryVold * 100.0)) {
|
if (round(batteryV * 100.0) != round(batteryVold * 100.0)) {
|
||||||
batteryVold = batteryV;
|
|
||||||
if (batteryoptions == BATTERY_VALUE) {
|
if (batteryoptions == BATTERY_VALUE) {
|
||||||
tftReplace(-1, String(batteryVold, 1) + "V", String(batteryV, 1) + "V", 279, 9, BatteryValueColor, BatteryValueColorSmooth, 16);
|
tftReplace(-1, String(batteryVold, 1) + "V", String(batteryV, 1) + "V", 279, 9, BatteryValueColor, BatteryValueColorSmooth, 16);
|
||||||
|
batteryVold = batteryV;
|
||||||
} else if (batteryoptions == BATTERY_PERCENT) {
|
} else if (batteryoptions == BATTERY_PERCENT) {
|
||||||
float vPer = 0.0;
|
float vPer = 0.0;
|
||||||
vPer = (batteryV - BATTERY_LOW_VALUE) / (BATTERY_FULL_VALUE - BATTERY_LOW_VALUE);
|
vPer = (batteryV - BATTERY_LOW_VALUE) / (BATTERY_FULL_VALUE - BATTERY_LOW_VALUE);
|
||||||
|
|||||||
Reference in New Issue
Block a user