diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-01 15:23:55 -0500 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-01 20:18:53 -0500 |
commit | a554c66fa39912ac82253741880a83a22bf574b4 (patch) | |
tree | 914939d6deff0219a52e306da352b3cc914eeec6 /qt-mobile/qml/main.qml | |
parent | f92e2e752f6e16af518b3e2e5221bf401221751a (diff) | |
download | subsurface-a554c66fa39912ac82253741880a83a22bf574b4.tar.gz |
Fix cylinder end pressure fixup from samples
This bug admittedly hits almost nobody, but if you had multiple cylinder
pressure sensors on the same cylinder (attached to multiple dive
computers, of course), we would take the beginning pressure from the
first dive computer, and the ending pressure from the last dive
computer.
That came about because we'd just walk all the dive computer samples in
order, and the first time we see a relevant sample and we don't have a
beginning pressure, we'd take that pressure. So the beginning pressure
was from the first dive computer, and once we'd seen a valid beginning
pressure, that would never change.
But as we're walking along, we'd continue to update the ending pressure
from the last relevant sample we see, which means that as we go on to
look at the other dive computers, we'd continue to update the ending
pressure with data from them.
And mixing beginning/ending pressures from two different sensors just
does not make sense.
This changes the logic to be the same for beginning and ending
pressures: we only update it once, with the first relevant sample we
see. But we walk the samples twice: forwards from the beginning to
find the first beginning pressure, and backwards from the end to find
the ending pressure.
That means that as we move on to the second dive computer, we've now
filled in the ending pressure from the first one, and will no longer
update it any more.
NOTE! We don't stop scanning the samples (or the dive computers) just
because we've found a valid pressure value. We'll always walk all the
samples because there might be multiple different cylinders that get
pressure data from different samples (and different dive computers).
We could have some early-out logic when we've filled in all relevant
cylinders, but since this just runs once per dive it's not worth it.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qml/main.qml')
0 files changed, 0 insertions, 0 deletions