Gas usage statistics: don't require gas switch events

Our "get_has_used()" helper only filled in gas usage for cylinders that
had a gas change event associated with them.  That works really badly
for things like CCR, but also simply for cases where the dive computer
wasn't necessarily explicitly notified about usage, like sidemount
diving etc.

Just remove the logic.  If some use ends up particularly wanting to
ignore some cylinder, they can always do it in the caller instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2017-07-22 08:28:39 -07:00 committed by Dirk Hohndel
parent f2a6a76b3e
commit b9f52d0aff

View file

@ -345,23 +345,11 @@ void get_gas_used(struct dive *dive, volume_t gases[MAX_CYLINDERS])
{
int idx;
struct divecomputer *dc;
bool used;
for (idx = 0; idx < MAX_CYLINDERS; idx++) {
used = false;
cylinder_t *cyl = &dive->cylinder[idx];
pressure_t start, end;
for_each_dc(dive, dc) {
if (same_string(dc->model, "planned dive"))
continue;
if (has_gaschange_event(dive, dc, idx))
used = true;
}
if (!used)
continue;
start = cyl->start.mbar ? cyl->start : cyl->sample_start;
end = cyl->end.mbar ? cyl->end : cyl->sample_end;
if (end.mbar && start.mbar > end.mbar)