Fix cylinder printout information

Linus Torvalds torvalds at linux-foundation.org
Thu Jan 3 12:40:25 PST 2013


The cylinder information in the printouts was wrong in many ways. As
Dirk noted, it didn't work at all for air-integrated computers that
had the pressures in the samples, but the math was also confusing and
wrong.

This should fix it.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
This also fixes things so that in the absence of cylinder size
information, it prints the pressure difference, not just zero.

Also I have no idea how metric people want to get the air usage. Anybody?

The choices are:

 - wet size, the same way as  (which would require working pressure of
the cylinder in order to calculate), ie if you have a 12l cylinder, it
would say "8l" if you used two-thirds of the gas.

 - "air volume at one ATM" (the same way imperial people show cylinder
information)

I'm assuming the latter, because that seemed to be what Salvador was
approximating (except he turned the pressure difference into bar, not
ATM). Also, metric cylinders don't necessarily have a saved working
pressure, so..

On Wed, Jan 2, 2013 at 1:22 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> That's not the only case where it incorrectly uses start.mbar.
>
> print_tanks() itself also does
>
>   cyl_press= get_pressure_units(dive->cylinder[n].start.mbar, &unit_press);
>
> and it should do something like
>
>     unsigned int start = dive->cylinder[n].start.mbar ? :
> dive->cylinder[n].sample_start.mbar;
>
> instead (same for ending pressure too, of course).
>
> In fact, we should probably add some nice helper function for getting
> the pressures. We have that code in both divelist.c and statistics.c..
>
>                Linus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 3165 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130103/e4a20d8b/attachment.obj>


More information about the subsurface mailing list