mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
core: fix detection of used cylinders
The cylinder_with_sensor_sample() function only tests "do we have a mapping to this cylinder for this sample". It also needs to test if there are any tank pressure readings for that cylinder. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
51590853eb
commit
bdeeba4a67
1 changed files with 4 additions and 1 deletions
|
@ -3495,8 +3495,11 @@ extern bool cylinder_with_sensor_sample(const struct dive *dive, int cylinder_id
|
|||
{
|
||||
for (const struct divecomputer *dc = &dive->dc; dc; dc = dc->next) {
|
||||
for (int i = 0; i < dc->samples; ++i) {
|
||||
struct sample *sample = dc->sample + i;
|
||||
for (int j = 0; j < MAX_SENSORS; ++j) {
|
||||
if (dc->sample[i].sensor[j] == cylinder_id)
|
||||
if (!sample->pressure[j].mbar)
|
||||
continue;
|
||||
if (sample->sensor[j] == cylinder_id)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue