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:
Constantin Leue
2026-08-09 21:10:00 +02:00
parent c9f16b13f8
commit 5fd5d0117a
12 changed files with 594 additions and 0 deletions
+16
View File
@@ -21,6 +21,22 @@ abstract final class MspCommands {
/// msp_waypoint_codec.dart. (`fc_msp.c`, `case MSP_WP_GETINFO`)
static const int wpGetInfo = 20;
/// Request-Payload (1 Byte): u8 wp_no. Response (21 Byte): u8 wp_no, u8
/// action, i32 lat(1e-7 deg), i32 lon(1e-7 deg), i32 alt(cm), i16 p1, i16
/// p2, i16 p3, u8 flag (`fc_msp.c`, `mspFcWaypointOutCommand()`, `case
/// MSP_WP`). Kein Batch-Kommando - ein Request pro Wegpunktnummer, analog
/// zu [setWp]. `wp_no` kennt laut `navigation.c` `getWaypoint()` zwei
/// Sonderwerte neben echten Missions-Wegpunktnummern: 0 = Homepoint
/// (`GPS_home.lat/lon/alt`, nur gueltig wenn `STATE(GPS_FIX_HOME)` -
/// sonst liefert der FC (0,0,0) statt eines Fehlers, siehe
/// msp_waypoint_codec.dart `parseMspHomePoint`), 255 = aktuelle
/// Ist-Position. Der Homepoint selbst wird vom FC NICHT beim ersten
/// GPS-Fix eingefroren, sondern folgt der Drohne kontinuierlich, solange
/// sie disarmed ist und noch nie armed war (`updateHomePosition()`) -
/// gesperrt wird er erst beim ersten Armen (iNAV-Default
/// `reset_home_type = FIRST_ARM`, `settings.yaml`).
static const int getWp = 118;
/// Request-Payload (21 Byte, siehe msp_waypoint_codec.dart
/// `encodeMspSetWaypoint`): u8 wp_no, u8 action, i32 lat(1e-7 deg),
/// i32 lon(1e-7 deg), i32 alt(cm), i16 p1, i16 p2, i16 p3, u8 flag. Nur