mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
libdivecomputer.c init sticky values for samples for current sample
When filling samples with values during DC import fill sticky values like CNS, NDL, stoptime,... immediately into current sample. Otherwise we will not fill the sticky values into the last sample created. Add two new sticky values: heartbeat and bearing Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
249b758b0d
commit
0895bccf49
1 changed files with 14 additions and 14 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue