mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Correctly calculate OTUs when pO2 is recorded in the samples
This will normally happen for CCR dives with a set pO2. The old calculations was only valid for OC dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
75f6159a04
commit
eb3e879030
1 changed files with 8 additions and 4 deletions
12
divelist.c
12
divelist.c
|
@ -724,10 +724,14 @@ static int calculate_otu(struct dive *dive, struct divecomputer *dc)
|
|||
struct sample *sample = dc->sample + i;
|
||||
struct sample *psample = sample - 1;
|
||||
t = sample->time.seconds - psample->time.seconds;
|
||||
int o2 = dive->cylinder[sample->cylinderindex].gasmix.o2.permille;
|
||||
if (!o2)
|
||||
o2 = AIR_PERMILLE;
|
||||
po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive) / 1000.0;
|
||||
if (sample->po2) {
|
||||
po2 = sample->po2;
|
||||
} else {
|
||||
int o2 = dive->cylinder[sample->cylinderindex].gasmix.o2.permille;
|
||||
if (!o2)
|
||||
o2 = AIR_PERMILLE;
|
||||
po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive) / 1000.0;
|
||||
}
|
||||
if (po2 >= 0.5)
|
||||
otu += pow(po2 - 0.5, 0.83) * t / 30.0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue