Skip to content

Conversation

@CapnBry
Copy link
Contributor

@CapnBry CapnBry commented Feb 2, 2026

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
Copy link
Collaborator

3djc commented Feb 2, 2026

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

@pfeerick
Copy link
Member

pfeerick commented Feb 2, 2026 via email

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.

3 participants