Merge pull request #180 from ohmytime/Bugfix
This commit is contained in:
+4
-2
@@ -5085,6 +5085,7 @@ void ShowBattery() {
|
|||||||
batteryold = battery;
|
batteryold = battery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!advancedRDS && !afscreen) {
|
||||||
if (batteryoptions > BATTERY_NONE) {
|
if (batteryoptions > BATTERY_NONE) {
|
||||||
batteryV = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0);
|
batteryV = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0);
|
||||||
if (batteryoptions == BATTERY_VALUE){
|
if (batteryoptions == BATTERY_VALUE){
|
||||||
@@ -5097,17 +5098,18 @@ void ShowBattery() {
|
|||||||
batteryVold = batteryV;
|
batteryVold = batteryV;
|
||||||
} else if (batteryoptions == BATTERY_PERCENT) {
|
} else if (batteryoptions == BATTERY_PERCENT) {
|
||||||
float vPer = 0.0;
|
float vPer = 0.0;
|
||||||
vPer = (batteryPold - BATTERY_LOW_VALUE)/(BATTERY_FULL_VALUE - BATTERY_LOW_VALUE);
|
vPer = (batteryPold - BATTERY_LOW_VALUE) / (BATTERY_FULL_VALUE - BATTERY_LOW_VALUE);
|
||||||
if (vPer >= 1) vPer = 1;
|
if (vPer >= 1) vPer = 1;
|
||||||
tftPrint(-1, String(vPer * 100, 0), 213, 163, BackgroundColor, BackgroundColor, FONT16);
|
tftPrint(-1, String(vPer * 100, 0), 213, 163, BackgroundColor, BackgroundColor, FONT16);
|
||||||
|
|
||||||
vPer = (batteryV - BATTERY_LOW_VALUE)/(BATTERY_FULL_VALUE - BATTERY_LOW_VALUE);
|
vPer = (batteryV - BATTERY_LOW_VALUE) / (BATTERY_FULL_VALUE - BATTERY_LOW_VALUE);
|
||||||
if (vPer >= 1) vPer = 1;
|
if (vPer >= 1) vPer = 1;
|
||||||
tftPrint(-1, String(vPer * 100, 0), 213, 163, PrimaryColor, PrimaryColorSmooth, FONT16);
|
tftPrint(-1, String(vPer * 100, 0), 213, 163, PrimaryColor, PrimaryColorSmooth, FONT16);
|
||||||
tftPrint(-1, "%", 230, 163, PrimaryColor, PrimaryColorSmooth, FONT16);
|
tftPrint(-1, "%", 230, 163, PrimaryColor, PrimaryColorSmooth, FONT16);
|
||||||
batteryPold = batteryV;
|
batteryPold = batteryV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Communication() {
|
void Communication() {
|
||||||
|
|||||||
Reference in New Issue
Block a user