Display values in info box only if value is interesting

Type duration_t changed from uint to int.

Default value of '-1' introduced for some of the values in struct sample:
NDL used -1 as default.
Bearing uses -1 as default (no bearing set).

Display pXX, EAD, END, density, MOD only if values are larger than 0.

In profile don't display data from two first and two last plot_data
entries in info box.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-11-05 15:56:35 +01:00 committed by Dirk Hohndel
parent de81effb25
commit 1f8506ce64
5 changed files with 61 additions and 47 deletions

View file

@ -753,6 +753,10 @@ struct sample *prepare_sample(struct divecomputer *dc)
sample->sensor[0] = sample[-1].sensor[0];
sample->sensor[1] = sample[-1].sensor[1];
}
// Init some values with -1
sample->bearing.degrees = -1;
sample->ndl.seconds = -1;
return sample;
}
return NULL;
@ -1261,12 +1265,12 @@ static void fixup_meandepth(struct dive *dive)
static void fixup_duration(struct dive *dive)
{
struct divecomputer *dc;
unsigned int duration = 0;
duration_t duration = { };
for_each_dc (dive, dc)
duration = MAX(duration, dc->duration.seconds);
duration.seconds = MAX(duration.seconds, dc->duration.seconds);
dive->duration.seconds = duration;
dive->duration.seconds = duration.seconds;
}
/*