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_GPS: Don't reset the entire buffer when handling RTCM data #15532

Merged
merged 1 commit into from
Oct 25, 2020

Conversation

WickedShell
Copy link
Contributor

This is a micro optimization intended to just make handling GPS corrections a bit faster.

This tested by injecting data from a GCS with extra tracing prints added to test when we were not injecting data. This also saves 8 bytes of flash on a CubeBlack, but that's definitely not the target here.

It's slightly out of scope at the moment, and I don't have time to do it now, but testing the various paths for the RTCM injection is a good candidate for a CI test in the future (both testing that assembly works, as well as rejecting out of order packets).

@@ -1311,7 +1312,7 @@ void AP_GPS::handle_gps_rtcm_fragment(uint8_t flags, const uint8_t *data, uint8_
if (len < MAVLINK_MSG_GPS_RTCM_DATA_FIELD_DATA_LEN) {
rtcm_buffer->fragment_count = fragment+1;
rtcm_buffer->total_length = (MAVLINK_MSG_GPS_RTCM_DATA_FIELD_DATA_LEN*fragment) + len;
} else if (rtcm_buffer->fragments_received == 0x0F) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this right? can't we be missing an earlier one? could be out of order on UDP

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine either way, we won't flush the buffer until all the fragments have been received, so we must have received the last one before we can test. I did explicitly test this by manually sending packets up out of order from a GCS and I had instrumented the state to see where we were and it behaved correctly.

This is a micro optimization intended to just make handling GPS
corrections a bit faster.
@tridge tridge merged commit a61444c into ArduPilot:master Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants