mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-30 02:15:41 +00:00
do not enter light-sleep when GPS is in GPS_ACTIVE state
This commit is contained in:
parent
fb4418b952
commit
4223701d0e
@ -805,13 +805,15 @@ bool GPS::setup()
|
||||
}
|
||||
|
||||
notifyDeepSleepObserver.observe(¬ifyDeepSleep);
|
||||
preflightSleepObserver.observe(&preflightSleep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GPS::~GPS()
|
||||
{
|
||||
// we really should unregister our sleep observer
|
||||
// we really should unregister our sleep observers
|
||||
preflightSleepObserver.unobserve(&preflightSleep);
|
||||
notifyDeepSleepObserver.unobserve(¬ifyDeepSleep);
|
||||
}
|
||||
|
||||
@ -1171,6 +1173,12 @@ int GPS::prepareDeepSleep(void *unused)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Prevents entering light-sleep when GPS is in active state
|
||||
int GPS::preflightSleepCb(void *unused)
|
||||
{
|
||||
return (powerState == GPS_ACTIVE);
|
||||
}
|
||||
|
||||
static const char *PROBE_MESSAGE = "Trying %s (%s)...";
|
||||
static const char *DETECTED_MESSAGE = "%s detected";
|
||||
|
||||
|
@ -186,6 +186,7 @@ class GPS : private concurrency::OSThread
|
||||
uint8_t numSatellites = 0;
|
||||
|
||||
CallbackObserver<GPS, void *> notifyDeepSleepObserver = CallbackObserver<GPS, void *>(this, &GPS::prepareDeepSleep);
|
||||
CallbackObserver<GPS, void *> preflightSleepObserver = CallbackObserver<GPS, void *>(this, &GPS::preflightSleepCb);
|
||||
|
||||
/** If !NULL we will use this serial port to construct our GPS */
|
||||
#if defined(ARCH_RP2040)
|
||||
@ -213,6 +214,9 @@ class GPS : private concurrency::OSThread
|
||||
/// always returns 0 to indicate okay to sleep
|
||||
int prepareDeepSleep(void *unused);
|
||||
|
||||
// Prevents entering light-sleep when GPS is in active state
|
||||
int preflightSleepCb(void *unused);
|
||||
|
||||
/** Set power with EN pin, if relevant
|
||||
*/
|
||||
void writePinEN(bool on);
|
||||
|
Loading…
Reference in New Issue
Block a user