summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2011-09-29 22:49:12 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2011-09-29 22:53:03 -0700
commitab3c6731bea1043e35d450b227fc2f41e137c397 (patch)
treedf1092b73d23b21c543b9c9c2a347d037cdc9bf2
parent775a081769d2969e449feead164a82cbe53d9b7e (diff)
downloadsubsurface-ab3c6731bea1043e35d450b227fc2f41e137c397.tar.gz
Fix the profile coloring
We were missing the last sample (which is usually a fast ascent). Also, reduced the velocity smoothing to 15 seconds as the 30 seconds were hiding too much valid information Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--profile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/profile.c b/profile.c
index 23ff4910c..2edaf694c 100644
--- a/profile.c
+++ b/profile.c
@@ -624,7 +624,7 @@ static struct plot_info *analyze_plot_info(struct plot_info *pi)
}
/* Smoothing function: 5-point triangular smooth */
- for (i = 2; i < nr-1; i++) {
+ for (i = 2; i < nr; i++) {
struct plot_data *entry = pi->entry+i;
int val;
@@ -637,9 +637,9 @@ static struct plot_info *analyze_plot_info(struct plot_info *pi)
if (entry[0].sec - entry[-1].sec) {
entry->velocity = velocity((entry[0].val - entry[-1].val) / (entry[0].sec - entry[-1].sec));
/* if our samples are short and we aren't too FAST*/
- if (entry[0].sec - entry[-1].sec < 30 && entry->velocity < FAST) {
+ if (entry[0].sec - entry[-1].sec < 15 && entry->velocity < FAST) {
int past = -2;
- while (i+past > 0 && entry[0].sec - entry[past].sec < 30)
+ while (i+past > 0 && entry[0].sec - entry[past].sec < 15)
past--;
entry->velocity = velocity((entry[0].val - entry[past].val) /
(entry[0].sec - entry[past].sec));