Skip to content

Commit 6db1379

Browse files
authored
Update battery.cpp
Fixed faulty battery voltage readings
1 parent d017096 commit 6db1379

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Battery/battery.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bool EPS::readVoltate()
3838

3939
samples = analogRead(PIN_BATT_VOLTAGE);
4040
// Determine Battery Voltage
41-
data.batteryVoltage = ((samples * Vref) / ADC_resolution) * (R2 / (R1 + R2));
41+
data.batteryVoltage = ((samples * Vref) / ADC_resolution) * ((R1 + R2) /R2 );
4242
batteryVoltageTimer.restart();
4343

4444
if (data.batteryVoltage < MIN_BATTERY_VOLTAGE)

0 commit comments

Comments
 (0)