CCR dives: Clear duplicate diluent gas pressure readings (patch 4 of 4)
This patch concludes the calculation of gas pressure readings for CCR dives. dives.c is altered. Duplicate diluent gas pressures are removed from the dive structure and set to zero, as is done for the other gases. Hope there are no whitespace problems. ???? !!!!!!! Signed-off-by: willem ferguson <[email protected]>
>From 7d2842cd838552e971ec24e6d70593596f47a815 Mon Sep 17 00:00:00 2001 From: willem ferguson <[email protected]> Date: Sun, 5 Oct 2014 16:54:19 +0200 Subject: [PATCH 3/3] CCR dives: Clear duplicate diluent gas pressure readings (patch 4 of 4) This patch concludes the calculation of gas pressure readings for CCR dives. dives.c is altered. Duplicate diluent gas pressures are removed from the dive structure and set to zero, as is done for the other gases. Signed-off-by: willem ferguson <[email protected]> --- dive.c | 6 +++++- gaspressures.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dive.c b/dive.c index 1efdede..992299f 100644 --- a/dive.c +++ b/dive.c @@ -1046,7 +1046,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc) int maxdepth = dc->maxdepth.mm; int mintemp = 0; int lastdepth = 0; - int lasttemp = 0, lastpressure = 0; + int lasttemp = 0, lastpressure = 0, lastdiluentpressure = 0; int pressure_delta[MAX_CYLINDERS] = { INT_MAX, }; /* Fixup duration and mean depth */ @@ -1059,12 +1059,15 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc) int depth = sample->depth.mm; int temp = sample->temperature.mkelvin; int pressure = sample->cylinderpressure.mbar; + int diluent_pressure = sample->diluentpressure.mbar; int index = sample->sensor; if (index == lastindex) { /* Remove duplicate redundant pressure information */ if (pressure == lastpressure) sample->cylinderpressure.mbar = 0; + if (diluent_pressure == lastdiluentpressure) + sample->diluentpressure.mbar = 0; /* check for simply linear data in the samples +INT_MAX means uninitialized, -INT_MAX means not linear */ if (pressure_delta[index] != -INT_MAX && lastpressure) { @@ -1082,6 +1085,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc) } lastindex = index; lastpressure = pressure; + lastdiluentpressure = diluent_pressure; if (depth > SURFACE_THRESHOLD) { if (depth > maxdepth) diff --git a/gaspressures.c b/gaspressures.c index 3155a90..d21a19a 100644 --- a/gaspressures.c +++ b/gaspressures.c @@ -22,6 +22,8 @@ #include "profile.h" #include "gaspressures.h" +//#define PRINT_PRESSURES_DEBUG 1 + static pr_track_t *pr_track_alloc(int start, int t_start) { pr_track_t *pt = malloc(sizeof(pr_track_t)); -- 1.9.1
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
