testing for battery at init
This commit is contained in:
parent
3d690d4773
commit
b34e91642d
|
|
@ -1,6 +1,8 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "battery_utils.h"
|
#include "battery_utils.h"
|
||||||
|
#include "boards_pinout.h"
|
||||||
#include "power_utils.h"
|
#include "power_utils.h"
|
||||||
|
#include "display.h"
|
||||||
|
|
||||||
|
|
||||||
int telemetryCounter = random(1,999);
|
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
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,7 @@ namespace BATTERY_Utils {
|
||||||
|
|
||||||
String generateEncodedTelemetry(float voltage);
|
String generateEncodedTelemetry(float voltage);
|
||||||
String getPercentVoltageBattery(float voltage);
|
String getPercentVoltageBattery(float voltage);
|
||||||
|
void checkBatteryInitVoltage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -248,9 +248,6 @@ namespace STATION_Utils {
|
||||||
if (Config.battery.monitorVoltage && batteryVoltage.toFloat() < Config.battery.sleepVoltage) {
|
if (Config.battery.monitorVoltage && batteryVoltage.toFloat() < Config.battery.sleepVoltage) {
|
||||||
shouldSleepLowVoltage = true;
|
shouldSleepLowVoltage = true;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
//BATTERY_Utils::checkLowVoltageAndSleep(batteryVoltage.toFloat());
|
|
||||||
//
|
|
||||||
#endif
|
#endif
|
||||||
if (Config.battery.sendVoltage && !Config.battery.voltageAsTelemetry) {
|
if (Config.battery.sendVoltage && !Config.battery.voltageAsTelemetry) {
|
||||||
String batteryChargeCurrent = POWER_Utils::getBatteryInfoCurrent();
|
String batteryChargeCurrent = POWER_Utils::getBatteryInfoCurrent();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue