[PATCH] CCR Import from CSV: Calculate correct nitrogen and helium gas pressures (VERSION 2)
dirk at hohndel.org
Mon Nov 3 09:22:20 PST 2014
On Mon, Nov 03, 2014 at 04:52:36PM +0200, Willem Ferguson wrote:
> diff --git a/profile.c b/profile.c
> index 4be3a5b..e97ea4c 100644
> --- a/profile.c
> +++ b/profile.c
> @@ -901,7 +901,10 @@ static void calculate_gas_information_new(struct dive *dive, struct plot_info *p
> fo2 = get_o2(&dive->cylinder[cylinderindex].gasmix);
> fhe = get_he(&dive->cylinder[cylinderindex].gasmix);
> - fill_pressures(&entry->pressures, amb_pressure, &dive->cylinder[cylinderindex].gasmix, entry->pressures.o2);
> + if ((dive->dc.dctype == CCR) && (cylinderindex <= dive->diluent_cylinder_index))
Hmm... the cylinderindex here is 0 because there are no gas changes and
that's the default. So this condition works. But I'm not sure this is the
right way to do this. Shouldn't there be a function instead that says
if (dive->dc.dctype == CCR && cylinderindex == 0)
cylinderindex = dive->diluent_cylinder_index;
and then we use cylinderindex again?
I may be nit-picking here, but I'd really like to figure out a very clean,
well documented way to deal with the CCR phase of a dive and no surprises
when we have different DCs and people switch to bailout...
e.g., imagine a diver who (for whatever reason) has O2 as cylinder 0,
bailout gas as cylinder 1 and diluent as cylinder 2.
I'm not sure this is realistic, but it would make your code rather hard to
And the one thing I have learned in the last few years of working on
Subsurface is to make as few assumptions as possible about what data we
get from a dive computer.
More information about the subsurface