core: turn M_OR_FT macro into a function

No point in this being a macro. Make it return a depth_t - it
was unclear that this returns a depth in mm.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-12-14 10:10:19 +01:00 committed by Michael Keller
parent 0e77dd9a68
commit bd2f7e72f1
11 changed files with 105 additions and 97 deletions

View file

@ -19,8 +19,6 @@
#define HE_DENSITY 166
#define ZERO_C_IN_MKELVIN 273150 // mKelvin
#define M_OR_FT(_m, _f) ((prefs.units.length == units::METERS) ? ((_m) * 1000) : (feet_to_mm(_f)))
/* Salinity is expressed in weight in grams per 10l */
#define SEAWATER_SALINITY 10300
#define EN13319_SALINITY 10200
@ -193,6 +191,10 @@ static inline depth_t operator""_ft(unsigned long long ft)
return depth_t { .mm = static_cast<int32_t>(round(ft * 304.8)) };
}
// Return either the first argument in meters or the second argument in
// feet, depending on use settings.
depth_t m_or_ft(int m, int ft);
struct pressure_t : public unit_base<pressure_t>
{
int32_t mbar = 0; // pressure up to 2000 bar