diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index ffe84a1..8f45228 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -46,7 +46,7 @@ TinyGPSPlus gps; OneButton userButton = OneButton(BUTTON_PIN, true, true); #endif -String versionDate = "2024.08.01"; +String versionDate = "2024.08.02"; uint8_t myBeaconsIndex = 0; int myBeaconsSize = Config.beacons.size(); @@ -216,6 +216,7 @@ void loop() { MENU_Utils::showOnScreen(); refreshDisplayTime = millis(); } + SLEEP_Utils::checkIfGPSShouldSleep(); } else { if (millis() - lastGPSTime > txInterval) { SLEEP_Utils::gpsWakeUp(); diff --git a/src/gps_utils.cpp b/src/gps_utils.cpp index bbd07c6..8db4b3d 100644 --- a/src/gps_utils.cpp +++ b/src/gps_utils.cpp @@ -32,6 +32,7 @@ extern double lastTxLng; extern double lastTxDistance; extern uint32_t lastTx; extern bool disableGPS; +extern bool gpsShouldSleep; double currentHeading = 0; double previousHeading = 0; @@ -81,8 +82,8 @@ namespace GPS_Utils { Serial.print("minTxDistance not achieved : "); Serial.println(lastTxDistance); // - - SLEEP_Utils::gpsSleep(); + gpsShouldSleep = true; + //SLEEP_Utils::gpsSleep(); } } } diff --git a/src/sleep_utils.cpp b/src/sleep_utils.cpp index 9ea5ea0..daadac0 100644 --- a/src/sleep_utils.cpp +++ b/src/sleep_utils.cpp @@ -5,6 +5,8 @@ extern uint32_t lastGPSTime; extern bool gpsIsActive; +bool gpsShouldSleep = false; + namespace SLEEP_Utils { @@ -31,4 +33,10 @@ namespace SLEEP_Utils { #endif } + void checkIfGPSShouldSleep() { + if (gpsShouldSleep) { + gpsSleep(); + } + } + } \ No newline at end of file diff --git a/src/sleep_utils.h b/src/sleep_utils.h index 1557d70..cbdc9ce 100644 --- a/src/sleep_utils.h +++ b/src/sleep_utils.h @@ -7,6 +7,7 @@ namespace SLEEP_Utils { void gpsSleep(); void gpsWakeUp(); + void checkIfGPSShouldSleep(); } diff --git a/src/station_utils.cpp b/src/station_utils.cpp index c2c48a3..2758250 100644 --- a/src/station_utils.cpp +++ b/src/station_utils.cpp @@ -38,6 +38,7 @@ extern bool winlinkCommentState; extern int wxModuleType; extern bool gpsIsActive; +extern bool gpsShouldSleep; bool sendStandingUpdate = false; uint8_t updateCounter = Config.sendCommentAfterXBeacons; @@ -174,6 +175,9 @@ namespace STATION_Utils { } else { txInterval = min(currentBeacon->slowRate, currentBeacon->fastSpeed * currentBeacon->fastRate / speed) * 1000; } + // + Serial.print("intervalo = "); Serial.println(txInterval); + // } } @@ -285,7 +289,8 @@ namespace STATION_Utils { cleanTFT(); #endif if (currentBeacon->gpsEcoMode) { // currentBeacon->gpsEcoMode // true! - SLEEP_Utils::gpsSleep(); + gpsShouldSleep = true; + //SLEEP_Utils::gpsSleep(); } #if defined(HELTEC_WIRELESS_TRACKER) if (batteryVoltage.toFloat() < 3.0) {