Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions src/divesystem_idive_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@
#define IX3M2_ZHL16C 2
#define IX3M2_VPM 3

#define REC_SAMPLE 0
#define REC_INFO 1
#define REC_SAMPLE_APOS5_COMPAT 0x8006

#define TANK_VALID 0x8000
#define TANK_RFCHANNEL 0x001F
#define TANK_PRESSURE_MSB 0x0020

typedef struct divesystem_idive_parser_t divesystem_idive_parser_t;

Expand Down Expand Up @@ -450,19 +452,12 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
// Get the record type.
unsigned int type = ISIX3M(parser->model) ?
array_uint16_le (data + offset + 52) :
REC_SAMPLE;
// AI-generated (Claude)
// APOS5 uses 0x8006 for ordinary profile samples. Keep this alias
// narrow until the record type is confirmed by the vendor.
if (firmware_major >= 5 && type == REC_SAMPLE_APOS5_COMPAT)
type = REC_SAMPLE;
if (type != REC_SAMPLE) {
if (type == REC_INFO) {
altitude = (signed int) array_uint32_le (data + offset + 40);
longitude = (signed int) array_uint32_le (data + offset + 44);
latitude = (signed int) array_uint32_le (data + offset + 48);
have_location = 1;
}
0;
if (type == REC_INFO) {
altitude = (signed int) array_uint32_le (data + offset + 40);
longitude = (signed int) array_uint32_le (data + offset + 44);
latitude = (signed int) array_uint32_le (data + offset + 48);
have_location = 1;

// Skip non-sample records.
offset += samplesize;
Expand Down Expand Up @@ -588,6 +583,14 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
unsigned int id = data[offset + 47] & 0x0F;
unsigned int flags = data[offset + 47] & 0xF0;
unsigned int pressure = data[offset + 49];
unsigned int DC_ATTR_UNUSED rfchannel = 0;

if (type & TANK_VALID) {
rfchannel = type & TANK_RFCHANNEL;
if (type & TANK_PRESSURE_MSB) {
pressure |= 0x100;
}
}
Comment on lines 585 to +593

if (flags & 0x20) {
// 300 bar transmitter.
Expand Down