Skip to content

Commit

Permalink
Fixed saturation current depth
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkapok committed Dec 7, 2024
1 parent c406743 commit 36fcdfb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions projects/scuba-physics/src/lib/AlgorithmContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,12 @@ export class AlgorithmContext {
return newGas;
}

public addSaturation(): void {
public addSaturation(currentDepth: number): void {
if (!FeatureFlags.Instance.collectSaturation) {
return;
}

// TODO Fix current depth at the moment, not the currentDepth at end of last segment
const ambientPressure = this.depthConverter.toBar(this.currentDepth);
const ambientPressure = this.depthConverter.toBar(currentDepth);
const currentOverPressures = this.tissues.saturationRatio(ambientPressure, this.depthConverter.surfacePressure, 1);
this.saturationRatios.push(currentOverPressures);
}
Expand Down
2 changes: 1 addition & 1 deletion projects/scuba-physics/src/lib/BuhlmannAlgorithm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export class BuhlmannAlgorithm {
context.tissues.load(loadSegment, segment.gas);
context.runTime += segment.duration;
context.addCeiling();
context.addSaturation();
context.addSaturation(segment.averageDepth);
}

/**
Expand Down

0 comments on commit 36fcdfb

Please sign in to comment.