Skip to content

fix(telemetry): match INAV's flight-mode reporting in the relay encoders - #32

Open
b14ckyy wants to merge 1 commit into
masterfrom
fix/telemetry-mode-parity
Open

fix(telemetry): match INAV's flight-mode reporting in the relay encoders#32
b14ckyy wants to merge 1 commit into
masterfrom
fix/telemetry-mode-parity

Conversation

@b14ckyy

@b14ckyy b14ckyy commented Aug 4, 2026

Copy link
Copy Markdown
Owner

The relay encoders (LTM / CRSF / S.Port) now collapse combined flight modes exactly like INAV's own telemetry encoders — the chains are taken verbatim from telemetry/ltm.c, telemetry/crsf.c and telemetry/smartport.c. Combined modes (Angle+AltHold, Horizon+AltHold, AngleHold+AltHold, launch during cruise, autoland during RTH) now report identically to a real INAV FC on the same link type.

  • CRSF vocabulary: "AH" for alt hold (previously mislabelled "ANGH", which is INAV's angle-hold mode), CRSH/CRUZ distinction, LAND/TURT, "!ERR" when disarmed with arming blocked
  • S.Port: INAV's exact decimal-column packing — incl. the else-chains that stop RTH+WP+course-hold overflowing the thousands column, the readiness ones-digit, and the HEADFREE/TURTLE/ANGLEHOLD columns (decoder reads the new columns too)
  • New unified modes anglehold + turtle end-to-end (classify → registry → widget/track colors)
  • MSP: no more flight-mode guessing while MSP_BOXIDS hasn't arrived — a bit index is not a permanent box id; same guard for the RC-override box check
  • 8 new unit tests pin the collapses against the INAV chains and round-trip S.Port encode→decode

Checks: cargo check clean, cargo test 94 passed, npm run check 0/0.

…encoders

The LTM/CRSF/S.Port relay encoders collapsed the unified flight-mode
bitfield in an ad-hoc order, so combined modes reported differently from
what INAV itself sends over the same telemetry type (launch during cruise,
autoland during RTH, angle+althold, ...). All three now follow the INAV
encoder sources verbatim:

- LTM: ltm_sframe() chain — manual first, autoland last, HEADFREE
  included, RATE (1) fallback instead of ACRO (4)
- CRSF: crsfFrameFlightMode() chain + vocabulary — "AH" = alt hold (was
  wrongly labelled "ANGH", which is INAV's angle-hold MODE), CRSH vs CRUZ
  distinction, LAND/TURT, disarmed "!ERR" when arming is blocked
- S.Port: frskyGetFlightMode() decimal columns incl. the else-chains that
  keep every column a single digit (RTH+WP+course hold could previously
  overflow the thousands column into its neighbour), the readiness ones
  digit, and the HEADFREE/TURTLE/ANGLEHOLD columns

Decode side: the FrSky decoder reads the TURTLE and ANGLEHOLD columns, the
CRSF decoder maps "ANGH" to the new anglehold mode (not althold), "LAND"
to RTH+autoland and "TURT" to turtle; classify_inav knows both new modes
and the frontend registry renders them.

parse_active_modes/box_active no longer guess modes while MSP_BOXIDS is
missing — a raw bit index is not a permanent box id, and the guess
produced confidently wrong modes (and could false-trigger the RC
override). Their per-frame eprintln! diagnostics moved to log::debug!.

Unit tests pin all three collapses against the INAV chains and round-trip
S.Port encode -> decode.

Co-Authored-By: Claude Opus 4.8
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