mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-20 06:45:27 +00:00
Set old setpoint value, if new one is not recorded
Since the setpoint value is initialized as zero, we have to set the previous value if we do not have a current reading. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8b6d49092b
commit
5ec3d0dca0
1 changed files with 7 additions and 2 deletions
9
file.c
9
file.c
|
@ -450,8 +450,8 @@ int parse_txt_file(const char *filename, const char *csv)
|
||||||
if (MATCH(memtxt.buffer, "MkVI_Config") == 0) {
|
if (MATCH(memtxt.buffer, "MkVI_Config") == 0) {
|
||||||
int d, m, y;
|
int d, m, y;
|
||||||
int hh = 0, mm = 0, ss = 0;
|
int hh = 0, mm = 0, ss = 0;
|
||||||
int prev_depth = 0, cur_sampletime = 0;
|
int prev_depth = 0, cur_sampletime = 0, prev_setpoint;
|
||||||
bool has_depth = false;
|
bool has_depth = false, has_setpoint = false;
|
||||||
char *lineptr;
|
char *lineptr;
|
||||||
|
|
||||||
struct dive *dive;
|
struct dive *dive;
|
||||||
|
@ -522,6 +522,7 @@ int parse_txt_file(const char *filename, const char *csv)
|
||||||
sscanf(lineptr, "%d,%d,%d", &cur_sampletime, &type, &value);
|
sscanf(lineptr, "%d,%d,%d", &cur_sampletime, &type, &value);
|
||||||
|
|
||||||
has_depth = false;
|
has_depth = false;
|
||||||
|
has_setpoint = false;
|
||||||
sample = prepare_sample(dc);
|
sample = prepare_sample(dc);
|
||||||
sample->time.seconds = cur_sampletime;
|
sample->time.seconds = cur_sampletime;
|
||||||
|
|
||||||
|
@ -548,6 +549,8 @@ int parse_txt_file(const char *filename, const char *csv)
|
||||||
add_sample_data(sample, POSEIDON_DILUENT, value);
|
add_sample_data(sample, POSEIDON_DILUENT, value);
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
|
has_setpoint = true;
|
||||||
|
prev_setpoint = value;
|
||||||
add_sample_data(sample, POSEIDON_SETPOINT, value);
|
add_sample_data(sample, POSEIDON_SETPOINT, value);
|
||||||
break;
|
break;
|
||||||
case 39:
|
case 39:
|
||||||
|
@ -575,6 +578,8 @@ int parse_txt_file(const char *filename, const char *csv)
|
||||||
|
|
||||||
if (!has_depth)
|
if (!has_depth)
|
||||||
add_sample_data(sample, POSEIDON_DEPTH, prev_depth);
|
add_sample_data(sample, POSEIDON_DEPTH, prev_depth);
|
||||||
|
if (!has_setpoint)
|
||||||
|
add_sample_data(sample, POSEIDON_SETPOINT, prev_setpoint);
|
||||||
finish_sample(dc);
|
finish_sample(dc);
|
||||||
|
|
||||||
if (!lineptr || !*lineptr)
|
if (!lineptr || !*lineptr)
|
||||||
|
|
Loading…
Add table
Reference in a new issue