mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 22:22:05 +00:00
Attempt 2: Send PMREQ with duration 0 on MCU deep-sleep
This commit is contained in:
parent
9d29ec7603
commit
8b697cd2a4
@ -785,7 +785,7 @@ void GPS::setGPSPower(bool on, bool standbyOnly, uint32_t sleepTime)
|
|||||||
powerState = GPS_ACTIVE;
|
powerState = GPS_ACTIVE;
|
||||||
else if (!enabled) // User has disabled with triple press
|
else if (!enabled) // User has disabled with triple press
|
||||||
powerState = GPS_OFF;
|
powerState = GPS_OFF;
|
||||||
else if (sleepTime <= GPS_IDLE_THRESHOLD_SECONDS * 1000UL)
|
else if (sleepTime <= GPS_IDLE_THRESHOLD_SECONDS * 1000UL && sleepTime > 0) // sleepTime=0 indicates indefinite GPS poweroff
|
||||||
powerState = GPS_IDLE;
|
powerState = GPS_IDLE;
|
||||||
else if (standbyOnly)
|
else if (standbyOnly)
|
||||||
powerState = GPS_STANDBY;
|
powerState = GPS_STANDBY;
|
||||||
@ -940,7 +940,8 @@ void GPS::setAwake(bool wantAwake)
|
|||||||
|
|
||||||
// How long to wait before attempting next GPS update
|
// How long to wait before attempting next GPS update
|
||||||
// Aims to hit position.gps_update_interval by using the lock-time prediction
|
// Aims to hit position.gps_update_interval by using the lock-time prediction
|
||||||
uint32_t compensatedSleepTime = (getSleepTime() > predictedLockTime) ? (getSleepTime() - predictedLockTime) : 0;
|
// Sleep for at least 1 second, so we don't ask GPS hardware to sleep indefinitely with a "0 second PMREQ"
|
||||||
|
uint32_t compensatedSleepTime = (getSleepTime() > predictedLockTime) ? (getSleepTime() - predictedLockTime) : 1;
|
||||||
|
|
||||||
// If long interval between updates: power off between updates
|
// If long interval between updates: power off between updates
|
||||||
if (compensatedSleepTime > GPS_STANDBY_THRESHOLD_MINUTES * MS_IN_MINUTE) {
|
if (compensatedSleepTime > GPS_STANDBY_THRESHOLD_MINUTES * MS_IN_MINUTE) {
|
||||||
@ -1129,11 +1130,10 @@ void GPS::clearBuffer()
|
|||||||
/// Prepare the GPS for the cpu entering deep or light sleep, expect to be gone for at least 100s of msecs
|
/// Prepare the GPS for the cpu entering deep or light sleep, expect to be gone for at least 100s of msecs
|
||||||
int GPS::prepareDeepSleep(void *unused)
|
int GPS::prepareDeepSleep(void *unused)
|
||||||
{
|
{
|
||||||
LOG_INFO("GPS deep sleep!\n");
|
/*
|
||||||
|
* GPS power was previously set here.
|
||||||
// Manually enter GPSPowerState::OFF, so we can ensure a PMREQ with duration 0 has been sent
|
* Now removed, as the same call is already made directly in doDeepSleep.
|
||||||
setGPSPower(false, false, 0);
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user