Check if its possible to add MAVLink Endpoints#3792
Check if its possible to add MAVLink Endpoints#3792patrickelectric merged 3 commits intobluerobotics:masterfrom
Conversation
Reviewer's GuideEnforces 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 enablementsequenceDiagram
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
Updated class diagram for autopilot store and related Vue componentsclassDiagram
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
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
EndpointManager.vue, the newautopilot_board_is_runningcomputed relies onthis.heartbeat_age(), but that method is not defined in this component in the diff; consider either importing/reusing the shared logic (e.g., from whereheartbeat_ageis defined) or moving the age calculation into the store to avoid a hidden dependency. - Relaxing the
Autopilot.vuestart/stop button condition fromsettings.is_pirate_mode && board_supports_start_stopto justsettings.is_pirate_modechanges behavior for boards likeManual; double-check that exposing start/stop for all boards is intentional and that the removedboard_supports_start_stoplogic 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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ES-Alexander
left a comment
There was a problem hiding this comment.
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.
patrickelectric
left a comment
There was a problem hiding this comment.
The space is a bit weird, can you take a look on that ?
def5ea7 to
21dfad9
Compare
21dfad9 to
71c2778
Compare
c5e9d1e to
12eaa22
Compare
12eaa22 to
be31199
Compare
There was a problem hiding this comment.
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.
be31199 to
b9902f2
Compare
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:
Summary by Sourcery
Gate MAVLink endpoint creation on the autopilot’s running state and centralize heartbeat tracking in the autopilot store.
New Features:
Bug Fixes:
Enhancements:
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_dateinautopilotVuex store (updated fromHealthTrayMenu) and using it (pluscurrent_boardpresence) inEndpointManagerto determine whether the autopilot is running; also always shows Start/Stop buttons in pirate mode (removes theboard_supports_start_stopgate).Written by Cursor Bugbot for commit b9902f2. This will update automatically on new commits. Configure here.