diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-12-08 14:02:31 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-12-08 14:02:31 -0800 |
commit | ef3735eafbe6eb2bdd1a85b772e7c6dfc8945ac7 (patch) | |
tree | da52922f195d87301af8126abc40d655c203c189 /libdivecomputer.c | |
parent | 81851595669becd5bd1ef73cfc26570fa16554e0 (diff) | |
download | subsurface-ef3735eafbe6eb2bdd1a85b772e7c6dfc8945ac7.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r-- | libdivecomputer.c | 10 |
1 files 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: |