Add opt-in low power Sensor dog tracking
Acquire fresh GPS and validated UTC, check an authenticated owner Companion, and apply saved lost-status cadence with bounded awake windows. Persist request tags, routes, and six-hour flood reservations; preserve the four-day cutoff across sleep and restart. Keep Dispatcher recovery active after a failed radio wake, honor denied flood retries after lost TxDone, and qualify GPS ownership and clock corrections. Add executable regression tests and nRF52/ESP32 Sensor build jobs. Validation: six firmware builds, 1829 native test cases, sanitized tracker/storage/GPS/sleep/recovery tests, and strict documentation build. Bluetooth Find My advertising and automatic Room mailbox polling remain separate work.
This commit is contained in:
1 parent
90b12f6fa3
commit
1f1a499482
43 files changed
+4684
-17
No files matched your search
@@ -37,6 +37,9 @@ class SensorManager {
|
||||
unsigned long gps_acquire_started_at = 0;
|
||||
unsigned long gps_stable_started_at = 0;
|
||||
uint32_t gps_update_interval_sec = 0;
|
||||
bool gps_tracker_enabled = false;
|
||||
bool gps_tracker_fix_ready = false;
|
||||
uint32_t gps_tracker_sync_generation = 0;
|
||||
|
||||
bool gpsTelemetryHoldActive(unsigned long now) const;
|
||||
bool gpsTelemetryCacheFresh(unsigned long now) const;
|
||||
@@ -58,10 +61,12 @@ protected:
|
||||
void setGpsTelemetryTransportAvailable(bool available);
|
||||
void resetGpsTelemetryTransportState();
|
||||
bool isGpsTelemetryUserEnabled() const { return gps_user_enabled; }
|
||||
bool isTrackerGpsModeEnabled() const { return gps_tracker_enabled; }
|
||||
bool isGpsTelemetryTransportAvailable() const {
|
||||
return gps_transport_available;
|
||||
}
|
||||
bool gpsTelemetryReceiverRequired(unsigned long now) const {
|
||||
if (gps_tracker_enabled) return gps_acquiring;
|
||||
return gps_acquiring || gpsTelemetryHoldActive(now);
|
||||
}
|
||||
bool setGpsUpdateIntervalValue(const char* value) {
|
||||
@@ -112,12 +117,18 @@ public:
|
||||
// Read the existing fresh cache without acquiring GPS, changing power, or
|
||||
// taking a UART. Sleeping/off receivers may retain a recent valid fix.
|
||||
bool getCachedGpsPosition(double& latitude, double& longitude) const;
|
||||
// Runtime tracker ownership leaves the saved manual GPS preference intact.
|
||||
// Each acquisition needs a new fix and validated clock sync, bounded to 120s.
|
||||
void setTrackerGpsModeEnabled(bool enabled);
|
||||
bool beginTrackerGpsAcquisition();
|
||||
bool isTrackerGpsAcquisitionPending() const;
|
||||
bool takeTrackerGpsPosition(double& latitude, double& longitude);
|
||||
bool requestGpsTelemetryTimeSync(uint64_t min_interval_secs) {
|
||||
#if ENV_INCLUDE_GPS
|
||||
// A denied request must not consume the provider's throttle or reclaim a
|
||||
// bridge-owned UART. Shared GPS rails make isEnabled() an unsafe substitute
|
||||
// for the manager's established transport ownership.
|
||||
if (!gps_transport_available || !telemetryGpsDetected()) return false;
|
||||
if (gps_tracker_enabled || !gps_transport_available || !telemetryGpsDetected()) return false;
|
||||
LocationProvider* location = getLocationProvider();
|
||||
if (location != nullptr && location->getTimeSyncIntervalHours() != 0) {
|
||||
min_interval_secs = static_cast<uint64_t>(location->getTimeSyncIntervalHours()) * 3600UL;
|
||||
|
||||
Reference in new issue
Block a user