From c5073aa4468c1fab57942e6b8616339f7cd155d8 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 9 Nov 2011 19:37:18 -0500 Subject: [PATCH] Remove unused 'minpressure/endpressure' fields from plot info .. and fix the maxpressure to actually look at *all* the cylinders, so that if you don't have sample data, but rely onmanually set cylinder pressures, it now really is the max of all the cylinders. Signed-off-by: Linus Torvalds --- profile.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/profile.c b/profile.c index 32a47f9..d2ebf4a 100644 --- a/profile.c +++ b/profile.c @@ -21,8 +21,7 @@ struct plot_info { int nr; int maxtime; int meandepth, maxdepth; - int minpressure, maxpressure; - int endpressure; /* start pressure better be max pressure */ + int maxpressure; int mintemp, maxtemp; struct plot_data { unsigned int same_cylinder:1; @@ -102,9 +101,9 @@ static void dump_pi (struct plot_info *pi) int i; printf("pi:{nr:%d maxtime:%d meandepth:%d maxdepth:%d \n" - " minpressure:%d maxpressure:%d endpressure:%d mintemp:%d maxtemp:%d\n", + " maxpressure:%d mintemp:%d maxtemp:%d\n", pi->nr, pi->maxtime, pi->meandepth, pi->maxdepth, - pi->minpressure, pi->maxpressure, pi->endpressure, pi->mintemp, pi->maxtemp); + pi->maxpressure, pi->mintemp, pi->maxtemp); for (i = 0; i < pi->nr; i++) printf(" entry[%d]:{same_cylinder:%d cylinderindex:%d sec:%d pressure:{%d,%d}\n" " temperature:%d depth:%d smoothed:%d}\n", @@ -790,8 +789,6 @@ static struct plot_info *analyze_plot_info(struct plot_info *pi) int temperature = entry->temperature; if (pressure) { - if (!pi->minpressure || pressure < pi->minpressure) - pi->minpressure = pressure; if (pressure > pi->maxpressure) pi->maxpressure = pressure; } @@ -1192,8 +1189,15 @@ static struct plot_info *create_plot_info(struct dive *dive, int nr_samples, str pi->nr++; pi->maxtime = pi->entry[lastindex].sec; - pi->endpressure = pi->minpressure = dive->cylinder[0].end.mbar; - pi->maxpressure = dive->cylinder[0].start.mbar; + /* Analyze_plot_info() will do the sample max pressures, + * this handles the manual pressures + */ + pi->maxpressure = 0; + for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) { + unsigned int mbar = dive->cylinder[cyl].start.mbar; + if (mbar > pi->maxpressure) + pi->maxpressure = mbar; + } pi->meandepth = dive->meandepth.mm; -- 2.43.0