messing with the gas / tank handling

Linus Torvalds torvalds at
Tue Oct 28 14:58:50 PDT 2014

On Tue, Oct 28, 2014 at 2:13 PM, Dirk Hohndel <dirk at> wrote:
> Bug #742 shows that we got things pretty badly wrong for the Cobalt if the
> primary gas used on a dive (or in the case of his sample data, the only
> gas used on a dive) was not tank 0. We showed that ugly gas change, we
> showed that two gases were used during the dive, we associated the
> pressure from the samples with the wrong tank, etc.
> I just pushed out a commit that pretends to fix this. And it makes sense
> to me. But I'd really appreciate if you (or anyone else for that matter)
> would take a look and double check that this is ok.

It looks fine, but the whole "<= 30s" and "first sample" thing looks a
bit confused. Do you really need *both*?

Also, that whole

    /* if we have an explicit first cylinder */
    if (sample->sensor == 0 && first_cylinder != 0)
        sample->sensor = first_cylinder;

looks a bit iffy. I guess we're stuck with it, but my gut feel is that
it's actually an Atomic Cobalt back-end bug, and that the Cobalt
should just have reported the right sensor, rather than reporting
sensor 0.

The reason it's iffy is that another dive computer that does this
*right* might be impacted. But right now, I guess only the Cobalt has
this whole "first_cylinder" issue, so maybe worry about that
possibility later.. And quite frankly, we'll need to eventually fix
the fact that we can only have one cylinder pressure per sample, so
this code will end up needing changes in more fundamental ways
eventually. So the whole "this might break in the future" is not a
very strong objection. The code is pretty much *guaranteed* to break
in the future for other reasons anyway.


More information about the subsurface mailing list