X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=profile.c;h=f0ae0c9311c5eba3c3bc24130c01d8b02c36eb59;hb=2b0f30c3d4773d4e78daf7e2ce76f5c3f3a2d0b3;hp=32a47f9af11c60dec6006381e78c5c8fab621a03;hpb=34d79509617685c0df39abf0775f7065ec52e8e8;p=ext%2Fsubsurface.git diff --git a/profile.c b/profile.c index 32a47f9..f0ae0c9 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", @@ -699,7 +698,8 @@ static void plot_cylinder_pressure_text(struct graphics_context *gc, struct plot } } cyl = entry->cylinderindex; - last_pressure[cyl] = GET_PRESSURE(entry); + if (GET_PRESSURE(entry)) + last_pressure[cyl] = GET_PRESSURE(entry); last_time[cyl] = entry->sec; for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) { @@ -790,8 +790,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; } @@ -937,6 +935,7 @@ static void fill_missing_tank_pressures(struct dive *dive, struct plot_info *pi, if (!nlist) { /* just continue without calculating * interpolated values */ + INTERPOLATED_PRESSURE(entry) = cur_pr[entry->cylinderindex]; list = NULL; continue; } @@ -1192,8 +1191,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;