Subsurface deco calculations

Jef Driesen jef at libdivecomputer.org
Sat Feb 4 14:44:29 PST 2017


On 04-02-17 19:31, Linus Torvalds wrote:
> But quite aside from the incompatibility, the big change was that
> upstream libdivecomputer got rid of the deprecated events entirely,
> and we now use the DC_SAMPLE_GASMIX sample data instead.
>
> And the DC_SAMPLE_GASMIX data has obviously never been tested before.
> In particular, the 'gasmix' data is *supposed to be zero-based (ie in
> the range 0..ngasmixes-1), but I could easily see that some
> libdivecomputer backend would end up using a 1-based index (ie
> 1..ngasmixes).

The gas mix index is indeed *always* zero based. Anything else is a bug. In 
which backend did you find a 1-based index?

> Before, we just got the gas mix itself, not the cylinder number, and
> we then figured it out from that. That sucked in other ways (ie
> multiple cylinders with the same gas were ambiguous), but it was less
> likely to have _this_ particular problem.

If you retrieve the gasmix percentages by calling the dc_parser_get_field() 
function with the DC_FIELD_GASMIX type and the index obtained from 
DC_SAMPLE_GASMIX, then you'll get exactly the same as with the old events. 
That's something I tested extensively (e.g. verified using all dive computer 
data I have available) before making that change.

Jef


More information about the subsurface mailing list