Skip to content

MAVLink: in-flight mission upload (10.x, test build) - #2

Open
raphaelhunziker1202-stack wants to merge 1 commit into
maintenance-10.xfrom
mavlink-inflight-mission-upload-10x
Open

MAVLink: in-flight mission upload (10.x, test build)#2
raphaelhunziker1202-stack wants to merge 1 commit into
maintenance-10.xfrom
mavlink-inflight-mission-upload-10x

Conversation

@raphaelhunziker1202-stack

Copy link
Copy Markdown
Owner

Fork-internal PR to run CI (SITL builds + unit tests) for the 10.x variant of the in-flight MAVLink mission upload patch. See commit message.

… not being executed

Aligns the MAVLink mission path with the MSP policy introduced in iNavFlight#10273,
where setWaypoint() accepts mission uploads while armed as long as the WP
mission is not actively being flown. The MAVLink handlers denied every
mission transfer and clear outright while armed.

Changes:
- New mavlinkMissionEditBlocked() gate used by MISSION_COUNT,
  MISSION_CLEAR_ALL, MISSION_ITEM and MISSION_ITEM_INT: edits are refused
  while armed AND (WP mode active OR the mission's own RTH leg is running
  OR the on-the-fly mission planner is active). The RTH-leg term protects
  the land/loiter decision at home, which reads the live list; the planner
  term prevents two writers on the same list. The ARMED term keeps the
  disarmed path provably unchanged.
- When the refused sender owns the receiving transfer, the transfer is
  aborted via mavlinkAbortMissionUpload(MAV_MISSION_DENIED) so the retry
  engine stops soliciting items from a partner that was just denied.
- Guided fly-to-here / altitude-target items are now dispatched on the
  item itself (NAV_WAYPOINT with current == 2 or 3) instead of on transfer
  state, so a guided click can never be absorbed into a running upload.
- mavlinkCommitMissionUpload() / mavlinkClearPersistedMission(): while
  armed the commit or clear applies to RAM only and skips persistence -
  saveNonVolatileWaypointList() refuses to run while armed, and a flash
  write mid-flight would stall the main loop. The uploaded mission
  survives disarm but not a reboot; persisting after landing remains the
  GCS's responsibility. An in-flight upload also collapses a loaded
  multi-mission set to the uploaded mission for the rest of the session.
- mavlinkResolveUploadedMissionJumps(): armed commits now enforce the same
  JUMP rules as the arm-time validation they bypass (no JUMP as first
  item, no self/adjacent targets, sane repeat count, geo-referenced
  target). Ground uploads are left to the arm-time check.
- navigation.c: setWaypoint()'s post-upload clamp of activeWaypointIndex
  uses >= instead of > (the index is 0-based, so index == waypointCount is
  already out of range); new public isWpMissionPlannerActive() accessor.
- Unit tests: the old MissionCountWhileArmedIsRejected asserts the new
  policy as MissionCountWhileArmedStartsTransfer; new tests cover the
  WP-mode and mission-RTH rejections, RAM-only armed commit and clear
  (persist not called), and the preserved clear rejection during WP mode.

The staged upload buffer with atomic commit and snapshot rollback means an
in-flight upload never exposes a partially written list to the navigation
state machine within a main-loop tick. Note the deliberate MSP-parity
semantics carried over from iNavFlight#10273: with nav_wp_mission_restart = RESUME,
replacing the mission mid-flight keeps the waypoint index when the new
mission is at least as long as the index.
@raphaelhunziker1202-stack
raphaelhunziker1202-stack force-pushed the mavlink-inflight-mission-upload-10x branch from cfc457a to 1209520 Compare September 1, 2026 17:57
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

RAM / Flash usage vs. base branch — commit 1209520

No size baseline is available yet for this PR's base commit (no per-commit baseline has been published for it). This comment will show deltas once one exists — rebasing the PR refreshes its base commit.

Target Flash Δ RAM Δ
MATEKF405 701959 B (no baseline) 149532 B (no baseline)
MATEKF722 467539 B (no baseline) 125284 B (no baseline)
MATEKF765 741531 B (no baseline) 165592 B (no baseline)
MATEKH743 775087 B (no baseline) 168036 B (no baseline)

See RAM/flash optimization guide for techniques to reduce usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant