[chronojump] Ensure initialization of encoder capure variables before start threads



commit 91aab572852642c58c253e2279de97dfcb09c917
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Oct 24 21:06:17 2016 +0200

    Ensure initialization of encoder capure variables before start threads

 src/gui/encoder.cs |   65 ++++++++++++++++++++++++++-------------------------
 1 files changed, 33 insertions(+), 32 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 3d91892..bbe16b3 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -2104,28 +2104,6 @@ public partial class ChronoJumpWindow
        //I suppose reading gtk is ok, changing will be the problem
        private void encoderDoCaptureCsharp () 
        {
-               UtilGtk.ComboGetActive(combo_encoder_exercise_capture);
-
-               if(encoderConfigurationCurrent.has_inertia)
-                       eCapture = new EncoderCaptureInertial();
-               else
-                       eCapture = new EncoderCaptureGravitatory();
-               
-               int recordingTime = preferences.encoderCaptureTime;
-               if(radio_encoder_capture_cont.Active)  {
-                       recordingTime = 0;
-                       encoderProcessFinishContMode = false; //will be true when finish button is pressed
-               }
-               
-               eCapture.InitGlobal( 
-                               encoder_capture_signal_drawingarea.Allocation.Width,
-                               encoder_capture_signal_drawingarea.Allocation.Height,
-                               recordingTime, 
-                               preferences.encoderCaptureInactivityEndTime,
-                               radio_encoder_capture_cont.Active,
-                               findEccon(true),
-                               chronopicRegister.ConnectedOfType(ChronopicRegisterPort.Types.ENCODER).Port
-                               );
                bool capturedOk = eCapture.Capture(
                                UtilEncoder.GetEncoderDataTempFileName(),
                                encoderRProcCapture
@@ -2150,16 +2128,6 @@ public partial class ChronoJumpWindow
        //I suppose reading gtk is ok, changing will be the problem
        private void encoderDoCaptureCsharpIM () 
        {
-               eCapture = new EncoderCaptureIMCalc();
-               eCapture.InitGlobal( 
-                               encoder_capture_signal_drawingarea.Allocation.Width,
-                               encoder_capture_signal_drawingarea.Allocation.Height,
-                               preferences.encoderCaptureTimeIM,
-                               preferences.encoderCaptureInactivityEndTime,
-                               false,
-                               findEccon(true),
-                               chronopicRegister.ConnectedOfType(ChronopicRegisterPort.Types.ENCODER).Port
-                               );
                bool capturedOk = eCapture.Capture(
                                UtilEncoder.GetEncoderDataTempFileName(),
                                encoderRProcCapture
@@ -4612,10 +4580,43 @@ public partial class ChronoJumpWindow
 
                                needToRefreshTreeviewCapture = false;
 
+                               if(encoderConfigurationCurrent.has_inertia)
+                                       eCapture = new EncoderCaptureInertial();
+                               else
+                                       eCapture = new EncoderCaptureGravitatory();
+
+                               int recordingTime = preferences.encoderCaptureTime;
+                               if(radio_encoder_capture_cont.Active)  {
+                                       recordingTime = 0;
+                                       encoderProcessFinishContMode = false; //will be true when finish 
button is pressed
+                               }
+
+                               eCapture.InitGlobal(
+                                               encoder_capture_signal_drawingarea.Allocation.Width,
+                                               encoder_capture_signal_drawingarea.Allocation.Height,
+                                               recordingTime,
+                                               preferences.encoderCaptureInactivityEndTime,
+                                               radio_encoder_capture_cont.Active,
+                                               findEccon(true),
+                                               
chronopicRegister.ConnectedOfType(ChronopicRegisterPort.Types.ENCODER).Port
+                                               );
+
                                encoderThread = new Thread(new ThreadStart(encoderDoCaptureCsharp));
                                GLib.Idle.Add (new GLib.IdleHandler (pulseGTKEncoderCaptureAndCurves));
                        }
                        else { //action == encoderActions.CAPTURE_IM)
+
+                               eCapture = new EncoderCaptureIMCalc();
+                               eCapture.InitGlobal(
+                                               encoder_capture_signal_drawingarea.Allocation.Width,
+                                               encoder_capture_signal_drawingarea.Allocation.Height,
+                                               preferences.encoderCaptureTimeIM,
+                                               preferences.encoderCaptureInactivityEndTime,
+                                               false,
+                                               findEccon(true),
+                                               
chronopicRegister.ConnectedOfType(ChronopicRegisterPort.Types.ENCODER).Port
+                                               );
+
                                encoderThread = new Thread(new ThreadStart(encoderDoCaptureCsharpIM));
                                GLib.Idle.Add (new GLib.IdleHandler (pulseGTKEncoderCaptureIM));
                        }


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