Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_ESC_Telem: fix timeout race #298

Draft
wants to merge 4 commits into
base: CxPilot-7
Choose a base branch
from

Conversation

robertlong13
Copy link
Collaborator

Needs a brief flight test.

andyp1per and others added 4 commits January 10, 2025 11:58
add tests for timeout functions
The RPM telemetry data structure can get updated by another thread at
any time. This can cause (now - last_update_us) to be negative, which
looks like the data is nearly UINT32_MAX microseconds stale. To fix
this, we copy the last_update_us value before we get the current time
so it's guaranteed to be positive.

We also minimize the number of places we explicitly check the timestamp
and rely on the `data_valid` where possible to minimize the performance
impact of this change.
The timeout for non-RPM telemetry is vulnerable to a similar race as the
RPM. This change makes the timeout logic consistent between the two.
@robertlong13 robertlong13 added the DELAY MERGE This PR needs to wait for the appropriate point in the release cycle before it is actually merged. label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DELAY MERGE This PR needs to wait for the appropriate point in the release cycle before it is actually merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants