Skip to content

Check if its possible to add MAVLink Endpoints#3792

Merged
patrickelectric merged 3 commits intobluerobotics:masterfrom
nicoschmdt:fix-mavlink-endpoint
Feb 12, 2026
Merged

Check if its possible to add MAVLink Endpoints#3792
patrickelectric merged 3 commits intobluerobotics:masterfrom
nicoschmdt:fix-mavlink-endpoint

Conversation

@nicoschmdt
Copy link
Contributor

@nicoschmdt nicoschmdt commented Feb 11, 2026

fix: #3586

Only enables the add MAVLink Endpoint button if autopilot is running and the current_board is not null. If one of those is invalid a message will be displayed with a button which redirects to the Autopilot Firmware tab:

image image

Summary by Sourcery

Gate MAVLink endpoint creation on the autopilot’s running state and centralize heartbeat tracking in the autopilot store.

New Features:

  • Display a message with a link to the Autopilot Firmware tab when attempting to manage endpoints while the autopilot is not running.

Bug Fixes:

  • Disable the Add MAVLink Endpoint action when no active board is running to prevent invalid endpoint creation.

Enhancements:

  • Reuse the global autopilot heartbeat timestamp for determining autopilot running state in the endpoint manager.
  • Always show start/stop autopilot buttons in pirate mode regardless of board type.

Note

Low Risk
UI/state gating changes only; main risk is incorrect heartbeat/board-state detection potentially disabling endpoint creation or showing the wrong empty state.

Overview
Prevents creating MAVLink endpoints when the autopilot isn’t actively running by disabling the “add endpoint” FAB and showing a dedicated empty-state message linking users to the Autopilot Firmware tab.

Centralizes heartbeat tracking by storing last_heartbeat_date in autopilot Vuex store (updated from HealthTrayMenu) and using it (plus current_board presence) in EndpointManager to determine whether the autopilot is running; also always shows Start/Stop buttons in pirate mode (removes the board_supports_start_stop gate).

Written by Cursor Bugbot for commit b9902f2. This will update automatically on new commits. Configure here.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 11, 2026

Reviewer's Guide

Enforces that MAVLink endpoints can only be added when the autopilot is running and a current board is present, centralizes heartbeat timing in the autopilot store, and slightly relaxes visibility conditions for start/stop buttons in the Autopilot view while keeping restart logic separate.

Sequence diagram for heartbeat propagation and endpoint creation enablement

sequenceDiagram
  participant MAVLinkSource
  participant HealthTrayMenu
  participant AutopilotStore
  participant EndpointManager

  MAVLinkSource->>HealthTrayMenu: receive MAVLinkHeartbeatMessage
  HealthTrayMenu->>AutopilotStore: setSystemId
  HealthTrayMenu->>AutopilotStore: setAutopilotType
  HealthTrayMenu->>AutopilotStore: setVehicleArmed
  HealthTrayMenu->>AutopilotStore: setLastHeartbeatDate(newDate)

  loop UI render
    EndpointManager->>AutopilotStore: read current_board
    EndpointManager->>AutopilotStore: read last_heartbeat_date
    EndpointManager->>EndpointManager: heartbeat_age = now - last_heartbeat_date
    EndpointManager->>EndpointManager: autopilot_board_is_running = current_board not null && heartbeat_age < 3000
    alt autopilot_board_is_running is true
      EndpointManager-->>EndpointManager: enable AddMavlinkEndpoint button
      EndpointManager-->>EndpointManager: show No endpoints available message
    else autopilot_board_is_running is false
      EndpointManager-->>EndpointManager: disable AddMavlinkEndpoint button
      EndpointManager-->>EndpointManager: show Autopilot must be running message
    end
  end
Loading

Updated class diagram for autopilot store and related Vue components

