[chronojump] Revalibrate encoder puts zero value instead of restarting thread



commit a3f2ab72d0e9532bdb28f567d407588aa006526d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jan 26 11:43:26 2017 +0100

    Revalibrate encoder puts zero value instead of restarting thread

 src/encoderCaptureInertialBG.cs |    1 +
 src/gui/encoder.cs              |   13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/encoderCaptureInertialBG.cs b/src/encoderCaptureInertialBG.cs
index 59487c3..3762a53 100644
--- a/src/encoderCaptureInertialBG.cs
+++ b/src/encoderCaptureInertialBG.cs
@@ -87,6 +87,7 @@ public class EncoderCaptureInertialBackground
        public int AngleNow
        {
                get { return angleNow; }
+               set { angleNow = value; } //if user recalibrates again
        }
 
        public void FinishBG()
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 64bea58..c591749 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -626,13 +626,14 @@ public partial class ChronoJumpWindow
                if(! canCaptureEncoder())
                        return;
 
-               // stop capturing inertial on the background if we calibrate again
+               /*
+                * if user calibrates again: put 0 value
+                * if calibration was not running: start it
+                */
                if(encoderThreadBG != null && encoderThreadBG.IsAlive)
-               {
-                       stopCapturingInertialBG();
-               }
-
-               encoderThreadStart(encoderActions.CAPTURE_BG);
+                       eCaptureInertialBG.AngleNow = 0;
+               else
+                       encoderThreadStart(encoderActions.CAPTURE_BG);
        }
 
        double maxPowerIntersessionOnCapture;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]