X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=statistics.c;h=f8f9d0e24549ca10c568eb85fcc2b957ea14a814;hb=605e063203f8a2a35a5c3be1e7129e80099dd68a;hp=ee3a5b22031e9221de9b346b89f187558931f00b;hpb=97f09f3ea81548a3aac5ae839b1d1bc6211fe8ec;p=ext%2Fsubsurface.git diff --git a/statistics.c b/statistics.c index ee3a5b2..f8f9d0e 100644 --- a/statistics.c +++ b/statistics.c @@ -165,11 +165,11 @@ void show_dive_stats(struct dive *dive) /* for the O2/He readings just create a list of them */ for (idx = 0; idx < MAX_CYLINDERS; idx++) { cylinder_t *cyl = &dive->cylinder[idx]; - /* we assume that every valid cylinder has either a working pressure - * or a size; but for good measure let's also accept cylinders with - * a starting or ending pressure*/ - if (cyl->type.workingpressure.mbar || cyl->type.size.mliter || - cyl->start.mbar || cyl->end.mbar) { + unsigned int start, end; + + start = cyl->start.mbar ? : cyl->sample_start.mbar; + end = cyl->end.mbar ? : cyl->sample_end.mbar; + if (!cylinder_none(cyl)) { /* 0% O2 strangely means air, so 21% - I don't like that at all */ int o2 = cyl->gasmix.o2.permille ? : 209; if (offset > 0) { @@ -182,9 +182,8 @@ void show_dive_stats(struct dive *dive) } /* and if we have size, start and end pressure, we can * calculate the total gas used */ - if (cyl->type.size.mliter && cyl->start.mbar && cyl->end.mbar) - gas_used += cyl->type.size.mliter / 1000.0 * - (cyl->start.mbar - cyl->end.mbar); + if (cyl->type.size.mliter && start && end) + gas_used += cyl->type.size.mliter / 1000.0 * (start - end); } set_label(info_stat_w.o2he, buf); if (gas_used) {