summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--core/dive.c2
-rw-r--r--desktop-widgets/mainwindow.cpp2
3 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d64136a2..c3b746606 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+planner: properly initialize salinity
desktop: add an "Edit Gas Change" right-click option [#2910]
core: add support for Shearwater Peregrine (requires firmware V79 or newer)
core: fix renumbering of imported dives [#2731]
diff --git a/core/dive.c b/core/dive.c
index d2a4ea23c..6bed5966a 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -3729,7 +3729,7 @@ double depth_to_atm(int depth, const struct dive *dive)
int rel_mbar_to_depth(int mbar, const struct dive *dive)
{
int cm;
- double specific_weight = 1.03 * 0.981;
+ double specific_weight = SEAWATER_SALINITY * 0.981 / 10000.0;
if (dive->dc.salinity)
specific_weight = dive->dc.salinity / 10000.0 * 0.981;
/* whole mbar gives us cm precision */
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 87a7e1d06..5c151849f 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -895,6 +895,8 @@ void MainWindow::on_actionDivePlanner_triggered()
divePlannerSettingsWidget->setBailoutVisibility(current_dive->dc.divemode);
if (current_dive->salinity)
divePlannerWidget->setSalinity(current_dive->salinity);
+ else // No salinity means salt water
+ divePlannerWidget->setSalinity(SEAWATER_SALINITY);
}
divePlannerWidget->setReplanButton(false);
}