Permalink
Browse files

protection against NaN values

  • Loading branch information...
1 parent e15ee65 commit 13f1820c1899b745ec32ceb4969c6989a0cdb647 Marije Baalman committed Feb 16, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 app/src/com/steim/nescivi/android/gvb/VelocityEstimator.java
@@ -740,7 +740,9 @@ public void updateVelocityMeasurement(){
// reset offsets when we are in still:
if ( this.mState == 0 ) {
for ( int axis = 0; axis < 3; axis++ ){
- this.mOffsets[axis] = this.mOffsets[axis] * macoef + curStats[0][axis] * (1-macoef);
+ if ( curStats[0][axis] < 20.f ){
+ this.mOffsets[axis] = this.mOffsets[axis] * macoef + curStats[0][axis] * (1-macoef);
+ }
}
}

0 comments on commit 13f1820

Please sign in to comment.