Skip to content

Commit

Permalink
HW: Add gas type reporting through tank information.
Browse files Browse the repository at this point in the history
Use tank information to report the type of gas used (open circuit /
diluent) for different gas mixes.

Signed-off-by: Michael Keller <github@ike.ch>
  • Loading branch information
mikeller committed Mar 16, 2023
1 parent d9dd30f commit c288eff
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/hw_ostc_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,27 @@ hw_ostc_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned
return DC_STATUS_UNSUPPORTED;
*((double *) value) = array_uint16_le (data + layout->avgdepth) / 100.0;
break;
case DC_FIELD_TANK_COUNT:
case DC_FIELD_GASMIX_COUNT:
*((unsigned int *) value) = parser->ngasmixes;
break;
case DC_FIELD_GASMIX:
gasmix->oxygen = parser->gasmix[flags].oxygen / 100.0;
gasmix->helium = parser->gasmix[flags].helium / 100.0;
gasmix->nitrogen = 1.0 - gasmix->oxygen - gasmix->helium;
break;
case DC_FIELD_TANK:
if (flags >= parser->ngasmixes) {
return DC_STATUS_UNSUPPORTED;
}

dc_tank_t *tank = (dc_tank_t *) value;

tank->volume = 0.0;
tank->gasmix = flags;
tank->workpressure = 0.0;
tank->type = DC_TANKINFO_METRIC | (parser->gasmix[flags].diluent ? DC_TANKINFO_CC_DILUENT : 0);

break;
case DC_FIELD_SALINITY:
if (salinity < 100 || salinity > 104)
Expand Down

0 comments on commit c288eff

Please sign in to comment.