Added Battery to MenuBattery
This commit is contained in:
+2
-10
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file battery.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains the implementation of the class Battery
|
||||
* @version 0.1
|
||||
* @date 2022-02-05
|
||||
*
|
||||
@@ -28,14 +28,6 @@ void Battery::loop() {
|
||||
this->lastMillis = millis();
|
||||
}
|
||||
|
||||
double Battery::getBatteryVoltage() {
|
||||
return this->batteryVoltage;
|
||||
}
|
||||
|
||||
uint8_t Battery::getBatteryPercent() {
|
||||
return this->batteryPercent;
|
||||
}
|
||||
|
||||
double Battery::readInputVoltage() {
|
||||
// Reference voltage is 3v3 so maximum reading is 3v3 = 4095 in range 0 to 4095
|
||||
double reading = analogRead(this->pin);
|
||||
@@ -52,7 +44,7 @@ void Battery::calculateBatteryVoltage() {
|
||||
}
|
||||
|
||||
void Battery::calculateBatteryPercent() {
|
||||
int8_t size = sizeof(this->capacityVoltages) / sizeof(this->capacityVoltages);
|
||||
int8_t size = sizeof(this->capacityVoltages) / sizeof(*this->capacityVoltages);
|
||||
uint8_t i;
|
||||
for (i = 0; i < size; i++) {
|
||||
if (this->batteryVoltage <= this->capacityVoltages[i])
|
||||
|
||||
Reference in New Issue
Block a user