Show the drone's locked home point on the fly-mode map
Adds MSP_WP (118) support to query the flightcontroller's stored home point (WP#0 is a special case for this in iNAV's getWaypoint(), per navigation.c) - the FC reports (0,0,0) rather than an error before one is set, so parseMspHomePoint() treats that pair as "unset". Rendered with a small pentagon house icon (design/homepoint-pentagon.svg, ported to a CustomPainter like the other map icons). Deliberately not polled continuously: a new home_point_provider.dart refreshes it only at the three moments the FC's home point can actually change - connect/reconnect, GPS fix acquired, and arming (iNAV's default reset_home_type=FIRST_ARM only freezes it at the first arm; before that it continuously follows the aircraft while disarmed). Mock's implementation offsets the point 25m from the anchor so it doesn't sit exactly under the drone marker during UI testing.
This commit is contained in:
@@ -222,4 +222,24 @@ class MockFlightControllerLink implements FlightControllerLink {
|
||||
|
||||
@override
|
||||
Future<int?> readActiveWaypointIndex() async => _activeWaypointIndex;
|
||||
|
||||
/// Liefert immer einen Wert (nahe dem Ankerpunkt, siehe Klassendoku) statt
|
||||
/// wie der echte FC vor dem ersten Fix `null` - fuer UI-Entwicklung ohne
|
||||
/// Hardware (Doku 9) ist ein sofort sichtbarer Homepoint-Marker
|
||||
/// hilfreicher als ein realistisch leerer Zustand.
|
||||
///
|
||||
/// Bewusst um [_homeOffsetM] Meter suedlich des Ankerpunkts versetzt statt
|
||||
/// exakt darauf: der Drohnen-Marker (siehe connect()) startet ebenfalls am
|
||||
/// Ankerpunkt und drueckt sich nur innerhalb von [_driftRadiusM] (10 m)
|
||||
/// davon weg - ohne Versatz lag der Homepoint-Marker im Mock-Test also
|
||||
/// praktisch immer direkt unter dem Drohnen-Marker und war nie als
|
||||
/// eigenes Icon zu sehen.
|
||||
static const _homeOffsetM = 25.0;
|
||||
|
||||
@override
|
||||
Future<HomePoint?> readHomePoint() async => HomePoint(
|
||||
lat: _anchorLat - _homeOffsetM / _metersPerDegreeLat,
|
||||
lon: _anchorLon,
|
||||
altitudeM: 0,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user