Point the fly-mode rubber band at home during Return-to-Home
iNAV freezes activeWaypointIndex at whatever mission waypoint was active when RTH engaged instead of updating it to reflect the new target - navigation.c derives NAV_Status.activeWpIndex unconditionally from posControl.activeWaypointIndex, and none of the RTH state-entry handlers touch that field. Drawing the guidance line to that stale index would point at a waypoint the aircraft may have already passed. Extracted the target selection into computeRubberBandTarget() (mission stats.dart) so the RTH special-case and the abort-back-to-waypoint-mode fallback are unit-tested rather than only living inline in the widget build method - since it re-evaluates navMode on every frame, aborting RTH switches the line back to the mission waypoint with no extra transition logic needed.
This commit is contained in:
@@ -293,23 +293,25 @@ class _FlyScreenState extends ConsumerState<FlyScreen> {
|
||||
child: const DroneMarkerIcon(),
|
||||
);
|
||||
|
||||
// Gestrichelte Linie von der Drohne zum aktiven Wegpunkt (Doku 3.4:
|
||||
// Gestrichelte Linie von der Drohne zum aktuellen Flugziel (Doku 3.4:
|
||||
// TelemetryFrame.activeWaypointIndex aus MSP_NAV_STATUS) - derselbe
|
||||
// Darstellungsstil wie das Reticle-Gummiband im Plan-Modus (MissionMap.
|
||||
// rubberBandLine), hier aber Drohne -> naechster Wegpunkt statt letzter
|
||||
// Wegpunkt -> Kartenmitte.
|
||||
List<LatLng>? rubberBand;
|
||||
// rubberBandLine), hier aber Drohne -> Flugziel statt letzter Wegpunkt
|
||||
// -> Kartenmitte. Das Ziel selbst (Missionswegpunkt oder bei Return-to-
|
||||
// Home der Homepoint) kommt aus computeRubberBandTarget, siehe dortige
|
||||
// Doku fuer den RTH-Sonderfall.
|
||||
final activeWpIndex = telemetry?.activeWaypointIndex;
|
||||
if (telemetry != null &&
|
||||
telemetry.hasFix &&
|
||||
activeWpIndex != null &&
|
||||
activeWpIndex >= 0 &&
|
||||
activeWpIndex < waypoints.length) {
|
||||
final target = waypoints[activeWpIndex];
|
||||
rubberBand = [
|
||||
LatLng(telemetry.lat, telemetry.lon),
|
||||
LatLng(target.lat, target.lon),
|
||||
];
|
||||
List<LatLng>? rubberBand;
|
||||
if (telemetry != null && telemetry.hasFix) {
|
||||
final target = computeRubberBandTarget(
|
||||
navMode: telemetry.navMode,
|
||||
activeWaypointIndex: activeWpIndex,
|
||||
waypoints: waypoints,
|
||||
homePoint: homePoint == null ? null : LatLng(homePoint.lat, homePoint.lon),
|
||||
);
|
||||
if (target != null) {
|
||||
rubberBand = [LatLng(telemetry.lat, telemetry.lon), target];
|
||||
}
|
||||
}
|
||||
|
||||
// Live-Missionsstatus fuer die Details-Pille (Doku: "aktiver Wegpunkt
|
||||
|
||||
Reference in New Issue
Block a user