mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
New fixup function fixup_dc_ndl
Fixup the NDL value to '-1' at the very beginning of a dive. Some dive computer report a NDL of 0 at the very beginning of a dive and then only some 10 seconds later they report the correct value like 240 min for the first time. Translate this 0 at the beginning of a dive into our internal '-1' for no info available. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
adbc71f9da
commit
a8d4ff308d
1 changed files with 16 additions and 0 deletions
16
core/dive.c
16
core/dive.c
|
@ -1423,6 +1423,19 @@ static void fixup_dc_depths(struct dive *dive, struct divecomputer *dc)
|
|||
dive->maxdepth.mm = maxdepth;
|
||||
}
|
||||
|
||||
static void fixup_dc_ndl(struct dive *dive, struct divecomputer *dc)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dc->samples; i++) {
|
||||
struct sample *sample = dc->sample + i;
|
||||
if (sample->ndl.seconds != 0)
|
||||
break;
|
||||
if (sample->ndl.seconds == 0)
|
||||
sample->ndl.seconds = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static void fixup_dc_temp(struct dive *dive, struct divecomputer *dc)
|
||||
{
|
||||
int i;
|
||||
|
@ -1640,6 +1653,9 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
|
|||
/* Fix up sample depth data */
|
||||
fixup_dc_depths(dive, dc);
|
||||
|
||||
/* Fix up first sample ndl data */
|
||||
fixup_dc_ndl(dive, dc);
|
||||
|
||||
/* Fix up dive temperatures based on dive computer samples */
|
||||
fixup_dc_temp(dive, dc);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue