aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar John Van Ostrand <john@vanostrand.com>2017-05-31 22:08:48 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-31 21:54:05 -0700
commit40f5e2e30c42d539f0c58d2d1577c36fdc85d153 (patch)
tree0cfeaec0c64c26fab7968fab26c652c887e88d7c
parent3ca11912514c1986b812231b1097c6a94cb16bf4 (diff)
downloadsubsurface-40f5e2e30c42d539f0c58d2d1577c36fdc85d153.tar.gz
Cochran import: Removed long tail of 0 depth from profile
The Cochran logs the first 10 to 20 minutes (configurable) of surface interval in case the diver re-submerges. Signed-off-by: John Van Ostrand <john@vanostrand.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/cochran.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/cochran.c b/core/cochran.c
index 462d3e526..5ee6fd611 100644
--- a/core/cochran.c
+++ b/core/cochran.c
@@ -644,6 +644,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
unsigned int sample_size = size - 0x4914 - config.logbook_size;
int g;
+ unsigned int sample_pre_offset = 0, sample_end_offset = 0;
// Decode sample data
partial_decode(0x4914 + config.logbook_size, size, decode,
@@ -715,6 +716,9 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
if (log[CMD_MAX_DEPTH] == 0xff && log[CMD_MAX_DEPTH + 1] == 0xff)
corrupt_dive = 1;
+ sample_pre_offset = array_uint32_le(log + CMD_PREDIVE_OFFSET);
+ sample_end_offset = array_uint32_le(log + CMD_END_OFFSET);
+
break;
case TYPE_EMC:
dc->model = "EMC";
@@ -756,9 +760,17 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
if (log[EMC_MAX_DEPTH] == 0xff && log[EMC_MAX_DEPTH + 1] == 0xff)
corrupt_dive = 1;
+ sample_pre_offset = array_uint32_le(log + EMC_PREDIVE_OFFSET);
+ sample_end_offset = array_uint32_le(log + EMC_END_OFFSET);
+
break;
}
+ // Use the log information to determine actual profile sample size
+ // Otherwise we will get surface time at end of dive.
+ if (sample_pre_offset < sample_end_offset && sample_end_offset != 0xffffffff)
+ sample_size = sample_end_offset - sample_pre_offset;
+
cochran_parse_samples(dive, buf + 0x4914, buf + 0x4914
+ config.logbook_size, sample_size,
&duration, &max_depth, &avg_depth, &min_temp);