HW OSTC3/4: Mark Inactive Gases as Such.

Return `DC_STATUS_UNSUPPORTED` for inactive gas mixes, while retaining
the configured gas information. This makes it possible to mark inactive
gases as such, or completely hide them, without affecting the gas
indices that are referenced in gas switches.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2023-07-09 14:46:44 +12:00
parent 3733b87ac9
commit 1222041b46

View File

@ -578,12 +578,21 @@ hw_ostc_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned
*((unsigned int *) value) = parser->ngasmixes;
break;
case DC_FIELD_GASMIX:
if (flags >= parser->ngasmixes) {
return DC_STATUS_UNSUPPORTED;
}
gasmix->oxygen = parser->gasmix[flags].oxygen / 100.0;
gasmix->helium = parser->gasmix[flags].helium / 100.0;
gasmix->nitrogen = 1.0 - gasmix->oxygen - gasmix->helium;
if (!parser->gasmix[flags].enabled) {
// Indicate that this gasmix is not active
return DC_STATUS_UNSUPPORTED;
}
break;
case DC_FIELD_TANK:
if (flags >= parser->ngasmixes) {
if (flags >= parser->ngasmixes || !parser->gasmix[flags].enabled) {
return DC_STATUS_UNSUPPORTED;
}