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>
This commit is contained in:
Robert C. Helling 2014-08-06 10:16:12 +02:00 committed by Dirk Hohndel
parent d453d5cb37
commit ecf0408aae
4 changed files with 52 additions and 8 deletions

1
dive.h
View file

@ -99,6 +99,7 @@ extern double get_weight_units(unsigned int grams, int *frac, const char **units
extern double get_vertical_speed_units(unsigned int mms, int *frac, const char **units);
extern unsigned int units_to_depth(double depth);
extern int units_to_sac(int volume);
/* Volume in mliter of a cylinder at pressure 'p' */
extern int gas_volume(cylinder_t *cyl, pressure_t p);