Conversation
srxl2ProcessEsc() takes the time once, before draining the port, and then compares it against the timestamps that draining the port has just written. When the millisecond turns over in between, the unsigned difference wraps: the reading that has only now arrived reads as 49 days old, the telemetry is marked invalid, and it stays invalid until the next frame. On the bench, with an Avian answering every telemetry request but rotating between sensors, so that the ESC readings themselves arrive about twice a second, that cost 19 blackouts in 180 seconds, each lasting from 100 ms to a second. The OSD, Blackbox, current estimation and the RPM filter all lose the ESC data for that long. After taking the time again once the port is drained, the same run had none, with the link up throughout. The same wrap also sits on the link timeout, one line below, which on a bus that agreed to a higher rate would drop back to 115200 and go looking for the ESC again.
Contributor
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR |
PR Summary by QodoRefresh SRXL2 timestamps after draining received frames
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this fixes
srxl2ProcessEsc()takes the time once, before draining the port, and then compares itagainst the timestamps that draining the port has just written. When the millisecond turns
over in between, the unsigned difference wraps: the reading that has only now arrived reads
as 49 days old, the telemetry is marked invalid, and it stays invalid until the next frame.
Measured on an Avian, which answers every telemetry request but rotates between sensors, so
its ESC readings arrive about twice a second:
While the telemetry is invalid the OSD, Blackbox, current estimation and the RPM filter have
no ESC data, and the link itself never drops, so nothing else shows that anything is wrong.
The same wrapped comparison sits on the link timeout one line below. On a bus that agreed to
a higher rate it drops back to 115200, forgets the device and goes looking for the ESC again,
which is a heavier consequence of the same cause.
What I changed
The time is taken again once the port has been drained, so every comparison in the cycle is
made against a clock reading no older than the frames it is compared with.
Testing
On the bench, an Avian on a TBS Lucid H7 Wing, sampled 47 times a second for 180 s: no
telemetry blackouts and no link drops, against 19 blackouts in the same run before the
change. The instrumentation also showed what was happening inside a blackout: requests kept
going out and replies kept arriving, only the ESC readings among them were being thrown away.