mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-04-06 06:55:07 +00:00
improvement: low voltage cut off as web ui option
This commit is contained in:
parent
db21a08904
commit
968d9188be
8 changed files with 31 additions and 18 deletions
|
|
@ -1,12 +1,6 @@
|
|||
#include "battery_utils.h"
|
||||
#include "configuration.h"
|
||||
#include "pins_config.h"
|
||||
//#include "lora_utils.h"
|
||||
|
||||
// Uncomment if you want to monitor voltage and sleep if voltage is too low (<3.15V)
|
||||
//#define LOW_VOLTAGE_CUTOFF
|
||||
|
||||
float cutOffVoltage = 3.15;
|
||||
|
||||
extern Configuration Config;
|
||||
extern uint32_t lastBatteryCheck;
|
||||
|
|
@ -65,24 +59,15 @@ namespace BATTERY_Utils {
|
|||
}
|
||||
|
||||
void checkIfShouldSleep() {
|
||||
#ifdef LOW_VOLTAGE_CUTOFF
|
||||
if (lastBatteryCheck == 0 || millis() - lastBatteryCheck >= 15 * 60 * 1000) {
|
||||
lastBatteryCheck = millis();
|
||||
|
||||
float voltage = checkBattery();
|
||||
|
||||
if (voltage < cutOffVoltage) {
|
||||
/* Send message over APRS-IS or over LoRa???
|
||||
|
||||
APRS_IS_Utils::upload("battery is low = sleeping")
|
||||
|
||||
LoRa_Utils::sendNewMessage("battery is low = sleeping");
|
||||
|
||||
*/
|
||||
if (voltage < Config.lowVoltageCutOff) {
|
||||
ESP.deepSleep(1800000000); // 30 min sleep (60s = 60e6)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue