Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Proper unsigned value support for CRSF Telemetry#7066

Open
CapnBry wants to merge 1 commit intoEdgeTX:main from
CapnBry:crsf-unsigned
Open

Proper unsigned value support for CRSF Telemetry #7066
CapnBry wants to merge 1 commit intoEdgeTX:main from
CapnBry:crsf-unsigned

Conversation

@CapnBry
Copy link
Contributor

@CapnBry CapnBry commented Feb 2, 2026
edited
Loading

Alters the deserialization of CRSF telemetry to properly support unsigned values, and removes the check for values being -1.

Details

The CRSF telemetry parser currently unpacks every value as signed, regardless of what the spec says for that parameter. There are unsigned values in the spec though, and the current code (going all the way back) does not present them properly. For example the GPS packet's heading value is unsigned and that means that any value greater than 327.67 degrees shows up as negative. Betaflight telemetry example:

screen-2000年01月01日-000131

In addition, the current code checks for values where every byte sent is 0xff and discards the value if that condition is met. There is nothing in the CRSF spec that says "send 0xff... to not update the value", the only mention is on the 0x09 Barometric Altitude description where the example contains a comment stating "OpenTX counts any 0xFFFF [altitude] value as incorrect". Due to this code being used always, any telemetry parameter anywhere will ignore 0xff, 0xffff, 0xffffff, or 0xffffffff. This has been removed for also not matching the CRSF spec.

I also removed the template function used to do the parsing. I am not sure who was like ooh this is gonna really optimize performance when the compiler unrolls that loop for me! It's stupid, just pass the size.

Now-Unsigned Telemetry Items

  • GPS - Ground Speed, Heading, Altitude (uses -1000 offset), satellites
  • Baro Alt - Altitude (encoded)
  • Airspeed
  • RPM - Sensor ID
  • Temp - Sensor ID
  • Cells/Voltages - Sensor ID, Voltage (in both types)
  • Link RX - RSSI percentage, RF Power dBm
  • Link TX - RSSI percentage, RF Power dBm, FPS
  • Battery - "Capacity" (mAh consumed), Percent remaining
  • CRSFShot / OpenTX Sync - Update Interval

See? It works! Code size is also reduced by this change by 192 bytes.

screen-2000年01月01日-000131-after

3djc reacted with thumbs up emoji
Copy link
Collaborator

3djc commented Feb 2, 2026

To be fair, initial CRSF support was done with minimal documentation.

CapnBry reacted with heart emoji

Copy link
Member

pfeerick commented Feb 2, 2026 via email
edited
Loading

Wasn’t the initial support done by or in collaboration with TBS though? I thought that was the reason OpenTX and Betaflight implementations of CRSF was considered the defence implementation by many. Not taking into account the changes to the CRSF spec over time, or bugs in the initial implementation. On a personal note, it will be nice to have non-negative headings... 😂

Copy link
Contributor Author

CapnBry commented Feb 2, 2026

Wasn’t the initial support done by or in collaboration with TBS though?

Yeah it was done by a third party working for TBS I believe. I also think of this implementation as the reference, but also nobody still around knows why they were coded the way they were. I do believe that the -1 thing was unintentional baggage from an early prototype implementation, because no FC software I am aware of (Betaflight, iNav or Ardupilot) sends -1 to prevent a field from updating. I don't believe TBS sends internal telemetry (LINK_RX/TX) with -1 in the values, else it would be mentioned in the spec.

But! This is all just researched speculation on my part. As far as the non-TX-to-Handset telemetry items, it seems that that's all but guaranteed by the FC implementations listed. There could be some obscure legacy hardware I'm not aware of though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /