Convert the internal tank id to an index.

The internal Uwatec tank id should be converted to the libdivecomputer
tank index. If there is no corresponding tank, the tank pressure samples
are dropped for the following reasons:

Some models appear to record an absolute tank pressure sample, even if
there is no pressure sensor attached to the corresponding tank. In this
case only the tank index changes. The sample value simply retains the
last pressure of the previous tank. Since we don't have any real
pressure data, dropping those samples is fine.
This commit is contained in:
Jef Driesen 2015-10-20 20:30:37 +01:00
parent a21f60e0bc
commit 6f89e445e3

View File

@ -1146,9 +1146,12 @@ uwatec_smart_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
}
if (have_pressure) {
sample.pressure.tank = tank;
sample.pressure.value = pressure;
if (callback) callback (DC_SAMPLE_PRESSURE, sample, userdata);
idx = uwatec_smart_find_tank(parser, tank);
if (idx < parser->ntanks) {
sample.pressure.tank = idx;
sample.pressure.value = pressure;
if (callback) callback (DC_SAMPLE_PRESSURE, sample, userdata);
}
}
if (have_heartrate) {