Skip to content

Commit 8b36597

Browse files
committed
Add support for the Cressi Leonardo 2.0
The Cressi Leonardo 2.0 switched from the older 'leonardo' protocol to the newer 'goa' protocol. At the same time, the device firmware also uses a new V5 variant of the data format. Some of the other models, like the Donatello, also received a firmware update which uses this new V5 data format.
1 parent ec03933 commit 8b36597

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/cressi_goa.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ cressi_goa_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, v
548548
version = 3;
549549
} else if (firmware >= 200 && firmware <= 205) {
550550
version = 4;
551+
} else if (firmware >= 300) {
552+
version = 5;
551553
} else {
552554
ERROR (abstract->context, "Unknown firmware version (%u).", firmware);
553555
status = DC_STATUS_DATAFORMAT;

src/cressi_goa_parser.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#define FREEDIVE_ADV 5
4141

4242
#define NGASMIXES 3
43-
#define NVERSIONS 5
43+
#define NVERSIONS 6
4444
#define NDIVEMODES 6
4545

4646
#define UNDEFINED 0xFFFFFFFF
@@ -136,6 +136,19 @@ static const cressi_goa_layout_t scuba_nitrox_layout_v4 = {
136136
70, /* temperature */
137137
};
138138

139+
static const cressi_goa_layout_t scuba_nitrox_layout_v5 = {
140+
83, /* headersize */
141+
2, /* nsamples */
142+
UNDEFINED, /* samplerate */
143+
4, /* datetime */
144+
11, /* divetime */
145+
{ 17, 19, 21 }, /* gasmix */
146+
23, /* atmospheric */
147+
66, /* maxdepth */
148+
68, /* avgdepth */
149+
70, /* temperature */
150+
};
151+
139152
static const cressi_goa_layout_t freedive_layout_v0 = {
140153
34, /* headersize */
141154
10, /* nsamples */
@@ -268,6 +281,14 @@ static const cressi_goa_layout_t * const layouts[NVERSIONS][NDIVEMODES] = {
268281
NULL, /* UNUSED */
269282
&advanced_freedive_layout_v4, /* FREEDIVE_ADV */
270283
},
284+
{
285+
&scuba_nitrox_layout_v5, /* SCUBA */
286+
&scuba_nitrox_layout_v5, /* NITROX */
287+
&freedive_layout_v4, /* FREEDIVE */
288+
&gauge_layout_v4, /* GAUGE */
289+
NULL, /* UNUSED */
290+
NULL, /* FREEDIVE_ADV */
291+
},
271292
};
272293

273294
static dc_status_t
@@ -313,6 +334,8 @@ cressi_goa_init(cressi_goa_parser_t *parser)
313334
version = 3;
314335
} else if (firmware >= 200 && firmware <= 205) {
315336
version = 4;
337+
} else if (firmware >= 300) {
338+
version = 5;
316339
} else {
317340
ERROR (abstract->context, "Unknown firmware version (%u).", firmware);
318341
return DC_STATUS_DATAFORMAT;

src/descriptor.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ static const dc_descriptor_t g_descriptors[] = {
343343
/* Cressi Goa */
344344
{"Cressi", "Cartesio", DC_FAMILY_CRESSI_GOA, 1, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_cressi},
345345
{"Cressi", "Goa", DC_FAMILY_CRESSI_GOA, 2, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_cressi},
346+
{"Cressi", "Leonardo 2.0", DC_FAMILY_CRESSI_GOA, 3, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_cressi},
346347
{"Cressi", "Donatello", DC_FAMILY_CRESSI_GOA, 4, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_cressi},
347348
{"Cressi", "Michelangelo", DC_FAMILY_CRESSI_GOA, 5, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_cressi},
348349
{"Cressi", "Neon", DC_FAMILY_CRESSI_GOA, 9, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_cressi},
@@ -911,6 +912,7 @@ dc_filter_cressi (dc_descriptor_t *descriptor, dc_transport_t transport, const v
911912
static const unsigned int model[] = {
912913
1, // Cartesio
913914
2, // Goa
915+
3, // Leonardo 2.0
914916
4, // Donatello
915917
5, // Michelangelo
916918
9, // Neon

0 commit comments

Comments
 (0)