improve battery tracking
This commit is contained in:
@@ -33,6 +33,12 @@ double Battery::getBatteryVoltage() {
|
||||
return (int)(res*100+0.5)/100.0;
|
||||
}
|
||||
|
||||
bool Battery::isBatteryLow(uint8_t percent) {
|
||||
if (this->getBatteryPercent() <= percent && this->batteryVoltage > this->absurdLowVoltage)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
double Battery::readInputVoltage() {
|
||||
// Reference voltage is 3v3 so maximum reading is 3v3 = 4095 in range 0 to 4095
|
||||
double reading = analogRead(this->pin);
|
||||
|
||||
Reference in New Issue
Block a user