Skip to content

Commit 0a9fad1

Browse files
committed
Add CCR support for the Excursion
There is a minor update to the dataformat to support CCR dives. For the current firmware, the setpoint change event was originally defined as a 4 byte event, but the new implementation changed this to only 2 bytes. Since the current firmware doesn't support CCR dives yet, the 4 bytes variant is not supposed to appear in the sample data and should be ignored.
1 parent a318971 commit 0a9fad1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/deepsix_excursion_parser.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ deepsix_excursion_parser_get_field (dc_parser_t *abstract, dc_field_type_t type,
334334
case 2:
335335
*((dc_divemode_t *) value) = DC_DIVEMODE_FREEDIVE;
336336
break;
337+
case 3:
338+
*((dc_divemode_t *) value) = DC_DIVEMODE_CCR;
339+
break;
337340
default:
338341
return DC_STATUS_DATAFORMAT;
339342
}
@@ -550,6 +553,12 @@ deepsix_excursion_parser_samples_foreach_v1 (dc_parser_t *abstract, dc_sample_ca
550553
return DC_STATUS_DATAFORMAT;
551554
}
552555
break;
556+
case EVENT_CHANGE_SETPOINT:
557+
if (event_info[i].size != 4 && event_info[i].size != 2) {
558+
ERROR(abstract->context, "Unexpected event size (%u).", event_info[i].size);
559+
return DC_STATUS_DATAFORMAT;
560+
}
561+
break;
553562
case EVENT_SAMPLES_MISSED:
554563
if (event_info[i].size != 6) {
555564
ERROR(abstract->context, "Unexpected event size (%u).", event_info[i].size);
@@ -670,6 +679,14 @@ deepsix_excursion_parser_samples_foreach_v1 (dc_parser_t *abstract, dc_sample_ca
670679
sample.gasmix = mix_idx;
671680
if (callback) callback(DC_SAMPLE_GASMIX, &sample, userdata);
672681
break;
682+
case EVENT_CHANGE_SETPOINT:
683+
// Ignore the 4 byte variant because it's not
684+
// supposed to be present in the sample data.
685+
if (event_info[i].size == 2) {
686+
sample.setpoint = data[offset + event_offset] / 10.0;
687+
if (callback) callback(DC_SAMPLE_SETPOINT, &sample, userdata);
688+
}
689+
break;
673690
case EVENT_SAMPLES_MISSED:
674691
count = array_uint16_le(data + offset + event_offset);
675692
timestamp = array_uint32_le(data + offset + event_offset + 2);

0 commit comments

Comments
 (0)