Garmin gas change bug and some corner cases.

Dirk Hohndel dirk at
Wed Nov 17 07:42:35 PST 2021

Hi Michael,

Can you share a FIT file with such a gas change with myself and Linus
(copied)? I've seen your PR and it looks reasonable, but I'd love to be
able to have an actual FIT file to look at :)

On Tue, 2021-11-16 at 23:34 +0100, Michael Andreen wrote:
> Garmin transmitter attached to back cylinder. Air as gas.
> Suunto transmitter attached to stage cylinder. Air as gas.
So both cylinders were air? 

> Garmin watch in single tank mode, air bottom gas with ean32 and air as backup 
> gases.
> Suunto vyper air with two mixes, both air.
> During the dive I did some gas switches, only switching between air mixes on 
> both computers.

So that's a bit challenging as parts of the code will have no concept
of which tank is which when you are switching from 'air' to 'air'.
IIRC the Suunto doesn't track tanks, it only tracks gases.
The easiest hack around that is to have one tank as air (O2=21) and one
as EAN22 - now we can tell them apart (and one percent in O2 content
makes no reasonable difference anywhere). Not perfect, but solves that

> When I did the first import from garmin I only had half the gas mixes and all 
> of them were to ean32. Looking at the fit file in an online fit explorer I saw 
> that it had the three gases as 0 (Air), 1 (EAN32) and 2 (Air) and the gas 
> switch event were between id 0 and 2. Doing the following change in 
> libdivecomputer fixed that specific issue.
> diff --git a/src/garmin_parser.c b/src/garmin_parser.c
> index 46baa63..7431547 100644
> --- a/src/garmin_parser.c
> +++ b/src/garmin_parser.c
> @@ -217,7 +217,7 @@ static void garmin_event(struct garmin_parser_t *garmin,
>                 return;
>         case 57:
> -               sample.gasmix = data - 1;
> +               sample.gasmix = data;
>                 garmin->callback(DC_SAMPLE_GASMIX, sample, garmin->userdata);
>                 return;
>         }

Again, I'd love to see the FIT file for that.

> I get a dive with two air cylinders and the transmitter pressure graph linked 
> to the first cylinder and gas switches between these two air cylinders. There 
> is a hidden EAN32 cylinder too. In general everything seems as it should.
> The suunto vyper air vyper air imported the dive and all the gas changes and 
> two air cylinders. However all gas changes are to the first cylinder and the 
> 2nd one is hidden. Skimming through the suunto d9 parser it looks like the gas 
> change event only contains o2, so not much to do about that. There likely 
> won't be that many gas switches if I have the same gas in a stage cylinder.

see the suggestion above

> However, when I try to merge the dives, the transmitter pressure for both 
> computers are linked to the first cylinder. Assuming I have the garmin as the 
> first dive computer, is there some way to change the suunto transmitter 
> pressure to apply to the 2nd cylinder? There doesn't seem to be any explicit 
> association between pressure data in a sample and a cylinder. I tried to add a 
> dummy pressure in front in the xml file, but that didn't seem to do anything.
again, the suggestion above will fix this problem as well


More information about the subsurface mailing list