Batch the Fly App's telemetry and split it per subsystem
The GO 4-style HUD needs far more live data than the bridge sent, and pushing every SDK callback straight to Dart would rebuild the screen dozens of times a second. This is the telemetry foundation (plan P1). On the Kotlin side, every source now writes into a TelemetryHub that emits one telemetry event per tick: flight-controller state, gimbal and vision at up to 10 Hz, battery, links, RC, storage and camera settings folded in at up to 2 Hz. Each event carries the full latest snapshot, so a consumer that drops packets never loses a slow group. New bridges cover batteries (every pack, cell voltages, warning thresholds), link quality and RC battery, diagnostics, and obstacle sensing per sensor. KeyBridge adds generic getKey/setKey/listenKey over KeyManager for the settings rows to come. The flight controller also gains smart-RTH confirmation and simulator start/stop. On the Dart side, FlightModel now owns one ChangeNotifier per subsystem (aircraft, battery, links, camera, gimbal, vision, alerts, mission), so a HUD widget can listen to just the one it draws. TelemetryReducer routes events into them, only notifies groups that changed, and gives FlightModel one notification per tick. Flat getters keep the existing screens working. Diagnostics become graded, de-duplicated alerts. Settings > About > Telemetry inspector shows every field live and can start the simulator. Battery no longer arrives as its own event, so the API Server reads the percentage from the telemetry snapshot (the old event is still accepted). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a8483ecf45
commit
f6bbb1cfee
28 files changed
+2716
-187
No files matched your search
@@ -149,4 +149,12 @@ func applyTelemetry(t *Telemetry, raw map[string]any) {
|
||||
if v, ok := toFloat(raw["velocityZ"]); ok {
|
||||
t.VelocityZ = &v
|
||||
}
|
||||
// Since the Fly App batches telemetry, the battery rides along as a nested
|
||||
// group whose top-level percent is the weakest pack. The standalone
|
||||
// "battery" event is still accepted for older app builds.
|
||||
if b, ok := raw["battery"].(map[string]any); ok {
|
||||
if p, ok := toInt(b["percent"]); ok {
|
||||
t.BatteryPercent = &p
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user