Prepare for PSCR calculations

Calculations for passive semi-closed rebreathers are pretty much like OC
except the pO2 is lower bey a certain (SAC dependent) factor. This patch
introduces the corresponding calculations in case dctype == PSCR which is
so far never set and there is currently no UI for these calculations. As
pO2 is SAC dependent it takes a certain attempt at getting it and drops to
defaults from the prefs otherwise.

As there is no UI at this point and I also don't have any dives, this has
not received much testing, yet, but it compiles. At least.

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-10-24 16:40:21 +02:00 committed by Dirk Hohndel
parent f31d34adfd
commit 06ddfc0122
8 changed files with 29 additions and 19 deletions

7
dive.c
View file

@ -1549,8 +1549,13 @@ int gasmix_distance(const struct gasmix *a, const struct gasmix *b)
* *mix = structure containing cylinder gas mixture information.
* This function called by: calculate_gas_information_new() in profile.c; add_segment() in deco.c.
*/
extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2)
extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum dive_comp_type dctype, int sac)
{
if (!sac) {
/* The SAC has not yet been computer, so use the default *
* We might try harder... */
sac = prefs.bottomsac;
}
if (po2) { // This is probably a CCR dive where pressures->o2 is defined
if (po2 >= amb_pressure) {
pressures->o2 = amb_pressure;