Skip to content

Heinrichs Weikamp: Add Placeholder for GPS Coordinates on OSTC5 #87

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

Open
wants to merge 2 commits into
base: Subsurface-DS9
Choose a base branch
from

Conversation

mikeller
Copy link
Member

Add a placeholder for the yet to be added GPS coordinates on OSTC5. This
fixes the misalignment of the parsed data when the log was generated by
firmware with GPS support.

Signed-off-by: Michael Keller [email protected]

Add a placeholder for the yet to be added GPS coordinates on OSTC5. This
fixes the misalignment of the parsed data when the log was generated by
firmware with GPS support.

Signed-off-by: Michael Keller <[email protected]>
@mikeller mikeller requested a review from Copilot June 16, 2025 13:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a placeholder for parsing GPS coordinates on OSTC5 logs to correct misaligned data when GPS-supported firmware is used.

  • Introduces a coordinate_value_t union for interpreting raw bits as unsigned int or float
  • Implements a new branch that reads 8 bytes for longitude/latitude and logs them
  • Includes buffer underflow checking before consuming the GPS data
Comments suppressed due to low confidence (1)

src/hw_ostc_parser.c:1211

  • Consider adding unit tests for this new placeholder path, including a case where length < 8 triggers the underflow error to ensure robustness.
// GNSS position update (placeholder for now)

Comment on lines 1219 to 1221
lon.intval = (float)array_uint32_le(data + offset); // Longitude
coordinate_value_t lat;
lat.intval = (float)array_uint32_le(data + offset + 4); // Latitude
Copy link
Preview

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

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

Same issue here: the cast to float before storing in intval will yield incorrect floatval. Use lat.intval = array_uint32_le(data + offset + 4); or parse into floatval directly.

Suggested change
lon.intval = (float)array_uint32_le(data + offset); // Longitude
coordinate_value_t lat;
lat.intval = (float)array_uint32_le(data + offset + 4); // Latitude
lon.intval = array_uint32_le(data + offset); // Longitude
coordinate_value_t lat;
lat.intval = array_uint32_le(data + offset + 4); // Latitude

Copilot uses AI. Check for mistakes.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Michael Keller <[email protected]>
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.

1 participant