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:
@@ -142,4 +142,21 @@ class MspFlightControllerLink implements FlightControllerLink {
|
||||
await client.request(MspCommands.navStatus),
|
||||
);
|
||||
}
|
||||
|
||||
/// Fragt WP#0 (Homepoint, siehe `MspCommands.getWp`-Doku) gezielt per
|
||||
/// `MSP_WP` ab - bewusst kein Teil von [MspTelemetryPoller]s Zyklus (Doku:
|
||||
/// "Homepoint muss nicht kontinuierlich abgefragt werden"), Aufrufer ist
|
||||
/// home_point_provider.dart.
|
||||
@override
|
||||
Future<HomePoint?> readHomePoint() async {
|
||||
final client = _client;
|
||||
if (client == null) {
|
||||
throw StateError('readHomePoint() vor connect() aufgerufen.');
|
||||
}
|
||||
final payload = await client.request(
|
||||
MspCommands.getWp,
|
||||
payload: encodeMspGetWaypointRequest(mspWpNumberHome),
|
||||
);
|
||||
return parseMspHomePoint(payload);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user