Skip to content

Commit

Permalink
Added base settings for diver stress rmv
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkapok committed Aug 2, 2024
1 parent aef3714 commit 6fedb27
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions doc/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Following list of features and improvements ordered by priority is under develop
* Extend application settings:
* Define custom maximum gas density
* Custom diver stress sac rate ratio
* Add to general settings
* Add to dive settings
* Apply to gas algorithm
* Visualize on consumption chart
* Add minimum gas reserve for first tank and for stage
* Add option to ignore some warnings (ICD, density)
* Fix PWA issues https://www.pwabuilder.com/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class AppSettingsComponent implements OnInit {
}

const imperialUnits = Boolean(this.settingsForm.controls.imperialUnits.value);
// TODO get rid of diver component with settings specific to dive.
this.selectedOptions.applyDiver(this.diver);
this.units.imperialUnits = imperialUnits;
this.settingsNormalization.apply();
Expand Down
8 changes: 4 additions & 4 deletions projects/planner/src/app/diver/diver.component.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<div class="mt-3 row">
<ng-container [formGroup]="diverForm">
<div class="pt-2 mt-2 mb-4 col col-12 col-md-4">
<div class="pt-2 mt-2 mb-4 col col-12 col-md-6">
<label for="sac" class="form-label" mdbLabel>RMV [{{units.rmv}}]:</label>
<input class="form-control" id="sac" formControlName="rmv" type="number" (input)="inputChanged()"
[min]="ranges.diverRmv[0]" [max]="ranges.diverRmv[1]" [step]="rmvStep"
[class.is-invalid]="rmvInvalid" />
<div class="invalid-feedback position-absolute">Needs to be number {{ranges.diverRmvLabel}}</div>
</div>
<div class="pt-2 mt-2 mb-4 col col-12 col-md-4">
<div class="pt-2 mt-2 mb-4 col col-12 col-md-6">
<label for="stressRmv" class="form-label" mdbLabel>Stress RMV [{{units.rmv}}]:</label>
<input class="form-control" id="stressRmv" formControlName="stressRmv" type="number" (input)="inputChanged()"
[min]="ranges.diverRmv[0]" [max]="ranges.diverRmv[1]" [step]="rmvStep"
[class.is-invalid]="stressRmvInvalid" />
<div class="invalid-feedback position-absolute">Needs to be number {{ranges.diverRmvLabel}}</div>
</div>
<div class="pt-2 mt-2 mb-4 col col-12 col-md-4">
<div class="pt-2 mt-2 mb-4 col col-12 col-md-6">
<app-pp-o2 [maxPpO2]="diver.maxPpO2" (ppO2Change)="maxPpO2Changed($event)" label="Maximum ppO2:"
[pO2Form]="diverForm" controlName="maxPO2"></app-pp-o2>
</div>
<div class="pt-2 mt-2 mb-4 col col-12 col-md-4">
<div class="pt-2 mt-2 mb-4 col col-12 col-md-6">
<app-pp-o2 [maxPpO2]="diver.maxDecoPpO2" (ppO2Change)="maxDecoPpO2Changed($event)"
label="Maximum deco ppO2:" [pO2Form]="diverForm" controlName="maxDecoPO2"></app-pp-o2>
</div>
Expand Down
2 changes: 1 addition & 1 deletion projects/planner/src/app/shared/preferencesStore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('PreferencesStore', () => {
diver.maxDecoPpO2 = 1.5;
sut.save();

diver.rmv = 10;
diver.rmv = 10; // TODO test sressRmv
diver.maxPpO2 = 1.3;
diver.maxDecoPpO2 = 1.4;
sut.load();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class SettingsNormalizationService {
const rmvRounding = this.units.ranges.rmvRounding;
options.diverOptions.rmv = this.fitUnit(v => this.units.fromLiter(v), v => this.units.toLiter(v),
oDiver.rmv, this.units.ranges.diverRmv, rmvRounding);

// TODO stressRmv
this.applyOptionsCalculationValues(options);
this.normalizeOptions(options);
}
Expand Down
1 change: 1 addition & 0 deletions projects/scuba-physics/src/lib/Diver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ export class Diver {

public loadFrom(other: Diver): void {
this.rmv = other.rmv;
this.stressRmv = other.stressRmv;
}
}

0 comments on commit 6fedb27

Please sign in to comment.