Remove redundant tlmConfirm bit in OTA, increasing tlm bandwidth #3377
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove the redundant tlmConfirm bit in PACKET_TYPE_LINKSTATS. The extra byte in the linkstats packet returns fullres telemetry bandwidth back to where it was in 3.x, and also use this packet in standard res modes to provide massive bandwidth increases for low telemetry rates.
Also refactor all names to be consistent where the old "MSP" referred to any data uplink packet and the old "telemetry" referred to any data downlink packet. TelemetryStatus is the same as tlmConfirm, so unified their names as well as stubbornAck.
WARNING: Breaks 4.0 OTA compatibility
This rejiggers many OTA structures. The RX and TX MUST use the this PR or above as mixing prior versions will result in no telemetry (at the best) or crashes.
Redundant Bit
tlmConfirm was present in the
OTA_LinkStats_sstructure, as well as in the surroundingdata_dlunion. This was used somewhat inconsistently throughout the code on both sides of the connection. We only need one, so it is now just in the data_dl union along with the packageIndex. ThetrueDiversityAvailablebit was moved into theOTA_LinkStats_sstructure.Increased Telemetry Bandwidth
This is what you're all reading this for, right? Fullres modes get their 1 byte back in the linkstats that was commandeered during OTA 4.0 development, so it is just back to where it was in 3.x (apart from the 4.0 Gemini boost obviously).
The real star of the show is the clear byte in the standard res packets that was just carrying the
trueDiversityAvailableflag. This is now being used as additional payload for data downlink, similar to the way fullres splits the packet. It is just one byte but far more important is that it increases the number of data downlink transfers from 2 to 4 per second when using Std telemetry. Given that any downlink transfer takes a minimum of 2 packets, this is a massive increase.Time to transfer all Betaflight telemetry items (VBat, FlightMode, VSpd, GPS, Attitude / 14 sensors):
Low (1:128) rates benefit the most and the benefit scales down at higher rates. 1000Hz 1:2 is only a 0.4% theoretical increase.
Refactor / Rename
Some old comments referred to old OTA packet fields. Much of the code referred to uplink data as "MSP" regardless of the fact it usually was CRSF. Downlink data was referred to as telemetry. Everything is now standardized to "data_dl" or "data_ul".
All of the data downlink OTA generator and data uplink OTA processor code was refactored to use common code. The RX's downlink was a real problem to keep together due to how many objects were needed, so it just became a preprocessor macro for readability. The TX's code is a few hundred bytes smaller.