Skip to content

Commit a661254

Browse files
authored
Merge pull request #119 from mikeller/feat/ratio-8006-import-#14
DiveSystem: Handle APOS5 sample record alias.
2 parents ffb7cab + 624b86e commit a661254

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/divesystem_idive_parser.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
#define REC_SAMPLE 0
6262
#define REC_INFO 1
63+
#define REC_SAMPLE_APOS5_COMPAT 0x8006
6364

6465
typedef struct divesystem_idive_parser_t divesystem_idive_parser_t;
6566

@@ -431,13 +432,15 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
431432
unsigned int have_bearing = 0;
432433

433434
unsigned int firmware = 0;
435+
unsigned int firmware_major = 0;
434436
unsigned int apos4 = 0;
435437
unsigned int nsamples = array_uint16_le (data + 1);
436438
unsigned int samplesize = SZ_SAMPLE_IDIVE;
437439
if (ISIX3M(parser->model)) {
438440
// Detect the APOS4 firmware.
439441
firmware = array_uint32_le(data + 0x2A);
440-
apos4 = (firmware / 10000000) >= 4;
442+
firmware_major = firmware / 10000000;
443+
apos4 = firmware_major >= 4;
441444
if (apos4) {
442445
// Dive downloaded and recorded with the APOS4 firmware.
443446
samplesize = SZ_SAMPLE_IX3M_APOS4;
@@ -464,6 +467,11 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
464467
unsigned int type = ISIX3M(parser->model) ?
465468
array_uint16_le (data + offset + 52) :
466469
REC_SAMPLE;
470+
// AI-generated (Claude)
471+
// APOS5 uses 0x8006 for ordinary profile samples. Keep this alias
472+
// narrow until the record type is confirmed by the vendor.
473+
if (firmware_major >= 5 && type == REC_SAMPLE_APOS5_COMPAT)
474+
type = REC_SAMPLE;
467475
if (type != REC_SAMPLE) {
468476
if (type == REC_INFO) {
469477
if (!have_location) {

0 commit comments

Comments
 (0)