Skip to content

core: frontend: mavlink: Skip SET_MESSAGE_INTERVAL when rate is 0 - #4134

Open
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:fix/mavlink-zero-refresh-rate
Open

core: frontend: mavlink: Skip SET_MESSAGE_INTERVAL when rate is 0#4134
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:fix/mavlink-zero-refresh-rate

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

  • MavlinkUpdater registers HEARTBEAT with refreshRate: 0 (listen-only).
  • requestMessageRate still POSTed MAV_CMD_SET_MESSAGE_INTERVAL with param2 = 1000000 / 0Infinity → JSON null.
  • mavlink2rest rejects that as an invalid MAVLink message and returns 404 on every page load (unable to send message...).
  • Skip the POST when rate === 0; websocket listening is unchanged.

Test plan

  • Load BlueOS UI; Network tab should show no failing POST /mavlink2rest/mavlink with param2: null for HEARTBEAT.
  • Confirm HEARTBEAT / vehicle connected state still updates in the tray.
  • Open a page that requests a non-zero rate (e.g. Vehicle Setup PWM / compass) and confirm SET_MESSAGE_INTERVAL POSTs still return 200.

refreshRate 0 means listen-only (HEARTBEAT). Dividing by zero produced
Infinity→null in the POST body and mavlink2rest answered 404 on every load.
@joaoantoniocardoso
joaoantoniocardoso force-pushed the fix/mavlink-zero-refresh-rate branch from 69deee6 to 5e63e31 Compare August 12, 2026 01:26
@joaoantoniocardoso
joaoantoniocardoso requested a review from a team August 12, 2026 01:27
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as ready for review August 12, 2026 01:28
@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: LGTM :shipit:

Adds an early return in Mavlink2RestManager.requestMessageRate (core/frontend/src/libs/MAVLink2Rest/index.ts:206) so that a rate of 0 skips the MAV_CMD_SET_MESSAGE_INTERVAL POST — previously param2 = 1000000 / 0 serialised to JSON null and mavlink2rest 404'd on every page load for the listen-only HEARTBEAT registration. Websocket listening is untouched.

No further comments, nice job 👍

Generated by PR Review Bot. This is advisory, a human reviewer must still approve.

}
// 0 Hz means listen only (e.g. HEARTBEAT). Do not POST SET_MESSAGE_INTERVAL:
// 1000000 / 0 is Infinity, JSON-serialized as null, and mavlink2rest returns 404.
if (rate === 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not a huge fan of this test, I would recommend checking for:

Suggested change
if (rate === 0) {
if (rate < 0.01) {

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.

2 participants