mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Make gas mod be reasonable for users of imperial units as well
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
65c5d6815c
commit
7f3efbdc98
6 changed files with 10 additions and 5 deletions
|
@ -241,7 +241,7 @@ void reset_cylinders(struct dive *dive)
|
||||||
if (cylinder_none(cyl))
|
if (cylinder_none(cyl))
|
||||||
continue;
|
continue;
|
||||||
if (cyl->depth.mm == 0) /* if the gas doesn't give a mod, assume conservative pO2 */
|
if (cyl->depth.mm == 0) /* if the gas doesn't give a mod, assume conservative pO2 */
|
||||||
cyl->depth = gas_mod(&cyl->gasmix, pO2, 3000);
|
cyl->depth = gas_mod(&cyl->gasmix, pO2, M_OR_FT(3,10));
|
||||||
if (cyl->type.workingpressure.mbar)
|
if (cyl->type.workingpressure.mbar)
|
||||||
cyl->start.mbar = cyl->end.mbar = cyl->type.workingpressure.mbar;
|
cyl->start.mbar = cyl->end.mbar = cyl->type.workingpressure.mbar;
|
||||||
cyl->gas_used.mliter = 0;
|
cyl->gas_used.mliter = 0;
|
||||||
|
|
|
@ -35,8 +35,6 @@ QString get_trip_date_string(timestamp_t when, int nr);
|
||||||
QString uiLanguage(QLocale *callerLoc);
|
QString uiLanguage(QLocale *callerLoc);
|
||||||
void selectedDivesGasUsed(QVector<QPair<QString, int> > &gasUsed);
|
void selectedDivesGasUsed(QVector<QPair<QString, int> > &gasUsed);
|
||||||
|
|
||||||
#define M_OR_FT(_m, _f) ((prefs.units.length == units::METERS) ? ((_m) * 1000) : (feet_to_mm(_f)))
|
|
||||||
|
|
||||||
#if defined __APPLE__
|
#if defined __APPLE__
|
||||||
#define TITLE_OR_TEXT(_t, _m) "", _t + "\n" + _m
|
#define TITLE_OR_TEXT(_t, _m) "", _t + "\n" + _m
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -694,7 +694,7 @@ bool DivePlannerPointsModel::addGas(struct gasmix mix)
|
||||||
* The user should be able to change this depth manually. */
|
* The user should be able to change this depth manually. */
|
||||||
pressure_t modpO2;
|
pressure_t modpO2;
|
||||||
modpO2.mbar = prefs.decopo2;
|
modpO2.mbar = prefs.decopo2;
|
||||||
cyl->depth = gas_mod(&mix, modpO2, 3000);
|
cyl->depth = gas_mod(&mix, modpO2, M_OR_FT(3,10));
|
||||||
|
|
||||||
CylindersModel::instance()->setDive(stagingDive);
|
CylindersModel::instance()->setDive(stagingDive);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -251,7 +251,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
|
||||||
cyl->gasmix.o2 = string_to_fraction(vString.toUtf8().data());
|
cyl->gasmix.o2 = string_to_fraction(vString.toUtf8().data());
|
||||||
pressure_t modpO2;
|
pressure_t modpO2;
|
||||||
modpO2.mbar = prefs.decopo2;
|
modpO2.mbar = prefs.decopo2;
|
||||||
cyl->depth = gas_mod(&cyl->gasmix, modpO2, 3000);
|
cyl->depth = gas_mod(&cyl->gasmix, modpO2, M_OR_FT(3,10));
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -35,6 +35,7 @@ HEADERS = \
|
||||||
profile.h \
|
profile.h \
|
||||||
qt-gui.h \
|
qt-gui.h \
|
||||||
qthelper.h \
|
qthelper.h \
|
||||||
|
units.h \
|
||||||
divecomputer.h \
|
divecomputer.h \
|
||||||
qt-ui/about.h \
|
qt-ui/about.h \
|
||||||
qt-ui/completionmodels.h \
|
qt-ui/completionmodels.h \
|
||||||
|
|
6
units.h
6
units.h
|
@ -16,6 +16,12 @@ extern "C" {
|
||||||
#define SURFACE_PRESSURE_STRING "1013"
|
#define SURFACE_PRESSURE_STRING "1013"
|
||||||
#define ZERO_C_IN_MKELVIN 273150 // mKelvin
|
#define ZERO_C_IN_MKELVIN 273150 // mKelvin
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define M_OR_FT(_m, _f) ((prefs.units.length == units::METERS) ? ((_m) * 1000) : (feet_to_mm(_f)))
|
||||||
|
#else
|
||||||
|
#define M_OR_FT(_m, _f) ((prefs.units.length == METERS) ? ((_m) * 1000) : (feet_to_mm(_f)))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Salinity is expressed in weight in grams per 10l */
|
/* Salinity is expressed in weight in grams per 10l */
|
||||||
#define SEAWATER_SALINITY 10300
|
#define SEAWATER_SALINITY 10300
|
||||||
#define FRESHWATER_SALINITY 10000
|
#define FRESHWATER_SALINITY 10000
|
||||||
|
|
Loading…
Add table
Reference in a new issue