Skip to content

Commit

Permalink
Correct GUE min gas (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
calmh committed Jul 22, 2023
1 parent 8a0bb86 commit 0f1ff87
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/models/cylinder_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CylinderViewModel {
]);

String get rbPressure =>
sprintf("%d", [metric! ? rockBottom!.rockBottomPressure(cylinder!).bar.roundUp(5) : rockBottom!.rockBottomPressure(cylinder!).psi.roundUp(100)]);
sprintf("%d", [metric! ? rockBottom!.rockBottomPressure(cylinder!).bar.roundUp(10) : rockBottom!.rockBottomPressure(cylinder!).psi.roundUp(100)]);

String get buoyancyAtPressure => metric!
? sprintf("%+.01f", [
Expand Down Expand Up @@ -83,6 +83,6 @@ class CylinderViewModel {
]);

String get turnPressure => sprintf("%d", [
metric! ? rockBottom!.turnPressure(cylinder!).bar.roundUp(5) : rockBottom!.turnPressure(cylinder!).psi.roundUp(100),
metric! ? rockBottom!.turnPressure(cylinder!).bar.roundUp(10) : rockBottom!.turnPressure(cylinder!).psi.roundUp(100),
]);
}
10 changes: 8 additions & 2 deletions lib/models/rockbottom_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ class RockBottomModel {
double get depthAtm => (10 + depth.m) / 10;
double get safetyStopAtm => (10 + settings.safetyStopDepth.m) / 10;

Volume get troubleSolvingVolume => VolumeL(settings.troubleSolvingDuration * settings.sacRate.l * settings.troubleSolvingSacMultiplier * depthAtm);
Volume get troubleSolvingVolume {
// Min gas trouble solving is calculated at the average depth for simplicity.
if (settings.principles == Principles.MINGAS) {
return VolumeL(settings.troubleSolvingDuration * settings.sacRate.l * settings.troubleSolvingSacMultiplier * avgAtm);
}
return VolumeL(settings.troubleSolvingDuration * settings.sacRate.l * settings.troubleSolvingSacMultiplier * depthAtm);
}

double get ascentDuration => (depth.m / settings.ascentRate.m).roundToDouble();
double get ascentDuration => (depth.m / settings.ascentRate.m).ceilToDouble();

Volume get ascentVolume => VolumeL(ascentDuration * settings.sacRate.l * settings.ascentSacMultiplier * avgAtm);

Expand Down
5 changes: 3 additions & 2 deletions lib/settings/settings_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
if (event.principles == Principles.MINGAS) {
if (newSettings.isMetric && newSettings.sacRate.l < 15) newSettings.sacRate = VolumeL(15);
if (!newSettings.isMetric && newSettings.sacRate.cuft < 0.5) newSettings.sacRate = VolumeL(0.5);
if (newSettings.troubleSolvingSacMultiplier < 2) newSettings.troubleSolvingSacMultiplier = 2;
if (newSettings.ascentSacMultiplier < 2) newSettings.ascentSacMultiplier = 2;
newSettings.troubleSolvingSacMultiplier = 2;
newSettings.ascentSacMultiplier = 2;
newSettings.troubleSolvingDuration = 1;
newSettings.safetyStopDuration = 0;
newSettings.safetyStopSacMultiplier = 0;
newSettings.hideNdlNotice = true;
Expand Down
4 changes: 2 additions & 2 deletions lib/settings/settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class _SettingsViewState extends State<SettingsView> {
delegate: SliverChildListDelegate(
[
generalTable(context, state.settings),
troubleSolvingTable(context, state.settings),
ascentTable(context, state.settings),
if (state.settings.principles == Principles.ROCKBOTTOM) troubleSolvingTable(context, state.settings),
if (state.settings.principles == Principles.ROCKBOTTOM) ascentTable(context, state.settings),
if (state.settings.principles == Principles.ROCKBOTTOM) safetyStopTable(context, state.settings),
visualTable(context, state.settings),
Divider(
Expand Down

0 comments on commit 0f1ff87

Please sign in to comment.