Skip to content

Dive-computer downloads label every imported cylinder "Back Gas" #463

Description

@john120283

Problem

When dives are downloaded from a dive computer, every cylinder is written with the role Back Gas, regardless of the gas it holds. A 99% O₂ deco bottle, a CCR oxygen supply, or a diluent all import as "Back Gas", so the dive log misrepresents the gas plan and the user has to relabel every non-back-gas cylinder by hand.

Cause

The download write paths hardcode the cylinder role to backGas — there is no inference from the dive computer's own tank metadata or from the gas mix.

Proposed fix

Infer the cylinder role on download:

  • Use libdivecomputer's native tank usage (dc_usage_t) when the computer provides it: OXYGEN → oxygenSupply, DILUENT → diluent.
  • Otherwise fall back to an open-circuit gas heuristic: a nitrox mix of O₂ ≥ 41% → deco, everything else → back gas.
  • Never overwrite a role the user has already set (reparse should only infer for newly created cylinders).

Follow-up to #424 (multi-gas dive-computer download support).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for Feature.

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions