Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ace-DS9

Merge Jef's upstream fix for the OSTC4 CCR gas parsing issue reported by
Michael Keller.

This also effectively obviates (and undoes) the revert I did in commit
8d3271e.

* https://github.com/libdivecomputer/libdivecomputer:
  Fix the OSTC4 diluent changes
  • Loading branch information
torvalds committed Mar 16, 2023
2 parents 8d3271e + 2ba9904 commit 543bd58
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/hw_ostc_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1049,8 +1049,12 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
return DC_STATUS_DATAFORMAT;
}
unsigned int idx = data[offset];
if (idx < 1 || idx > parser->ngasmixes) {
ERROR(abstract->context, "Invalid gas mix.");
if (parser->model == OSTC4 && ccr && idx > parser->nfixed) {
// Fix the OSTC4 diluent index.
idx -= parser->nfixed;
}
if (idx < 1 || idx > parser->nfixed) {
ERROR(abstract->context, "Invalid gas mix (%u).", idx);
return DC_STATUS_DATAFORMAT;
}
idx--; /* Convert to a zero based index. */
Expand Down

0 comments on commit 543bd58

Please sign in to comment.