X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=profile.c;h=614822809f53dd59bcb6ad2575f51b5e8207e398;hb=549708c6eaab2d0592c3e520e0debd82d64619b4;hp=822e30c0e11e5c217e84235578cfde08b6445fdb;hpb=827c1e352121af96708f0414248e57d735e3dea8;p=ext%2Fsubsurface.git diff --git a/profile.c b/profile.c index 822e30c..6148228 100644 --- a/profile.c +++ b/profile.c @@ -1014,8 +1014,7 @@ static void dump_pr_track(pr_track_t **track_pr) } } -static void fill_missing_tank_pressures(struct dive *dive, struct plot_info *pi, - pr_track_t **track_pr) +static void fill_missing_tank_pressures(struct plot_info *pi, pr_track_t **track_pr) { pr_track_t *list = NULL; pr_track_t *nlist = NULL; @@ -1338,7 +1337,7 @@ static struct plot_info *create_plot_info(struct dive *dive, int nr_samples, str pi->meandepth = dive->meandepth.mm; if (missing_pr) { - fill_missing_tank_pressures(dive, pi, track_pr); + fill_missing_tank_pressures(pi, track_pr); } for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) list_free(track_pr[cyl]); @@ -1355,12 +1354,15 @@ void plot(struct graphics_context *gc, cairo_rectangle_int_t *drawing_area, stru int nr = dive->samples; if (!nr) { + /* The dive has no samples, so create a few fake ones. This assumes an + ascent/descent rate of 9 m/min, which is just below the limit for FAST. */ int duration = dive->duration.seconds; int maxdepth = dive->maxdepth.mm; + int asc_desc_time = dive->maxdepth.mm*60/9000; sample = fake; - fake[1].time.seconds = duration * 0.05; + fake[1].time.seconds = asc_desc_time; fake[1].depth.mm = maxdepth; - fake[2].time.seconds = duration * 0.95; + fake[2].time.seconds = duration - asc_desc_time; fake[2].depth.mm = maxdepth; fake[3].time.seconds = duration * 1.00; nr = 4;