Planner: Properly initialize salinity

When the dive has no explicity salinity, our conversion
between pressure and depth assumed salt water. Make this
explicity by using the corresponding macro.

When the planner starts and no salinity is set explicity,
set the water type chooser to salt water to reflect
our default assumption.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2020-09-02 11:10:51 +02:00 committed by Dirk Hohndel
parent f5ba42e933
commit 7e82205e9b
3 changed files with 4 additions and 1 deletions

View file

@ -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]

View file

@ -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 */

View file

@ -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);
}