diff --git a/include/battery_utils.h b/include/battery_utils.h index a2f523d..528acf7 100644 --- a/include/battery_utils.h +++ b/include/battery_utils.h @@ -8,10 +8,10 @@ namespace BATTERY_Utils { void adcCalibration(); void adcCalibrationCheck(); + void setup(); float checkInternalVoltage(); float checkExternalVoltage(); - void checkIfShouldSleep(); // ???? void startupBatteryHealth(); String generateEncodedTelemetryBytes(float value, bool firstBytes, byte voltageType); diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index fa6cb00..1ba284a 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -93,6 +93,7 @@ void setup() { delay(STARTUP_DELAY * 60 * 1000); #endif + // ????? kill ????? #ifdef HELTEC_HTCT62 if (Config.lowPowerMode) { gpio_wakeup_enable(GPIO_NUM_3, GPIO_INTR_HIGH_LEVEL); @@ -133,6 +134,7 @@ void setup() { Config.loramodule.rxActive = false; } #endif + SLEEP_Utils::setup(); WIFI_Utils::setup(); NTP_Utils::setup(); @@ -152,6 +154,7 @@ void loop() { SLEEP_Utils::checkWakeUpFlag(); Utils::checkBeaconInterval(); STATION_Utils::processOutputPacketBufferUltraEcoMode(); + Utils::checkSleepByLowBatteryVoltage(1); SLEEP_Utils::startSleeping(); } else { WIFI_Utils::checkAutoAPTimeout(); @@ -160,10 +163,6 @@ void loop() { ElegantOTA.loop(); return; // Don't process IGate and Digi during OTA update } - - if (Config.lowVoltageCutOff > 0) { - BATTERY_Utils::checkIfShouldSleep(); - } #ifdef HAS_GPS if (Config.beacon.gpsActive) { diff --git a/src/battery_utils.cpp b/src/battery_utils.cpp index 9c73b6e..25472ae 100644 --- a/src/battery_utils.cpp +++ b/src/battery_utils.cpp @@ -198,15 +198,6 @@ namespace BATTERY_Utils { // return mapVoltage(voltage, 5.05, 6.32, 4.5, 5.5); // mapped voltage } - void checkIfShouldSleep() { - if (lastBatteryCheck == 0 || millis() - lastBatteryCheck >= 15 * 60 * 1000) { - lastBatteryCheck = millis(); - if (checkInternalVoltage() < Config.lowVoltageCutOff) { - ESP.deepSleep(1800000000); // 30 min sleep (60s = 60e6) - } - } - } - void startupBatteryHealth() { #ifdef BATTERY_PIN if (Config.battery.monitorInternalVoltage && checkInternalVoltage() < Config.battery.internalSleepVoltage + 0.1) { diff --git a/src/digi_utils.cpp b/src/digi_utils.cpp index f42ab8f..afaca86 100644 --- a/src/digi_utils.cpp +++ b/src/digi_utils.cpp @@ -133,7 +133,7 @@ namespace DIGI_Utils { if (!thirdPartyPacket && !Utils::checkValidCallsign(Sender)) { return; } - if (STATION_Utils::check25SegBuffer(Sender, temp.substring(temp.indexOf(":") + 2)) || Config.lowPowerMode) { + if (STATION_Utils::check25SegBuffer(Sender, temp.substring(temp.indexOf(":") + 2))) { STATION_Utils::updateLastHeard(Sender); Utils::typeOfPacket(temp, 2); // Digi bool queryMessage = false;