small improvments to gps sleep

This commit is contained in:
richonguzman 2024-08-02 11:15:16 -04:00
parent b6cbe02137
commit e505efe149
5 changed files with 20 additions and 4 deletions

View File

@ -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();

View File

@ -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();
}
}
}

View File

@ -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();
}
}
}

View File

@ -7,6 +7,7 @@ namespace SLEEP_Utils {
void gpsSleep();
void gpsWakeUp();
void checkIfGPSShouldSleep();
}

View File

@ -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) {