diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-01-11 09:22:41 -0800 |
---|---|---|
committer | Subsurface <dirk@subsurface-divelog.org> | 2017-01-12 14:17:09 -0800 |
commit | 638e7fb28fa48adfb4d9ecba132bbc26990b4056 (patch) | |
tree | 9370057b47fa67b8d8fa1625e1289546f0b07f1f /core/dive.c | |
parent | 6637aee114f765d6e92d2258badbfa1cf93d6885 (diff) | |
download | subsurface-638e7fb28fa48adfb4d9ecba132bbc26990b4056.tar.gz |
Add cylinder equipment tooltips with gas volume
This adds tooltips for the equipment tab for each cylinder, showing the
amount of gas used.
When you mouse over the size and working pressure fields, the tooltip will
show the amount of gas used (along with start and end gas volumes). And
when you mouse over the start and end pressures, it will show the start
and end gas volumes, and the Z factor used.
I started doing this because of the gas volume questions in the last day
or two (and a few from a few weeks ago). When even Robert Helling starts
wondering about the effects of compressibility on the SAC calculation, our
numbers are clearly too opaque.
With these tooltips, at least you can see what went into the used gas
calculations, instead of having to add debugging options to print out Z
factors.
[ This patch also adds a "rint()" to get the rounding right in the
gas_volume() function. Although rounding to the nearst milliliter
really doesn't matter, it's the right thing to do after doing FP
calculations ;^]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c index c1d5b7324..75f48e8a9 100644 --- a/core/dive.c +++ b/core/dive.c @@ -872,7 +872,7 @@ int gas_volume(cylinder_t *cyl, pressure_t p) { double bar = p.mbar / 1000.0; double z_factor = gas_compressibility_factor(&cyl->gasmix, bar); - return cyl->type.size.mliter * bar_to_atm(bar) / z_factor; + return rint(cyl->type.size.mliter * bar_to_atm(bar) / z_factor); } /* |