make all possible functions const

This commit is contained in:
2023-08-18 11:44:10 +02:00
parent 11d21e2e89
commit 4cd2b9368d
18 changed files with 33 additions and 52 deletions
+3 -3
View File
@@ -39,12 +39,12 @@ void Battery::run() {
return;
}
double Battery::getBatteryVoltage() {
double Battery::getBatteryVoltage() const {
double res = this->batteryVoltage;
return (int)(res*100+0.5)/100.0;
}
bool Battery::isBatteryLow(double voltage) {
bool Battery::isBatteryLow(double voltage) const {
if (this->getBatteryVoltage() <= voltage && this->batteryVoltage > this->absurdLowVoltage)
return true;
return false;
@@ -136,7 +136,7 @@ void Battery::initBuffer() {
this->adcBuffer[i] = 0;
}
uint16_t Battery::getBufAvg() {
uint16_t Battery::getBufAvg() const {
uint32_t res = 0;
uint8_t emptyPos = 0;
for (uint8_t i = 0; i < Battery::bufferSize; i++) {