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
55 lines
1.8 KiB
C++
55 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#define RADIOLIB_STATIC_ONLY 1
|
|
#include <RadioLib.h>
|
|
#include <helpers/radiolib/RadioLibWrappers.h>
|
|
#include "T1000eBoard.h"
|
|
#include <helpers/radiolib/CustomLR1110Wrapper.h>
|
|
#include <helpers/ArduinoHelpers.h>
|
|
#include <helpers/SensorManager.h>
|
|
#include <helpers/sensors/LocationProvider.h>
|
|
#ifdef DISPLAY_CLASS
|
|
#include "NullDisplayDriver.h"
|
|
#endif
|
|
|
|
class T1000SensorManager: public SensorManager {
|
|
bool gps_active = false;
|
|
LocationProvider * _nmea;
|
|
|
|
// Duty-cycle state, mirroring EnvironmentSensorManager: `gps_duty` is the
|
|
// MODE, `gps_active` stays the truth about the receiver's power right now.
|
|
// This board has its own manager, so the state machine cannot simply be
|
|
// inherited -- see gpsDutyLoop() for the one T1000-specific difference.
|
|
bool gps_duty = false;
|
|
uint32_t gps_wake_at = 0; // millis of the next sync attempt
|
|
uint32_t gps_awake_until = 0; // millis the current attempt gives up at
|
|
|
|
void start_gps();
|
|
void sleep_gps();
|
|
void stop_gps();
|
|
void gpsDutyLoop();
|
|
public:
|
|
T1000SensorManager(LocationProvider &nmea): _nmea(&nmea) { }
|
|
bool begin() override;
|
|
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
|
void loop() override;
|
|
int getNumSettings() const override;
|
|
const char* getSettingName(int i) const override;
|
|
const char* getSettingValue(int i) const override;
|
|
void requestLocationRefresh() override;
|
|
bool setSettingValue(const char* name, const char* value) override;
|
|
LocationProvider* getLocationProvider() { return _nmea; }
|
|
};
|
|
|
|
#ifdef DISPLAY_CLASS
|
|
extern NullDisplayDriver display;
|
|
#endif
|
|
|
|
extern T1000eBoard board;
|
|
extern WRAPPER_CLASS radio_driver;
|
|
extern VolatileRTCClock rtc_clock;
|
|
extern T1000SensorManager sensors;
|
|
|
|
bool radio_init();
|
|
mesh::LocalIdentity radio_new_identity();
|