Fix the gas switches for Galileo Trimix.
The Galileo Trimix supports up to 10 tanks and gas mixes. However, the existing alarm based gas switch events have only 2 bits available, and can support at most 4 gas mixes. Therefore, the trimix variant stores another 4 bit value in the second alarm byte. For the first three gas mixes (and possibly also the fourth), both alarm bytes appear to be always set to the same value. For the higher mixes, the value in the first alarm byte is always zero. This doesn't cause any problems, because in the data stream the second alarm byte is stored after the first one, and our final value is always the last one. The non-trimix variant also has the second alarm byte, but the gas mix bits appear to be always zero. In order to avoid taking this zero as the final value, a separate table is used for the trimix variant.
This commit is contained in:
parent
52453f080d
commit
3fa606a8a2
@ -374,6 +374,12 @@ uwatec_smart_event_info_t uwatec_smart_galileo_events_2[] = {
|
||||
{EV_UNKNOWN, 0xFF, 0},
|
||||
};
|
||||
|
||||
static const
|
||||
uwatec_smart_event_info_t uwatec_smart_trimix_events_2[] = {
|
||||
{EV_UNKNOWN, 0x0F, 0},
|
||||
{EV_GASMIX, 0xF0, 4},
|
||||
};
|
||||
|
||||
static unsigned int
|
||||
uwatec_smart_find_gasmix (uwatec_smart_parser_t *parser, unsigned int id)
|
||||
{
|
||||
@ -419,6 +425,14 @@ uwatec_smart_parser_cache (uwatec_smart_parser_t *parser)
|
||||
if (data[43] & 0x80) {
|
||||
trimix = 1;
|
||||
}
|
||||
|
||||
if (trimix) {
|
||||
parser->events[2] = uwatec_smart_trimix_events_2;
|
||||
parser->nevents[2] = C_ARRAY_SIZE (uwatec_smart_trimix_events_2);
|
||||
} else {
|
||||
parser->events[2] = uwatec_smart_galileo_events_2;
|
||||
parser->nevents[2] = C_ARRAY_SIZE (uwatec_smart_galileo_events_2);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the gas mixes and tanks.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user