Ignore invalid gas mixes
The Cressi Michelangelo appears to store inactive gas mixes as a zero oxygen percentage. Such invalid values shouldn't be reported.
This commit is contained in:
parent
0064097c03
commit
d0c7562c41
@ -43,6 +43,8 @@
|
||||
#define FREEDIVE 2
|
||||
#define GAUGE 3
|
||||
|
||||
#define NGASMIXES 2
|
||||
|
||||
typedef struct cressi_goa_parser_t cressi_goa_parser_t;
|
||||
|
||||
struct cressi_goa_parser_t {
|
||||
@ -174,6 +176,15 @@ cressi_goa_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsign
|
||||
parser->maxdepth = statistics.maxdepth;
|
||||
}
|
||||
|
||||
unsigned int ngasmixes = 0;
|
||||
if (divemode == SCUBA || divemode == NITROX) {
|
||||
for (unsigned int i = 0; i < NGASMIXES; ++i) {
|
||||
if (data[0x20 + 2 * i] == 0)
|
||||
break;
|
||||
ngasmixes++;
|
||||
}
|
||||
}
|
||||
|
||||
dc_gasmix_t *gasmix = (dc_gasmix_t *) value;
|
||||
|
||||
if (value) {
|
||||
@ -185,7 +196,7 @@ cressi_goa_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsign
|
||||
*((double *) value) = parser->maxdepth;
|
||||
break;
|
||||
case DC_FIELD_GASMIX_COUNT:
|
||||
*((unsigned int *) value) = divemode == SCUBA || divemode == NITROX ? 2 : 0;
|
||||
*((unsigned int *) value) = ngasmixes;
|
||||
break;
|
||||
case DC_FIELD_GASMIX:
|
||||
gasmix->helium = 0.0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user