Heinrichs Weikamp: Add Placeholder for GPS Coordinates on OSTC5#87
Open
mikeller wants to merge 2 commits intosubsurface:Subsurface-DS9from
Open
Heinrichs Weikamp: Add Placeholder for GPS Coordinates on OSTC5#87mikeller wants to merge 2 commits intosubsurface:Subsurface-DS9from
mikeller wants to merge 2 commits intosubsurface:Subsurface-DS9from
Conversation
Contributor
There was a problem hiding this comment.
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_tunion for interpreting raw bits asunsigned intorfloat - 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 < 8triggers the underflow error to ensure robustness.
// GNSS position update (placeholder for now)
src/hw_ostc_parser.c
Outdated
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 |
There was a problem hiding this comment.
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 |
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 <github@ike.ch>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Michael Keller <github@ike.ch>
c6bc43e to
edb8572
Compare
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.
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 github@ike.ch