feat(telemetry): dotaz na polohu nahřeje duty-cyklovanou GPS na příště
Uzel s `gps duty` odpovídal na telemetrii polohou starou až celý GPS_DUTY_SYNC_INTERVAL_SECS (u nás 30 min). Dotaz s LOCATION právem teď předsune nejbližší okno na hned, takže NÁSLEDUJÍCÍ dotaz dostane čerstvou polohu. Při periodickém sběru to stojí jeden cyklus a nepotřebuje to, aby uzel cokoli věděl o rozvrhu sběru. Čekat na fix v rámci té odpovědi nejde: odpověď se skládá a odesílá synchronně (BaseChatMesh.cpp:290), zatímco warm fix trval na T1000-E změřených ~65 s -- a klient čeká 10 s. Meshtastic to ostatně řeší stejně, position request tam vrací poslední známou polohu a GPS jede na vlastním `gps_update_interval`. Metoda je na SensorManageru, takže ji mají obě implementace: T1000 (vlastní manager) i EnvironmentSensorManager (SenseCAPy). Budí jen když uzel opravdu duty-cykluje -- `gps on` už běží a `gps off` je přání uživatele, které telemetrický dotaz nemá přebíjet. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pwhe5XoCuuEbBCNLvsJBPL
This commit is contained in:
1 parent
7ffb8d0b8f
commit
9383ec2221
6 files changed
+37
No files matched your search
@@ -44,6 +44,17 @@ public:
|
||||
virtual bool setSettingValue(const char* name, const char* value) { return false; }
|
||||
virtual LocationProvider* getLocationProvider() { return NULL; }
|
||||
|
||||
// Asked for when someone with LOCATION permission requests telemetry, so a
|
||||
// duty-cycled receiver does not answer with a position that is up to
|
||||
// GPS_DUTY_SYNC_INTERVAL_SECS old for the rest of that window.
|
||||
//
|
||||
// It deliberately does NOT wait for the fix -- the reply is assembled and
|
||||
// sent synchronously (BaseChatMesh.cpp), while a warm fix measured on a
|
||||
// T1000-E took ~65 s. So this request answers with what is known and pulls
|
||||
// the next window forward; the FOLLOWING request gets the fresh position.
|
||||
// With a periodic collector that costs one cycle and needs no scheduling.
|
||||
virtual void requestLocationRefresh() { }
|
||||
|
||||
// Live I2C scan, written into dest as text. Returns the number of devices
|
||||
// that answered, or -1 when the platform has no bus to scan.
|
||||
//
|
||||
|
||||
@@ -963,6 +963,15 @@ void EnvironmentSensorManager::start_gps() {
|
||||
// fix as valid. A provider-driven re-arm would therefore sync the RTC to a
|
||||
// half-hour-old timestamp. Hence syncTime() (which clears the parser) on every
|
||||
// wake, and our own timer for when the next wake is due.
|
||||
// Pull the next duty window forward to now -- see SensorManager::requestLocationRefresh.
|
||||
void EnvironmentSensorManager::requestLocationRefresh() {
|
||||
#if ENV_INCLUDE_GPS
|
||||
if (gps_duty && !gps_active) {
|
||||
gps_wake_at = millis();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void EnvironmentSensorManager::gpsDutyLoop() {
|
||||
if (!gps_duty) return;
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ public:
|
||||
#if ENV_INCLUDE_GPS
|
||||
EnvironmentSensorManager(LocationProvider &location): _location(&location){};
|
||||
LocationProvider* getLocationProvider() { return _location; }
|
||||
void requestLocationRefresh() override;
|
||||
#else
|
||||
EnvironmentSensorManager(){};
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user