[PATCH] Store the number of detected o2 sensors

Anton Lundin glance at acc.umu.se
Sun Sep 13 10:58:55 PDT 2015


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 at acc.umu.se>
---
 libdivecomputer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libdivecomputer.c b/libdivecomputer.c
index ef6a9b9..631e0da 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);
-- 
2.1.4



More information about the subsurface mailing list