Only use default cylinder for first one

When downloading from a divecomputer it makes little sense to assume that
all tanks are the default cylinder.

There's a good case to be made for having a default first cylinder (you
always dive with your own cylinder, or you are always on a dive boat with
AL80 tanks), but in multi-cylinder situations this is much more likely to
cause unintended harm; for example for those dive computers that always
report their maximum number of cylinders, even if some of them aren't
used.  Here setting a default cylinder turns those entries from obviously
empty into something that appears to have meaning (i.e., cylinder type is
filled in) even though this was just a default added by Subsurface.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-03-15 13:13:01 -07:00
parent 6ba140571e
commit d681bdcb63

View file

@ -124,7 +124,9 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
dive->cylinder[i].gasmix.o2.permille = o2;
dive->cylinder[i].gasmix.he.permille = he;
if (!get_tanksize(devdata, data, dive->cylinder, i))
/* for the first tank, if there is no tanksize available from the
* dive computer, fill in the default tank information (if set) */
if (i == 0 && !get_tanksize(devdata, data, dive->cylinder, i))
fill_default_cylinder(&dive->cylinder[i]);
}
return DC_STATUS_SUCCESS;