summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdivecomputer.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c
index 99532b63f..51c6a5775 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -97,10 +97,10 @@ static void handle_event(struct divecomputer *dc, struct sample *sample, dc_samp
if (value.event.type == SAMPLE_EVENT_SURFACE)
return;
- /* libdivecomputer 0.3 provides us with deco / ndl information for at least
- * the OSTC. Sadly, it does so through events - so we convert this into our
- * preferred sample format here */
-#if DC_VERSION_CHECK(0, 3, 0)
+ /* an early development version of libdivecomputer 0.3 provided us with deco / ndl information for
+ * a couple of dive computers through events; this got fixed later in the release cycle but for a
+ * short while I'll keep the code around that converts the events into our preferred sample format here */
+#if 0
if (value.event.type == SAMPLE_EVENT_DECOSTOP) {
/* packed value - time in seconds in high 16 bit
* depth in m(!) in low 16 bits */
@@ -198,6 +198,14 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
case DC_SAMPLE_CNS:
sample->cns = cns = value.cns * 100 + 0.5;
break;
+ case DC_SAMPLE_DECO:
+ if (value.deco.type == DC_DECO_NDL) {
+ ndl = value.deco.time;
+ } else if (value.deco.type == DC_DECO_DECOSTOP ||
+ value.deco.type == DC_DECO_DEEPSTOP) {
+ stopdepth = value.deco.depth * 1000.0 + 0.5;
+ stoptime = value.deco.time;
+ }
#endif
default:
break;