Skip to content

Commit 4d2b3ba

Browse files
committed
Add support for the i330R Console
The i330R Console is a new variant of the i330R Wrist computer. The only difference is the new model number. Reported-by: Greg McLaughlin <[email protected]>
1 parent 2932809 commit 4d2b3ba

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

src/descriptor.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ static const dc_descriptor_t g_descriptors[] = {
276276
/* Pelagic I330R */
277277
{"Apeks", "DSX", DC_FAMILY_PELAGIC_I330R, 0x4741, DC_TRANSPORT_BLE, dc_filter_oceanic},
278278
{"Aqualung", "i330R", DC_FAMILY_PELAGIC_I330R, 0x4744, DC_TRANSPORT_BLE, dc_filter_oceanic},
279+
{"Aqualung", "i330R Console", DC_FAMILY_PELAGIC_I330R, 0x474D, DC_TRANSPORT_BLE, dc_filter_oceanic},
279280
/* Mares Nemo */
280281
{"Mares", "Nemo", DC_FAMILY_MARES_NEMO, 0, DC_TRANSPORT_SERIAL, NULL},
281282
{"Mares", "Nemo Steel", DC_FAMILY_MARES_NEMO, 0, DC_TRANSPORT_SERIAL, NULL},
@@ -763,6 +764,7 @@ dc_filter_oceanic (dc_descriptor_t *descriptor, dc_transport_t transport, const
763764
0x4744, // Aqualung i330R
764765
0x4749, // Aqualung i200C
765766
0x474B, // Oceanic Geo Air
767+
0x474D, // Aqualung i330R Console
766768
};
767769

768770
if (transport == DC_TRANSPORT_BLE) {

src/oceanic_atom2_parser.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ oceanic_atom2_parser_create (dc_parser_t **out, dc_context_t *context, const uns
144144
} else if (model == I550C || model == WISDOM4 ||
145145
model == I200CV2|| model == I100V2) {
146146
parser->headersize = 5 * PAGESIZE / 2;
147-
} else if (model == I330R) {
147+
} else if (model == I330R || model == I330R_C) {
148148
parser->logbooksize = 64;
149149
parser->headersize = parser->logbooksize + 80;
150150
parser->footersize = 48;
@@ -195,6 +195,7 @@ oceanic_atom2_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim
195195

196196
switch (parser->model) {
197197
case I330R:
198+
case I330R_C:
198199
case DSX:
199200
datetime->year = p[7] + 2000;
200201
datetime->month = p[6];
@@ -391,7 +392,7 @@ oceanic_atom2_parser_cache (oceanic_atom2_parser_t *parser)
391392
} else if (parser->model == VEO20 || parser->model == VEO30 ||
392393
parser->model == OCS) {
393394
mode = (data[1] & 0x60) >> 5;
394-
} else if (parser->model == I330R) {
395+
} else if (parser->model == I330R || parser->model == I330R_C) {
395396
mode = data[2];
396397
} else if (parser->model == DSX) {
397398
mode = data[45];
@@ -452,7 +453,7 @@ oceanic_atom2_parser_cache (oceanic_atom2_parser_t *parser)
452453
} else if (parser->model == WISDOM4) {
453454
o2_offset = header + 4;
454455
ngasmixes = 1;
455-
} else if (parser->model == I330R) {
456+
} else if (parser->model == I330R || parser->model == I330R_C) {
456457
ngasmixes = 3;
457458
o2_offset = parser->logbooksize + 16;
458459
} else if (parser->model == DSX) {
@@ -477,7 +478,8 @@ oceanic_atom2_parser_cache (oceanic_atom2_parser_t *parser)
477478
if (data[o2_offset + i * o2_step]) {
478479
parser->oxygen[i] = data[o2_offset + i * o2_step];
479480
// The i330R uses 20 as "Air" and 21 as 21% Nitrox
480-
if (parser->model == I330R && parser->oxygen[i] == 20) {
481+
if ((parser->model == I330R || parser->model == I330R_C) &&
482+
parser->oxygen[i] == 20) {
481483
parser->oxygen[i] = 21;
482484
}
483485
} else {
@@ -538,13 +540,13 @@ oceanic_atom2_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, uns
538540
parser->model == F11A || parser->model == F11B ||
539541
parser->model == MUNDIAL2 || parser->model == MUNDIAL3)
540542
*((double *) value) = array_uint16_le (data + 4) / 16.0 * FEET;
541-
else if (parser->model == I330R || parser->model == DSX)
543+
else if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX)
542544
*((double *) value) = array_uint16_le (data + parser->footer + 10) / 10.0 * FEET;
543545
else
544546
*((double *) value) = (array_uint16_le (data + parser->footer + 4) & 0x0FFF) / 16.0 * FEET;
545547
break;
546548
case DC_FIELD_AVGDEPTH:
547-
if (parser->model == I330R || parser->model == DSX) {
549+
if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX) {
548550
*((double *) value) = array_uint16_le (data + parser->footer + 12) / 10.0 * FEET;
549551
} else {
550552
return DC_STATUS_UNSUPPORTED;
@@ -568,7 +570,7 @@ oceanic_atom2_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, uns
568570
water->type = DC_WATER_SALT;
569571
}
570572
water->density = 0.0;
571-
} else if (parser->model == I330R || parser->model == DSX) {
573+
} else if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX) {
572574
unsigned int settings = array_uint32_le (data + parser->logbooksize + 12);
573575
if (settings & 0x10000) {
574576
water->type = DC_WATER_FRESH;
@@ -675,7 +677,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
675677
unsigned int time = 0;
676678
unsigned int interval = 1000;
677679
if (!is_freedive (parser->mode, parser->model)) {
678-
if (parser->model == I330R || parser->model == DSX) {
680+
if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX) {
679681
interval = data[parser->logbooksize + 36] * 1000;
680682
} else {
681683
unsigned int offset = 0x17;
@@ -710,7 +712,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
710712
parser->model == I750TC || parser->model == PROPLUSX ||
711713
parser->model == I770R || parser->model == I470TC ||
712714
parser->model == SAGE || parser->model == BEACON ||
713-
parser->model == GEOAIR || parser->model == I330R) {
715+
parser->model == GEOAIR || parser->model == I330R ||
716+
parser->model == I330R_C) {
714717
samplesize = PAGESIZE;
715718
} else if (parser->model == DSX) {
716719
samplesize = 32;
@@ -729,7 +732,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
729732
parser->model == I300C || parser->model == TALIS ||
730733
parser->model == I200C || parser->model == I200CV2 ||
731734
parser->model == GEO40 || parser->model == VEO40 ||
732-
parser->model == I330R || parser->model == I100V2) {
735+
parser->model == I330R || parser->model == I330R_C ||
736+
parser->model == I100V2) {
733737
have_pressure = 0;
734738
}
735739

@@ -898,7 +902,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
898902
parser->model == I770R|| parser->model == SAGE ||
899903
parser->model == BEACON) {
900904
temperature = data[offset + 11];
901-
} else if (parser->model == I330R || parser->model == DSX) {
905+
} else if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX) {
902906
temperature = array_uint16_le(data + offset + 10);
903907
} else {
904908
unsigned int sign;
@@ -922,7 +926,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
922926
else
923927
temperature += (data[offset + 7] & 0x0C) >> 2;
924928
}
925-
if (parser->model == I330R || parser->model == DSX) {
929+
if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX) {
926930
sample.temperature = ((temperature / 10.0) - 32.0) * (5.0 / 9.0);
927931
} else {
928932
sample.temperature = (temperature - 32.0) * (5.0 / 9.0);
@@ -979,13 +983,13 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
979983
parser->model == I470TC || parser->model == I200CV2 ||
980984
parser->model == GEOAIR || parser->model == I100V2)
981985
depth = (data[offset + 4] + (data[offset + 5] << 8)) & 0x0FFF;
982-
else if (parser->model == I330R || parser->model == DSX)
986+
else if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX)
983987
depth = array_uint16_le (data + offset + 2);
984988
else if (parser->model == ATOM1)
985989
depth = data[offset + 3] * 16;
986990
else
987991
depth = (data[offset + 2] + (data[offset + 3] << 8)) & 0x0FFF;
988-
if (parser->model == I330R || parser->model == DSX) {
992+
if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX) {
989993
sample.depth = depth / 10.0 * FEET;
990994
} else {
991995
sample.depth = depth / 16.0 * FEET;
@@ -1048,7 +1052,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
10481052
decostop = (data[offset + 7] & 0xF0) >> 4;
10491053
decotime = array_uint16_le(data + offset + 6) & 0x0FFF;
10501054
have_deco = 1;
1051-
} else if (parser->model == I330R || parser->model == DSX) {
1055+
} else if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX) {
10521056
decostop = data[offset + 8];
10531057
if (decostop) {
10541058
// Deco time
@@ -1062,7 +1066,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
10621066
if (have_deco) {
10631067
if (decostop) {
10641068
sample.deco.type = DC_DECO_DECOSTOP;
1065-
if (parser->model == I330R || parser->model == DSX) {
1069+
if (parser->model == I330R || parser->model == I330R_C || parser->model == DSX) {
10661070
sample.deco.depth = decostop * FEET;
10671071
} else {
10681072
sample.deco.depth = decostop * 10 * FEET;
@@ -1101,7 +1105,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
11011105
}
11021106

11031107
// PPO2
1104-
if (parser->model == I330R) {
1108+
if (parser->model == I330R || parser->model == I330R_C) {
11051109
sample.ppo2.sensor = DC_SENSOR_NONE;
11061110
sample.ppo2.value = data[offset + 9] / 100.0;
11071111
if (callback) callback (DC_SAMPLE_PPO2, &sample, userdata);

src/oceanic_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ extern "C" {
129129
// i330r
130130
#define DSX 0x4741
131131
#define I330R 0x4744
132+
#define I330R_C 0x474D
132133

133134
#define PAGESIZE 0x10
134135
#define FPMAXSIZE 0x200

0 commit comments

Comments
 (0)