units: replace SURFACE_PRESSURE by 1_atm

Moreover, convert diveplan::surface_pressure from int to
pressure_t.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-09-09 13:55:37 +02:00 committed by bstoeger
parent ae81b42fe2
commit dd5def35f5
11 changed files with 56 additions and 64 deletions

View file

@ -170,8 +170,9 @@ void DivePlannerWidget::settingsChanged()
ui.startTime->setDisplayFormat(QString::fromStdString(prefs.time_format));
}
void DivePlannerWidget::atmPressureChanged(const int pressure)
void DivePlannerWidget::atmPressureChanged(int pressure_in_mbar)
{
pressure_t pressure { .mbar = pressure_in_mbar };
DivePlannerPointsModel::instance()->setSurfacePressure(pressure);
ui.atmHeight->blockSignals(true);
ui.atmHeight->setValue((int) get_depth_units((int) pressure_to_altitude(pressure), NULL, NULL));
@ -180,9 +181,9 @@ void DivePlannerWidget::atmPressureChanged(const int pressure)
void DivePlannerWidget::heightChanged(const int height)
{ // height is in ft or in meters
int pressure = (int) (altitude_to_pressure(units_to_depth((double) height).mm));
pressure_t pressure = altitude_to_pressure(units_to_depth((double) height).mm);
ui.ATMPressure->blockSignals(true);
ui.ATMPressure->setValue(pressure);
ui.ATMPressure->setValue(pressure.mbar);
ui.ATMPressure->blockSignals(false);
DivePlannerPointsModel::instance()->setSurfacePressure(pressure);
}