aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/libdivecomputer.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index d8fe54e8d..c80c8f28b 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -41,7 +41,7 @@ const char *progress_bar_text = "";
void (*progress_callback)(const char *text) = NULL;
double progress_bar_fraction = 0.0;
-static int stoptime, stopdepth, ndl, po2, cns;
+static int stoptime, stopdepth, ndl, po2, cns, heartbeat, bearing;
static bool in_deco, first_temp_is_air;
static int current_gas_index;
@@ -332,22 +332,22 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
case DC_SAMPLE_TIME:
nsensor = 0;
- // The previous sample gets some sticky values
- // that may have been around from before, even
- // if there was no new data
- if (sample) {
- sample->in_deco = in_deco;
- sample->ndl.seconds = ndl;
- sample->stoptime.seconds = stoptime;
- sample->stopdepth.mm = stopdepth;
- sample->setpoint.mbar = po2;
- sample->cns = cns;
- }
// Create a new sample.
// Mark depth as negative
sample = prepare_sample(dc);
sample->time.seconds = value.time;
sample->depth.mm = -1;
+ // The current sample gets some sticky values
+ // that may have been around from before, these
+ // values will be overwritten by new data if available
+ sample->in_deco = in_deco;
+ sample->ndl.seconds = ndl;
+ sample->stoptime.seconds = stoptime;
+ sample->stopdepth.mm = stopdepth;
+ sample->setpoint.mbar = po2;
+ sample->cns = cns;
+ sample->heartbeat = heartbeat;
+ sample->bearing.degrees = bearing;
finish_sample(dc);
break;
case DC_SAMPLE_DEPTH:
@@ -369,10 +369,10 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
sample->rbt.seconds = (!strncasecmp(dc->model, "suunto", 6)) ? value.rbt : value.rbt * 60;
break;
case DC_SAMPLE_HEARTBEAT:
- sample->heartbeat = value.heartbeat;
+ sample->heartbeat = heartbeat = value.heartbeat;
break;
case DC_SAMPLE_BEARING:
- sample->bearing.degrees = value.bearing;
+ sample->bearing.degrees = bearing = value.bearing;
break;
#ifdef DEBUG_DC_VENDOR
case DC_SAMPLE_VENDOR: