aboutsummaryrefslogtreecommitdiffstats
path: root/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-09-13 19:58:55 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-13 15:27:39 -0700
commit3fb017a1c38c95b21890904b2570e9b7a611ca3f (patch)
tree0cd7a533daa007eb741f0e41ffdb1486fb4dc89d /libdivecomputer.c
parentba8b7c6c275b2149bc2d836ef6ee2f126f8b85ff (diff)
downloadsubsurface-3fb017a1c38c95b21890904b2570e9b7a611ca3f.tar.gz
Store the number of detected o2 sensors
To make our logic to handle o2 sensors do usefull things we need to inform it of the amout of o2 sensors we got. This saves the max number of PPO2 samples we got from libdivecomputer as our number of o2 sensors. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r--libdivecomputer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c
index ef6a9b962..631e0dade 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -276,6 +276,9 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
else
report_error("%d is more o2 sensors than we can handle", nsensor);
nsensor++;
+ // Set the amount of detected o2 sensors
+ if (nsensor > dc->no_o2sensors)
+ dc->no_o2sensors = nsensor;
break;
case DC_SAMPLE_CNS:
sample->cns = cns = rint(value.cns * 100);