Remove extraneous flag, use gps_enabled. Ensure factory reset is not triggered while chip is off and gps_enabled=0

This commit is contained in:
code8buster
2022-12-13 17:23:58 -05:00
parent 53da7cb036
commit 8507125e98
6 changed files with 39 additions and 11 deletions

View File

@@ -29,7 +29,9 @@ Observable<void *> preflightSleep;
/// Called to tell observers we are now entering sleep and you should prepare. Must return 0
/// notifySleep will be called for light or deep sleep, notifyDeepSleep is only called for deep sleep
/// notifyGPSSleep will be called when config.position.gps_enabled is set to 0 or from buttonthread when GPS_POWER_TOGGLE is enabled.
Observable<void *> notifySleep, notifyDeepSleep;
Observable<void *> notifyGPSSleep;
// deep sleep support
RTC_DATA_ATTR int bootCount = 0;
@@ -169,6 +171,7 @@ static void waitEnterSleep()
void doGPSpowersave(bool on)
{
#ifdef HAS_PMU
if (on)
{
DEBUG_MSG("Turning GPS back on\n");
@@ -178,9 +181,10 @@ void doGPSpowersave(bool on)
else
{
DEBUG_MSG("Turning off GPS chip\n");
notifySleep.notifyObservers(NULL);
notifyGPSSleep.notifyObservers(NULL);
setGPSPower(0);
}
#endif
}
void doDeepSleep(uint64_t msecToWake)