Recmode: Allow the user to specify gas reserve.

Since most regulators have an intermediate pressure of 10bar
the minimum value is 10 while the max is 99.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Joakim Bygdell 2015-04-09 17:41:41 +02:00 committed by Dirk Hohndel
parent 695637dcff
commit afea30fd8a
6 changed files with 49 additions and 13 deletions

View file

@ -17,8 +17,6 @@
#define TIMESTEP 3 /* second */
#define DECOTIMESTEP 60 /* seconds. Unit of deco stop times */
#define RESERVE 40000 /* Remaining gas in recreational mode */
int decostoplevels[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000, 27000,
30000, 33000, 36000, 39000, 42000, 45000, 48000, 51000, 54000, 57000,
60000, 63000, 66000, 69000, 72000, 75000, 78000, 81000, 84000, 87000,
@ -845,13 +843,12 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time
bool enough_gas(int current_cylinder)
{
cylinder_t *cyl;
cyl = &displayed_dive.cylinder[current_cylinder];
if (!cyl->start.mbar)
return true;
if (cyl->type.size.mliter)
return (float) (cyl->end.mbar - RESERVE) * cyl->type.size.mliter / 1000.0 > (float) cyl->deco_gas_used.mliter;
return (float) (cyl->end.mbar - prefs.reserve_gas) * cyl->type.size.mliter / 1000.0 > (float) cyl->deco_gas_used.mliter;
else
return true;
}