[PATCH 2/2] Add initial rudimentary no-fly time calculation

Dirk Hohndel dirk at hohndel.org
Fri Feb 8 13:07:28 PST 2013


Dirk Hohndel <dirk at hohndel.org> writes:
>>
>> Or we could just add a helper function fit this, like so many other things.
>>
>>    double surface_pressure(struct dive *dive)
>>    {
>>       return (dive->dc.surface_pressure.mbar ?: SURFACE_PRESSURE) /1000.0;
>>    }
>>
>> or something very similar.
>
> Should have read all email first. This is MUCH nicer. I did something
> similar for duration so I suggest we first collect the valid readings,
> do an average of the ones that aren't 0 (I happen to have two computers
> that both give surface pressure but never agree) and only if that
> results in 0 should we return SURFACE_PRESSURE...
>
> I would just want this to return int (as we only use doubles in deco.c)
>
> I'll commit a change like this in a moment.

that moment took a while as looking carefully into this it turned up a
huge rats nest of "let's just use the first divecomputer" in our code.
I think that's what I'll tackle on the long flight back to Vancouver -
making sure we are always at least conscious if we simply take the first
dc - right now this happens in a weird mish-mash that makes me very
unhappy. I realize this won't affect a ton of people (oddly, most people
don't appear to dive with three or four dive computers - WTF?), but it
bugs me that we are mindfull in some places and mindless in others.

I just pushed the change. It is MUCH bigger than I expected and I would
appreciate people taking a close look at it.

/D


More information about the subsurface mailing list