diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-09 08:06:17 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-09 08:18:00 -0800 |
commit | 66c04f4f47f1f8fc55b3cc81df67acac1aa72b8f (patch) | |
tree | a8bc0d3482f166cace51ad4d5e1ec57f0bcf7129 /statistics.c | |
parent | c32cff2c6be74a6284f940328622740953008020 (diff) | |
download | subsurface-66c04f4f47f1f8fc55b3cc81df67acac1aa72b8f.tar.gz |
Fix up the statistics page use of pressure data
The statistics page calculates air use separately, and also needs to be
fixed up for the split of the pressures into sample-vs-start/end.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'statistics.c')
-rw-r--r-- | statistics.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/statistics.c b/statistics.c index ee3a5b220..4c6379443 100644 --- a/statistics.c +++ b/statistics.c @@ -165,11 +165,14 @@ 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]; + unsigned int start, end; + + start = cyl->start.mbar ? : cyl->sample_start.mbar; + end = cyl->end.mbar ? : cyl->sample_end.mbar; /* 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) { + if (cyl->type.workingpressure.mbar || cyl->type.size.mliter || start || end) { /* 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 +185,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) { |