Skip to content

DiveSystem: Handle APOS5 sample record shift on iX3M2. - #121

Open
mikeller wants to merge 1 commit into
subsurface:Subsurface-DS9from
mikeller:feat/ix3m2-apos5-0x102-profile-recovery-#42
Open

DiveSystem: Handle APOS5 sample record shift on iX3M2.#121
mikeller wants to merge 1 commit into
subsurface:Subsurface-DS9from
mikeller:feat/ix3m2-apos5-0x102-profile-recovery-#42

Conversation

@mikeller

Copy link
Copy Markdown
Member

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.

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>
Copilot AI lite review requested due to automatic review settings August 24, 2026 03:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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) {
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.

2 participants