From ef3735eafbe6eb2bdd1a85b772e7c6dfc8945ac7 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 8 Dec 2012 14:02:31 -0800 Subject: Make sure pO2 and cns are filled in all samples This allows things to work for dive computers like the OSTC that give us setpoint information in the sample, but not constant pO2 readings. Signed-off-by: Dirk Hohndel --- libdivecomputer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libdivecomputer.c b/libdivecomputer.c index e62265b7a..99532b63f 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -22,7 +22,7 @@ static const char *progress_bar_text = ""; static double progress_bar_fraction = 0.0; -static int stoptime, stopdepth, ndl; +static int stoptime, stopdepth, ndl, po2, cns; static GError *error(const char *fmt, ...) { @@ -152,6 +152,8 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata) sample->ndl.seconds = ndl; sample->stoptime.seconds = stoptime; sample->stopdepth.mm = stopdepth; + sample->po2 = po2; + sample->cns = cns; } sample = prepare_sample(dc); sample->time.seconds = value.time; @@ -188,13 +190,13 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata) #if DC_VERSION_CHECK(0, 3, 0) case DC_SAMPLE_SETPOINT: /* for us a setpoint means constant pO2 from here */ - sample->po2 = value.setpoint * 1000 + 0.5; + sample->po2 = po2 = value.setpoint * 1000 + 0.5; break; case DC_SAMPLE_PPO2: - sample->po2 = value.ppo2 * 1000 + 0.5; + sample->po2 = po2 = value.ppo2 * 1000 + 0.5; break; case DC_SAMPLE_CNS: - sample->cns = value.cns * 100 + 0.5; + sample->cns = cns = value.cns * 100 + 0.5; break; #endif default: -- cgit v1.2.3-70-g09d2