diff options
-rw-r--r-- | dive.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -614,8 +614,15 @@ static void merge_one_sample(struct sample *sample, int time, struct divecompute int last = dc->samples-1; if (last >= 0) { static struct sample surface; - int last_time = dc->sample[last].time.seconds; - if (time > last_time + 60) { + struct sample *prev = dc->sample + last; + int last_time = prev->time.seconds; + int last_depth = prev->depth.mm; + + /* + * Only do surface events if the samples are more than + * a minute apart, and shallower than 5m + */ + if (time > last_time + 60 && last_depth < 5000) { add_sample(&surface, last_time+20, dc); add_sample(&surface, time - 20, dc); } |