summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-10-07 21:49:55 -0700
committerKeith Packard <keithp@keithp.com>2013-10-07 21:49:55 -0700
commit71666409624bf544e8a55fa5ee91d2f8514a03ca (patch)
tree1bead2101dd0a172c560be85f762da1821cc46d0
parent8bd218854e968d2b9407489359be0c4a1aefd2c8 (diff)
Change differentiation filter constants and limits
Larger limits avoids clipping legit data. Using the same filter time for both ascent and descent makes the results look a bit cleaner. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altoslib/AltosState.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java
index a9bb1e70..a01cddb7 100644
--- a/altoslib/AltosState.java
+++ b/altoslib/AltosState.java
@@ -29,8 +29,8 @@ public class AltosState implements Cloneable {
public int set;
- static final double ascent_filter_len = 0.1;
- static final double descent_filter_len = 2.0;
+ static final double ascent_filter_len = 0.5;
+ static final double descent_filter_len = 0.5;
/* derived data */
@@ -49,7 +49,6 @@ public class AltosState implements Cloneable {
private double max_value;
private double set_time;
private double prev_set_time;
- private double max_rate = 1000.0;
void set(double new_value, double time) {
if (new_value != AltosLib.MISSING) {
@@ -125,12 +124,14 @@ public class AltosState implements Cloneable {
double ddt = in.time() - pt;
double ddv = (n - p) / ddt;
+ final double max = 100000;
+
/* 100gs */
- if (Math.abs(ddv) > 1000) {
+ if (Math.abs(ddv) > max) {
if (n > p)
- n = p + ddt * 1000;
+ n = p + ddt * max;
else
- n = p - ddt * 1000;
+ n = p - ddt * max;
}
double filter_len;