diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-07-06 13:55:44 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-11-09 19:19:04 +0100 |
commit | 4c9532dc516f877e7fc94616dd027508b5f2a12f (patch) | |
tree | 3347f1d3f188ee865302f1193f05880a3e413a07 /core/gaspressures.c | |
parent | 7e1425796d45870fd845f7e92b478730ba7a4e6a (diff) | |
download | subsurface-4c9532dc516f877e7fc94616dd027508b5f2a12f.tar.gz |
Profile: use pressure data functions in fill_missing_tank_pressures
The pressure data was directly accessed in fill_missing_tank_pressures().
Use the already existing functions so that the structures can be adapted
easily.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/gaspressures.c')
-rw-r--r-- | core/gaspressures.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/core/gaspressures.c b/core/gaspressures.c index f8f6a7899..2feeaa7d0 100644 --- a/core/gaspressures.c +++ b/core/gaspressures.c @@ -263,13 +263,10 @@ static void fill_missing_tank_pressures(struct dive *dive, struct plot_info *pi, double magic; pr_track_t *segment; int pressure; - int *save_pressure, *save_interpolated; entry = pi->entry + i; - save_pressure = &(entry->pressure[cyl][SENSOR_PR]); - save_interpolated = &(entry->pressure[cyl][INTERPOLATED_PR]); - pressure = *save_pressure ? *save_pressure : *save_interpolated; + pressure = get_plot_pressure(pi, i, cyl); if (pressure) { // If there is a valid pressure value, last_segment = NULL; // get rid of interpolation data, @@ -291,7 +288,8 @@ static void fill_missing_tank_pressures(struct dive *dive, struct plot_info *pi, continue; if (!segment->pressure_time) { // Empty segment? - *save_pressure = cur_pr; // Just use our current pressure + set_plot_pressure_data(pi, i, SENSOR_PR, cyl, cur_pr); + // Just use our current pressure continue; // and skip to next point. } @@ -318,7 +316,7 @@ static void fill_missing_tank_pressures(struct dive *dive, struct plot_info *pi, magic = (interpolate.end - interpolate.start) / (segment->t_end - segment->t_start); cur_pr = lrint(segment->start + magic * (entry->sec - segment->t_start)); } - *save_interpolated = cur_pr; // and store the interpolated data in plot_info + set_plot_pressure_data(pi, i, INTERPOLATED_PR, cyl, cur_pr); // and store the interpolated data in plot_info } } |