diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-07-05 23:14:07 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-07-18 05:50:22 -0700 |
commit | 469cc68b029ac3308b4338a43acfa21679493e8b (patch) | |
tree | 110eaf78f7c1123784313009f2b8ee4844ec16f8 /core/gaspressures.c | |
parent | 29005b578de4680556f6a3fa01781a8af842ced8 (diff) | |
download | subsurface-469cc68b029ac3308b4338a43acfa21679493e8b.tar.gz |
Cleanup: replace pressure reading macros by inline functions
Replace the INTERPOLATED_PRESSURE and SENSOR_PRESSURE macros by
inline functions. Generate a common inline function that reads
a pressure value for a dynamic sensor.
Not all SENSOR_PRESSURE macros can be replaced, because the
macro is also used to set the value and C sadly doesn't know
the concept of "return reference from a function".
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/gaspressures.c')
-rw-r--r-- | core/gaspressures.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/gaspressures.c b/core/gaspressures.c index 3b84aad24..2109c2702 100644 --- a/core/gaspressures.c +++ b/core/gaspressures.c @@ -352,7 +352,7 @@ static void debug_print_pressures(struct plot_info *pi) int i; for (i = 0; i < pi->nr; i++) { struct plot_data *entry = pi->entry + i; - printf("%5d |%9d | %9d |\n", i, SENSOR_PRESSURE(entry), INTERPOLATED_PRESSURE(entry)); + printf("%5d |%9d | %9d |\n", i, get_plot_sensor_pressure(entry), get_plot_interpolated_pressure(entry)); } } #endif @@ -388,7 +388,7 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s first = last = -1; for (int i = 0; i < pi->nr; i++) { struct plot_data *entry = pi->entry + i; - unsigned pressure = SENSOR_PRESSURE(entry, sensor); + int pressure = get_plot_sensor_pressure(entry, sensor); if (!pressure) continue; @@ -417,7 +417,7 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s for (int i = first; i <= last; i++) { struct plot_data *entry = pi->entry + i; - unsigned pressure = SENSOR_PRESSURE(entry, sensor); + int pressure = get_plot_sensor_pressure(entry, sensor); int time = entry->sec; while (ev && ev->time.seconds <= time) { // Find 1st gaschange event after |