classDiagram
  class AutopilotStore {
    +string vehicle_type
    +boolean verhicle_armed
    +Date last_heartbeat_date
    +Parameter parameter(name)
    +void setLastHeartbeatDate(date)
  }

  class HealthTrayMenu {
    +number time_limit_heartbeat
    +number heartbeat_age()
  }

  class EndpointManager {
    +boolean are_endpoints_available()
    +boolean autopilot_board_is_running()
    +void openCreationDialog()
  }

  class AutopilotView {
    +boolean board_supports_restart()
  }

  AutopilotStore <.. HealthTrayMenu : updates
  AutopilotStore <.. EndpointManager : reads
  AutopilotView <.. AutopilotStore : uses current_board
  HealthTrayMenu ..> AutopilotStore : setLastHeartbeatDate
  EndpointManager ..> AutopilotStore : last_heartbeat_date
  EndpointManager ..> AutopilotStore : current_board
Loading

File-Level Changes

Change Details Files
Gate MAVLink endpoint creation and empty-state messaging on autopilot running status.
  • Replace the simple 'No endpoints available' card with a container that shows either a 'start autopilot' guidance message with a link to the Autopilot Firmware tab when the autopilot is not running, or the original 'No endpoints available' message when it is running.
  • Introduce a computed property that determines whether the autopilot board is considered running based on current_board being non-null and heartbeat recency.
  • Disable the floating action button for creating endpoints when the autopilot is not running.
core/frontend/src/components/autopilot/EndpointManager.vue
Move heartbeat tracking from a local component field into the shared autopilot store.
  • Remove the HealthTrayMenu-local last_heartbeat_date field and instead update the shared autopilot store when heartbeats are received.
  • Adjust heartbeat_age() to read from the store’s last_heartbeat_date rather than component state.
  • Add last_heartbeat_date to the Vuex autopilot store to make heartbeat timing globally accessible.
core/frontend/src/components/health/HealthTrayMenu.vue
core/frontend/src/store/autopilot.ts
Simplify conditions for showing start/stop buttons in the Autopilot view.
  • Remove the board_supports_start_stop computed property that excluded 'Manual' boards from showing start/stop buttons.
  • Update visibility conditions of the Start and Stop autopilot buttons to depend only on pirate mode, no longer on board_supports_start_stop.
core/frontend/src/views/Autopilot.vue

Assessment against linked issues

Issue Objective Addressed Explanation
#3586 Ensure that creating a MAVLink endpoint (e.g., Serial on /dev/serial0 at 921600) successfully results in a saved endpoint rather than returning to a blank 'No endpoints available' state.
#3586 Provide clear UI feedback and guardrails when MAVLink endpoints cannot be created (instead of an empty message bar and silent failure).

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In EndpointManager.vue, the new autopilot_board_is_running computed relies on this.heartbeat_age(), but that method is not defined in this component in the diff; consider either importing/reusing the shared logic (e.g., from where heartbeat_age is defined) or moving the age calculation into the store to avoid a hidden dependency.
  • Relaxing the Autopilot.vue start/stop button condition from settings.is_pirate_mode && board_supports_start_stop to just settings.is_pirate_mode changes behavior for boards like Manual; double-check that exposing start/stop for all boards is intentional and that the removed board_supports_start_stop logic is no longer needed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `EndpointManager.vue`, the new `autopilot_board_is_running` computed relies on `this.heartbeat_age()`, but that method is not defined in this component in the diff; consider either importing/reusing the shared logic (e.g., from where `heartbeat_age` is defined) or moving the age calculation into the store to avoid a hidden dependency.
- Relaxing the `Autopilot.vue` start/stop button condition from `settings.is_pirate_mode && board_supports_start_stop` to just `settings.is_pirate_mode` changes behavior for boards like `Manual`; double-check that exposing start/stop for all boards is intentional and that the removed `board_supports_start_stop` logic is no longer needed.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Collaborator

@ES-Alexander ES-Alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Text seems fine 👍

Not fully sure about that button in the middle of the text - does it look bad as just a hyperlink? I think I mostly dislike how much horizontal space there is.

Copy link
Member

@patrickelectric patrickelectric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The space is a bit weird, can you take a look on that ?

@nicoschmdt nicoschmdt force-pushed the fix-mavlink-endpoint branch 2 times, most recently from c5e9d1e to 12eaa22 Compare February 12, 2026 15:03
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@patrickelectric patrickelectric merged commit c83389d into bluerobotics:master Feb 12, 2026
8 checks passed
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.

bug: MAVLink Endpoints not saving

3 participants