Skip to content

osd: show the right flight mode name - #139

Merged
vertexodessa merged 1 commit into
OpenIPC:masterfrom
vertexodessa:fix/osd-flight-mode-names
Oct 31, 2026
Merged

vertexodessa merged 1 commit into
OpenIPC:masterfrom
vertexodessa:fix/osd-flight-mode-names

Conversation

@vertexodessa

Copy link
Copy Markdown
Collaborator

The OSD read the flight mode as an ArduPlane custom_mode number, but mavlink.cpp already converts it to the FLIGHT_MODE_* values from mavlink.h. So only STABILIZE was right (it's 2 in both). ACRO showed Unknown, MANUAL showed CIRCLE, RTL showed FLY_BY_WIRE_A, FBWA showed AUTO.

The switch now uses the FLIGHT_MODE_* values, one to one with mavlink.h.

One visible change: a mode mavlink.cpp doesn't know (e.g. a non-ArduPlane FC) stays 0, which used to show as MANUAL and now shows Unknown.

The heartbeat handler in mavlink.cpp converts the ArduPlane custom_mode
into the FLIGHT_MODE_* values from mavlink.h, but the OSD switch was
keyed by the ArduPlane numbers. Only STABILIZE (2 in both) was shown
right: ACRO showed Unknown, MANUAL showed CIRCLE, RTL showed
FLY_BY_WIRE_A, FBWA showed AUTO.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Fix OSD flight mode names

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Match OSD flight mode names to the normalized values supplied by MAVLink telemetry.
• Show Unknown instead of MANUAL when the flight mode is unrecognized.
Diagram

graph TD
  Heartbeat["MAVLink heartbeat"] --> Decoder["Mode conversion"] --> Telemetry["MavlinkData"] --> OSD["OSD mode lookup"] --> Display["Flight mode label"]
Loading
High-Level Assessment

Correcting the OSD lookup at the consumer is appropriate because the native heartbeat handler already converts custom modes. Changing that conversion or introducing a shared cross-language mode registry would add scope without addressing a separate need.

Files changed (1) +21 / -20

Bug fix (1) +21 / -20
OSDManager.javaKey OSD flight mode names by normalized mode values +21/-20

Key OSD flight mode names by normalized mode values

• Replaces the ArduPlane custom-mode cases with names aligned to the FLIGHT_MODE values carried by MavlinkData. A zero or otherwise unmatched value now displays Unknown rather than MANUAL.

app/src/main/java/com/openipc/pixelpilot/osd/OSDManager.java

@vertexodessa
vertexodessa merged commit f70b3aa into OpenIPC:master Oct 31, 2026
4 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.

1 participant