low external voltage RF Tx fix
This commit is contained in:
parent
db5710ec6a
commit
5dc6e99972
|
|
@ -1,4 +1,5 @@
|
||||||
#include "station_utils.h"
|
#include "station_utils.h"
|
||||||
|
#include "battery_utils.h"
|
||||||
#include "aprs_is_utils.h"
|
#include "aprs_is_utils.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "lora_utils.h"
|
#include "lora_utils.h"
|
||||||
|
|
@ -8,6 +9,7 @@
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
extern uint32_t lastRxTime;
|
extern uint32_t lastRxTime;
|
||||||
extern String fourthLine;
|
extern String fourthLine;
|
||||||
|
extern bool shouldSleepLowVoltage;
|
||||||
|
|
||||||
uint32_t lastTxTime = millis();
|
uint32_t lastTxTime = millis();
|
||||||
std::vector<String> lastHeardStation;
|
std::vector<String> lastHeardStation;
|
||||||
|
|
@ -109,6 +111,13 @@ namespace STATION_Utils {
|
||||||
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
||||||
lastTxTime = millis();
|
lastTxTime = millis();
|
||||||
}
|
}
|
||||||
|
if (shouldSleepLowVoltage) {
|
||||||
|
while (outputPacketBuffer.size() > 0) {
|
||||||
|
LoRa_Utils::sendNewPacket(outputPacketBuffer[0]);
|
||||||
|
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
||||||
|
delay(4000);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addToOutputPacketBuffer(const String& packet) {
|
void addToOutputPacketBuffer(const String& packet) {
|
||||||
|
|
|
||||||
|
|
@ -310,12 +310,12 @@ namespace Utils {
|
||||||
|
|
||||||
void checkSleepByLowBatteryVoltage(uint8_t mode) {
|
void checkSleepByLowBatteryVoltage(uint8_t mode) {
|
||||||
if (shouldSleepLowVoltage) {
|
if (shouldSleepLowVoltage) {
|
||||||
if (mode == 0) {
|
if (mode == 0) { // at startup
|
||||||
delay(3000);
|
delay(3000);
|
||||||
}
|
}
|
||||||
Serial.println("\n\n*** Sleeping Low Battey Voltage ***\n\n");
|
Serial.println("\n\n*** Sleeping Low Battey Voltage ***\n\n");
|
||||||
esp_sleep_enable_timer_wakeup(30 * 60 * 1000000); // sleep 30 min
|
esp_sleep_enable_timer_wakeup(30 * 60 * 1000000); // sleep 30 min
|
||||||
if (mode == 1) {
|
if (mode == 1) { // low voltage detected after a while
|
||||||
displayToggle(false);
|
displayToggle(false);
|
||||||
}
|
}
|
||||||
#ifdef VEXT_CTRL
|
#ifdef VEXT_CTRL
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue