mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-04-07 23:45:11 +00:00
full update for BatteryHealthMonitor
This commit is contained in:
parent
c6687529da
commit
3589f54d02
9 changed files with 61 additions and 21 deletions
|
|
@ -1,9 +1,11 @@
|
|||
#include "battery_utils.h"
|
||||
#include "configuration.h"
|
||||
#include "boards_pinout.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern Configuration Config;
|
||||
extern uint32_t lastBatteryCheck;
|
||||
extern bool shouldSleepLowVoltage;
|
||||
|
||||
float adcReadingTransformation = (3.3/4095);
|
||||
float voltageDividerCorrection = 0.288;
|
||||
|
|
@ -88,4 +90,18 @@ namespace BATTERY_Utils {
|
|||
}
|
||||
}
|
||||
|
||||
void startupBatteryHealth() {
|
||||
#ifdef BATTERY_PIN
|
||||
if (Config.battery.monitorInternalVoltage && checkInternalVoltage() < Config.battery.internalSleepVoltage) {
|
||||
shouldSleepLowVoltage = true;
|
||||
}
|
||||
#endif
|
||||
if (Config.battery.monitorExternalVoltage && checkExternalVoltage() < Config.battery.externalSleepVoltage) {
|
||||
shouldSleepLowVoltage = true;
|
||||
}
|
||||
if (shouldSleepLowVoltage) {
|
||||
Utils::checkSleepByLowBatteryVoltage(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue