Skip to content

Commit 07cf8df

Browse files
jefdriesenmikeller
authored andcommitted
Parse the new higher type bits
Since APOS5 firmware 5.2.11, the higher bits store new tank related information: - An extra 9th bit for the tank pressure data to support high pressure (300 bar) tanks without reduced resolution. The new firmware no longer sets the legacy 300 bar bit. - The transmitter RF channel. Currently unused because the transmitter index is still present to identify the active tank and is also available with older firmware versions.
1 parent 9df5e29 commit 07cf8df

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/divesystem_idive_parser.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060

6161
#define REC_INFO 1
6262

63+
#define TANK_VALID 0x8000
64+
#define TANK_RFCHANNEL 0x001F
65+
#define TANK_PRESSURE_MSB 0x0020
66+
6367
typedef struct divesystem_idive_parser_t divesystem_idive_parser_t;
6468

6569
typedef struct divesystem_idive_gasmix_t {
@@ -579,6 +583,14 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
579583
unsigned int id = data[offset + 47] & 0x0F;
580584
unsigned int flags = data[offset + 47] & 0xF0;
581585
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+
}
582594

583595
if (flags & 0x20) {
584596
// 300 bar transmitter.

0 commit comments

Comments
 (0)