mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 17:32:18 +00:00
Merge pull request #4893 from meshtastic/softSleep
Only check hardsleep threshold if GPS softsleep is supported
This commit is contained in:
commit
a39280e9df
@ -916,20 +916,22 @@ void GPS::down()
|
|||||||
softsleepSupported = true;
|
softsleepSupported = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// How long does gps_update_interval need to be, for GPS_HARDSLEEP to become more efficient than GPS_SOFTSLEEP?
|
if (softsleepSupported) {
|
||||||
// Heuristic equation. A compromise manually fitted to power observations from U-blox NEO-6M and M10050
|
// How long does gps_update_interval need to be, for GPS_HARDSLEEP to become more efficient than GPS_SOFTSLEEP?
|
||||||
// https://www.desmos.com/calculator/6gvjghoumr
|
// Heuristic equation. A compromise manually fitted to power observations from U-blox NEO-6M and M10050
|
||||||
// This is not particularly accurate, but probably an impromevement over a single, fixed threshold
|
// https://www.desmos.com/calculator/6gvjghoumr
|
||||||
uint32_t hardsleepThreshold = (2750 * pow(predictedSearchDuration / 1000, 1.22));
|
// This is not particularly accurate, but probably an impromevement over a single, fixed threshold
|
||||||
LOG_DEBUG("gps_update_interval >= %us needed to justify hardsleep\n", hardsleepThreshold / 1000);
|
uint32_t hardsleepThreshold = (2750 * pow(predictedSearchDuration / 1000, 1.22));
|
||||||
|
LOG_DEBUG("gps_update_interval >= %us needed to justify hardsleep\n", hardsleepThreshold / 1000);
|
||||||
// If update interval too short: softsleep (if supported by hardware)
|
|
||||||
if (softsleepSupported && updateInterval < hardsleepThreshold)
|
|
||||||
setPowerState(GPS_SOFTSLEEP, sleepTime);
|
|
||||||
|
|
||||||
|
// If update interval too short: softsleep (if supported by hardware)
|
||||||
|
if (updateInterval < hardsleepThreshold) {
|
||||||
|
setPowerState(GPS_SOFTSLEEP, sleepTime);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
// If update interval long enough (or softsleep unsupported): hardsleep instead
|
// If update interval long enough (or softsleep unsupported): hardsleep instead
|
||||||
else
|
setPowerState(GPS_HARDSLEEP, sleepTime);
|
||||||
setPowerState(GPS_HARDSLEEP, sleepTime);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user