From 7c6a904bbff56d9d3ad782b569231e0a0bb16847 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 6 Jul 2019 16:15:39 +0200 Subject: Profile: use pressure data functions in save_profiles_buffer The save_profiles_buffer() function was accessing the pressure data directly. Instead, use the already existing funcions to make transition to dynamically allocated pressure data more seamless. Signed-off-by: Berthold Stoeger --- core/save-profiledata.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/save-profiledata.c b/core/save-profiledata.c index 7802f7cd3..4f7440708 100644 --- a/core/save-profiledata.c +++ b/core/save-profiledata.c @@ -31,16 +31,15 @@ static void put_video_time(struct membuffer *b, int secs) put_format(b, "%d:%02d:%02d.000,", hours, mins, secs); } -static void put_pd(struct membuffer *b, struct plot_data *entry) +static void put_pd(struct membuffer *b, const struct plot_info *pi, int idx) { - if (!entry) - return; + const struct plot_data *entry = pi->entry + idx; put_int(b, entry->in_deco); put_int(b, entry->sec); for (int c = 0; c < MAX_CYLINDERS; c++) { - put_int(b, entry->pressure[c][0]); - put_int(b, entry->pressure[c][1]); + put_int(b, get_plot_sensor_pressure(pi, idx, c)); + put_int(b, get_plot_interpolated_pressure(pi, idx, c)); } put_int(b, entry->temperature); put_int(b, entry->depth); @@ -208,7 +207,7 @@ static void save_profiles_buffer(struct membuffer *b, bool select_only) put_format(b, "\n"); for (int i = 0; i < pi.nr; i++) { - put_pd(b, &pi.entry[i]); + put_pd(b, &pi, i); put_format(b, "\n"); } put_format(b, "\n"); -- cgit v1.2.3-70-g09d2