Skip to content

Commit 36fcdfb

Browse files
committed
Fixed saturation current depth
1 parent c406743 commit 36fcdfb

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

projects/scuba-physics/src/lib/AlgorithmContext.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,12 @@ export class AlgorithmContext {
136136
return newGas;
137137
}
138138

139-
public addSaturation(): void {
139+
public addSaturation(currentDepth: number): void {
140140
if (!FeatureFlags.Instance.collectSaturation) {
141141
return;
142142
}
143143

144-
// TODO Fix current depth at the moment, not the currentDepth at end of last segment
145-
const ambientPressure = this.depthConverter.toBar(this.currentDepth);
144+
const ambientPressure = this.depthConverter.toBar(currentDepth);
146145
const currentOverPressures = this.tissues.saturationRatio(ambientPressure, this.depthConverter.surfacePressure, 1);
147146
this.saturationRatios.push(currentOverPressures);
148147
}

projects/scuba-physics/src/lib/BuhlmannAlgorithm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ export class BuhlmannAlgorithm {
342342
context.tissues.load(loadSegment, segment.gas);
343343
context.runTime += segment.duration;
344344
context.addCeiling();
345-
context.addSaturation();
345+
context.addSaturation(segment.averageDepth);
346346
}
347347

348348
/**

0 commit comments

Comments
 (0)