testing for battery at init

This commit is contained in:
richonguzman 2024-11-16 08:29:42 -03:00
parent 3d690d4773
commit b34e91642d
3 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,8 @@
#include <Arduino.h>
#include "battery_utils.h"
#include "boards_pinout.h"
#include "power_utils.h"
#include "display.h"
int telemetryCounter = random(1,999);
@ -59,4 +61,14 @@ namespace BATTERY_Utils {
}
}
void checkBatteryInitVoltage() {
#ifdef BATTERY_PIN
String batteryVoltage = POWER_Utils::getBatteryInfoVoltage();
if (batteryVoltage.toFloat() < 3.0) {
displayShow("!BATTERY!", "", "LOW BATTERY VOLTAGE!",3000);
POWER_Utils::shutdown();
}
#endif
}
}

View File

@ -8,6 +8,7 @@ namespace BATTERY_Utils {
String generateEncodedTelemetry(float voltage);
String getPercentVoltageBattery(float voltage);
void checkBatteryInitVoltage();
}

View File

@ -248,9 +248,6 @@ namespace STATION_Utils {
if (Config.battery.monitorVoltage && batteryVoltage.toFloat() < Config.battery.sleepVoltage) {
shouldSleepLowVoltage = true;
}
//
//BATTERY_Utils::checkLowVoltageAndSleep(batteryVoltage.toFloat());
//
#endif
if (Config.battery.sendVoltage && !Config.battery.voltageAsTelemetry) {
String batteryChargeCurrent = POWER_Utils::getBatteryInfoCurrent();