|
58 | 58 | #define IX3M2_ZHL16C 2 |
59 | 59 | #define IX3M2_VPM 3 |
60 | 60 |
|
61 | | -#define REC_SAMPLE 0 |
62 | 61 | #define REC_INFO 1 |
63 | | -#define REC_SAMPLE_APOS5_COMPAT 0x8006 |
| 62 | + |
| 63 | +#define TANK_VALID 0x8000 |
| 64 | +#define TANK_RFCHANNEL 0x001F |
| 65 | +#define TANK_PRESSURE_MSB 0x0020 |
64 | 66 |
|
65 | 67 | typedef struct divesystem_idive_parser_t divesystem_idive_parser_t; |
66 | 68 |
|
@@ -450,19 +452,12 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba |
450 | 452 | // Get the record type. |
451 | 453 | unsigned int type = ISIX3M(parser->model) ? |
452 | 454 | array_uint16_le (data + offset + 52) : |
453 | | - REC_SAMPLE; |
454 | | - // AI-generated (Claude) |
455 | | - // APOS5 uses 0x8006 for ordinary profile samples. Keep this alias |
456 | | - // narrow until the record type is confirmed by the vendor. |
457 | | - if (firmware_major >= 5 && type == REC_SAMPLE_APOS5_COMPAT) |
458 | | - type = REC_SAMPLE; |
459 | | - if (type != REC_SAMPLE) { |
460 | | - if (type == REC_INFO) { |
461 | | - altitude = (signed int) array_uint32_le (data + offset + 40); |
462 | | - longitude = (signed int) array_uint32_le (data + offset + 44); |
463 | | - latitude = (signed int) array_uint32_le (data + offset + 48); |
464 | | - have_location = 1; |
465 | | - } |
| 455 | + 0; |
| 456 | + if (type == REC_INFO) { |
| 457 | + altitude = (signed int) array_uint32_le (data + offset + 40); |
| 458 | + longitude = (signed int) array_uint32_le (data + offset + 44); |
| 459 | + latitude = (signed int) array_uint32_le (data + offset + 48); |
| 460 | + have_location = 1; |
466 | 461 |
|
467 | 462 | // Skip non-sample records. |
468 | 463 | offset += samplesize; |
@@ -588,6 +583,14 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba |
588 | 583 | unsigned int id = data[offset + 47] & 0x0F; |
589 | 584 | unsigned int flags = data[offset + 47] & 0xF0; |
590 | 585 | unsigned int pressure = data[offset + 49]; |
| 586 | + unsigned int DC_ATTR_UNUSED rfchannel = 0; |
| 587 | + |
| 588 | + if (type & TANK_VALID) { |
| 589 | + rfchannel = type & TANK_RFCHANNEL; |
| 590 | + if (type & TANK_PRESSURE_MSB) { |
| 591 | + pressure |= 0x100; |
| 592 | + } |
| 593 | + } |
591 | 594 |
|
592 | 595 | if (flags & 0x20) { |
593 | 596 | // 300 bar transmitter. |
|
0 commit comments