DiveSystem: Handle APOS5 sample record shift on iX3M2. - #121
Open
mikeller wants to merge 1 commit into
Open
Conversation
APOS5 firmware on the iX3M2 (model range 0x60-0xFFF) inserts one extra byte at record offset 0x0E, shifting the record-type marker from offset+52 to offset+53. Read both positions so that these records are correctly identified as profile samples. Time and depth fields are unaffected by the insertion; ancillary fields past offset 0x0E are not decoded yet, pending a full libdivecomputer-level log to confirm the new layout. Signed-off-by: Michael Keller <github@ike.ch>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the DiveSystem iDive parser to recognize APOS5 iX3M2 records with a shifted record-type marker.
Changes:
- Adds shifted APOS5 marker detection.
- Skips APOS4 tank and bearing decoding for shifted records.
- Adds iX3M2 compatibility handling.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+625
to
+628
| // AI-generated (Claude) | ||
| // Ancillary fields (tank, bearing) use APOS4 offsets which are shifted | ||
| // for iX3M2 APOS5 records; skip them until the new layout is confirmed. | ||
| if (samplesize == SZ_SAMPLE_IX3M_APOS4 && !shifted_apos5) { |
Comment on lines
+486
to
+489
| if (firmware_major >= 5 && ISIX3M2(parser->model) && | ||
| type != REC_SAMPLE && | ||
| offset + 53 + 1 <= size && | ||
| array_uint16_le(data + offset + 53) == REC_SAMPLE_APOS5_IX3M2) { |
6 tasks
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.
APOS5 firmware on the iX3M2 (model range 0x60-0xFFF) inserts one
extra byte at record offset 0x0E, shifting the record-type marker
from offset+52 to offset+53. Read both positions so that these
records are correctly identified as profile samples.
Time and depth fields are unaffected by the insertion; ancillary
fields past offset 0x0E are not decoded yet, pending a full
libdivecomputer-level log to confirm the new layout.