[PATCH 2/2] Properly clear sensor pressure data for synthetic plotinfo entries

Linus Torvalds torvalds at linux-foundation.org
Thu Sep 14 12:20:25 PDT 2017


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Thu, 14 Sep 2017 12:14:33 -0700
Subject: [PATCH 2/2] Properly clear sensor pressure data for synthetic plotinfo entries

We only cleared the first sensor data when we created new synthetic plot
info entries, because we only used to have one (well, we had the o2
data, but apparently nobody ever noticed that it didn't get properly
interpolated, probably because people who have CCR dives with o2
pressures are few, and the pressure drops are gradual anyway).

Clear all the pressure data, so that the interpolation code doesn't
think we have some existing real sensor data for the plot info entries
in between proper sample entries.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

This fixes the very odd "sometimes interpolation doesn't work". 

It's a one-liner trivial fix, but figuring it out was annoyingly 
difficult.

 core/profile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/profile.c b/core/profile.c
index af9ebff2..4ff27fcd 100644
--- a/core/profile.c
+++ b/core/profile.c
@@ -494,7 +494,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
 	entry->sec = _time;         \
 	entry->depth = _depth;      \
 	entry->running_sum = (entry - 1)->running_sum + (_time - (entry - 1)->sec) * (_depth + (entry - 1)->depth) / 2; \
-	SENSOR_PRESSURE(entry, 0) = 0; \
+	memset(entry->pressure, 0, sizeof(entry->pressure)); \
 	entry->sac = _sac;          \
 	entry++;                    \
 	idx++
-- 
2.14.1.538.gc8f31819a



More information about the subsurface mailing list