-
-
Notifications
You must be signed in to change notification settings - Fork 471
Proper unsigned value support for CRSF Telemetry#7066
Proper unsigned value support for CRSF Telemetry #7066CapnBry wants to merge 1 commit intoEdgeTX:main from
Conversation
3djc
commented
Feb 2, 2026
To be fair, initial CRSF support was done with minimal documentation.
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.
Uh oh!
There was an error while loading. Please reload this page.
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日-000131In 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
See? It works! Code size is also reduced by this change by 192 bytes.
screen-2000年01月01日-000131-after