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 <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2011-11-09 19:37:18 -05:00
parent 34d7950961
commit c5073aa446

View file

@ -21,8 +21,7 @@ struct plot_info {
int nr; int nr;
int maxtime; int maxtime;
int meandepth, maxdepth; int meandepth, maxdepth;
int minpressure, maxpressure; int maxpressure;
int endpressure; /* start pressure better be max pressure */
int mintemp, maxtemp; int mintemp, maxtemp;
struct plot_data { struct plot_data {
unsigned int same_cylinder:1; unsigned int same_cylinder:1;
@ -102,9 +101,9 @@ static void dump_pi (struct plot_info *pi)
int i; int i;
printf("pi:{nr:%d maxtime:%d meandepth:%d maxdepth:%d \n" 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->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++) for (i = 0; i < pi->nr; i++)
printf(" entry[%d]:{same_cylinder:%d cylinderindex:%d sec:%d pressure:{%d,%d}\n" printf(" entry[%d]:{same_cylinder:%d cylinderindex:%d sec:%d pressure:{%d,%d}\n"
" temperature:%d depth:%d smoothed:%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; int temperature = entry->temperature;
if (pressure) { if (pressure) {
if (!pi->minpressure || pressure < pi->minpressure)
pi->minpressure = pressure;
if (pressure > pi->maxpressure) if (pressure > pi->maxpressure)
pi->maxpressure = pressure; pi->maxpressure = pressure;
} }
@ -1192,8 +1189,15 @@ static struct plot_info *create_plot_info(struct dive *dive, int nr_samples, str
pi->nr++; pi->nr++;
pi->maxtime = pi->entry[lastindex].sec; pi->maxtime = pi->entry[lastindex].sec;
pi->endpressure = pi->minpressure = dive->cylinder[0].end.mbar; /* Analyze_plot_info() will do the sample max pressures,
pi->maxpressure = dive->cylinder[0].start.mbar; * 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; pi->meandepth = dive->meandepth.mm;