diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-08-06 10:16:12 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-13 21:11:07 -0600 |
commit | ecf0408aae4024f70a3c9689d1de394a2f47a0ff (patch) | |
tree | 94b1f74c5d7f24f7e0ee7582101811014c11d1d9 /dive.c | |
parent | d453d5cb37dcec5341c9ef8e6063665dc5b629b8 (diff) | |
download | subsurface-ecf0408aae4024f70a3c9689d1de394a2f47a0ff.tar.gz |
Make SAC values in planner settings respect unit settings
So far, the fields for the two SAC rates did not show a unit and were implictly l/min.
Now they respect the settings for volume units. This was harder than I thought for two reasons:
1) Imperial units for SAC are cuft/min but a typical value would be .70. So I made the point
the field prefix and what is entered is actually hundreth of cuft per minute.
2) I had to get the rounding right in order not to get effects like 20l/min become .70 cuft/min (19800 ml/min
internally) which would then become 19l/min when switching back.
While being at it, I gave the gradient factors '%'-signs as units.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -188,6 +188,17 @@ double get_volume_units(unsigned int ml, int *frac, const char **units) return vol; } +int units_to_sac(int volume) +{ + if(get_units()->volume == CUFT) + if (volume < 10) + return cuft_to_l(volume) * 100; + else + return cuft_to_l(volume) * 10; + else + return volume * 1000; +} + unsigned int units_to_depth(double depth) { if (get_units()->length == METERS) |