[chronojump] enc capt reorg and new features DONE: ecc-con always (also on R inertial capture), inertial feedback



commit 367e1bd66eb048ed5f819f27485f55b57ec3982c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 31 14:49:54 2016 +0200

    enc capt reorg and new features DONE: ecc-con always (also on R inertial capture), inertial feedback at 
end concentric, inertial capture graph with two lines, 1st ecc inertial on gray

 src/encoderCapture.cs |   30 +++---------------------------
 src/gui/encoder.cs    |   34 ++++++++++++++--------------------
 2 files changed, 17 insertions(+), 47 deletions(-)
---
diff --git a/src/encoderCapture.cs b/src/encoderCapture.cs
index e299ee4..0e53931 100644
--- a/src/encoderCapture.cs
+++ b/src/encoderCapture.cs
@@ -66,7 +66,6 @@ public abstract class EncoderCapture
        protected int directionNow;
        protected int directionLastMSecond;
        protected int directionCompleted;
-//     protected int previousFrameChange;
        protected int previousEnd;
        protected int lastNonZero;
 
@@ -162,7 +161,6 @@ public abstract class EncoderCapture
                directionNow = 1;               // +1 or -1
                directionLastMSecond = 1;       // +1 or -1 (direction on last millisecond)
                directionCompleted = -1;        // +1 or -1
-               //previousFrameChange = 0;
                previousEnd = 0;
                lastNonZero = 0;
                
@@ -301,17 +299,13 @@ public abstract class EncoderCapture
                                        if(startFrame < 0)
                                                startFrame = 0;
 
-//                                     bool previousWasUp = ! Util.IntToBool(directionNow); //if we go now 
UP, then record previous DOWN phase
                                        ecc = new EncoderCaptureCurve(
-//                                                     previousWasUp,
                                                        startFrame,
                                                        (i - directionChangeCount + lastNonZero)/2      
//endFrame
                                                        //to find endFrame, first substract 
directionChangePeriod from i
                                                        //then find the middle point between that and 
lastNonZero
                                                        //this means that the end is in central point at 
displacements == 0
                                                        );
-//                                     LogB.Information("previousWasUp");
-//                                     LogB.Information(previousWasUp.ToString());
 
                                        //since 1.5.0 secundary thread is capturing and sending data to R 
process
                                        //while main thread is reading data coming from R and updating GUI
@@ -440,12 +434,9 @@ public abstract class EncoderCapture
        }
 
        /*
-TODO: 
-       a) en inercial concentric falta que surti la primera curva. Pel previousWasUp sembla que estigui tot 
al reves
-       b) mirar ecc-con
-       c) no agrupar en con-ecc / ecc-con les barres en inercial, fer que estiguin igual a capture que a 
graph. el mes facil seria que al capturar tambe es mostres el ecc-con
-       d) que el -25 no sigui un -25 sino que depengui del que l' usuari tingui seleccionat i la config del 
encoder. caldria posar lo de espai de les encoderConfigs de util.R aqui
-*/
+        * TODO: 
+        * que el -25 no sigui un -25 sino que depengui del que l' usuari tingui seleccionat i la config del 
encoder. caldria posar lo de espai de les encoderConfigs de util.R aqui
+        */
 
 
        // on IMCalc we don't need to send data to R and get curves we will call R at the end
@@ -455,8 +446,6 @@ TODO:
                 * 3) if it's ecc-con, don't record first curve if first curve is concentric
                 * 4) on ec, ecS don't store two curves in the same direction
                */
-               LogB.Information("capturingFirstPhase");
-               LogB.Information(capturingFirstPhase.ToString());
 
                if( eccon == "c" && ! ecc.up )  //2
                        return false;
@@ -475,12 +464,6 @@ TODO:
                                
        protected virtual void markDirectionChanged() 
        {
-               LogB.Debug("i", i.ToString());
-               LogB.Debug("directionChangeCount", directionChangeCount.ToString());
-
-               //previousFrameChange = i - directionChangeCount;
-               //LogB.Debug("previousFrameChange", previousFrameChange.ToString());
-
                directionChangeCount = 0;
                directionCompleted = directionNow;
        }
@@ -663,12 +646,6 @@ public class EncoderCaptureInertial : EncoderCapture
                if(! inertialFirstEccPhaseDone && sum < 25)
                        inertialFirstEccPhaseDone = true;
 
-               LogB.Debug("i", i.ToString());
-               LogB.Debug("directionChangeCount", directionChangeCount.ToString());
-
-               //previousFrameChange = i - directionChangeCount;
-               //LogB.Debug("previousFrameChange", previousFrameChange.ToString());
-
                directionChangeCount = 0;
                directionCompleted = directionNow;
        }
@@ -688,7 +665,6 @@ public class EncoderCaptureInertial : EncoderCapture
                ((IDisposable)writer).Dispose();
        }
        
-       
 }
 
 
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index a688b45..f7fc39b 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -333,7 +333,7 @@ public partial class ChronoJumpWindow
 
  
        Gdk.GC pen_black_encoder_capture;
-       Gdk.GC pen_encoder_capture_inertial_disc;
+       Gdk.GC pen_gray;
 
        Gdk.GC pen_red_encoder_capture;
        Gdk.GC pen_red_dark_encoder_capture;
@@ -3993,7 +3993,7 @@ public partial class ChronoJumpWindow
                                }
 
                        }
-                       encoder_capture_signal_pixmap.DrawPoints(pen_encoder_capture_inertial_disc, 
paintPointsInertial);
+                       encoder_capture_signal_pixmap.DrawPoints(pen_gray, paintPointsInertial);
                }
                
                //paint this after the inertial because this should mask the other
@@ -4196,15 +4196,15 @@ public partial class ChronoJumpWindow
                        if (eccon == "ec" || eccon == "ecS") {
                                bool isEven = Util.IsEven(count +1);
                                
-                               //while capturing on inertial data comes as c,e
-                               //if(capturing && encoderConfigurationCurrent.has_inertia)
-                               //      isEven = ! isEven;
-                               //changed since 1.6.1
-                       
-                               if(isEven) //par, concentric
-                                       my_pen = my_pen_ecc_con_c;
-                               else
-                                       my_pen = my_pen_ecc_con_e;
+                               //on inertial devices "ec" or "ecS", the first ecc has to be gray
+                               if(encoderConfigurationCurrent.has_inertia && count == 0)
+                                       my_pen = pen_gray;
+                               else {
+                                       if(isEven) //par, concentric
+                                               my_pen = my_pen_ecc_con_c;
+                                       else
+                                               my_pen = my_pen_ecc_con_e;
+                               }
                        } else {
                                my_pen = my_pen_con;
                        }
@@ -4233,11 +4233,6 @@ public partial class ChronoJumpWindow
                        if (eccon == "ec" || eccon == "ecS") {
                                bool isEven = Util.IsEven(count +1);
                                
-                               //while capturing on inertial data comes as c,e
-                               //if(capturing && encoderConfigurationCurrent.has_inertia)
-                               //      isEven = ! isEven;
-                               //changed since 1.6.1
-                       
                                if(isEven)
                                        
encoder_capture_curves_bars_pixmap.DrawLine(pen_white_encoder_capture, 
                                                        dLeft, dBottom, dLeft + dWidth, dTop);
@@ -4262,7 +4257,7 @@ public partial class ChronoJumpWindow
                                int myX = Convert.ToInt32( startX - textWidth/2);
                                int myY = Convert.ToInt32(dTop + dHeight + (bottom_margin /2) - textHeight/2);
                                
-                               //plot a rectangle if this curve it is checked (in the near future checked 
will mean saved)
+                               //plot a rectangle if this curve it is saved
                                if(iterOk)
                                        if(((EncoderCurve) encoderCaptureListStore.GetValue (iter, 
0)).Record) {
                                                rect = new Rectangle(myX -2, myY -1, textWidth +4, 
graphHeight - (myY -1) -1);
@@ -4639,7 +4634,7 @@ public partial class ChronoJumpWindow
                layout_encoder_capture_curves_bars_text.FontDescription = Pango.FontDescription.FromString 
("Courier 10");
 
                pen_black_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_encoder_capture_inertial_disc = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
+               pen_gray = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
                pen_red_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
                pen_red_dark_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
                pen_red_light_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
@@ -4668,7 +4663,7 @@ public partial class ChronoJumpWindow
                colormap.AllocColor (ref UtilGtk.SELECTED,true,true);
 
                pen_black_encoder_capture.Foreground = UtilGtk.BLACK;
-               pen_encoder_capture_inertial_disc.Foreground = UtilGtk.GRAY;
+               pen_gray.Foreground = UtilGtk.GRAY;
                pen_red_encoder_capture.Foreground = UtilGtk.RED_PLOTS;
                pen_red_dark_encoder_capture.Foreground = UtilGtk.RED_DARK;
                pen_red_light_encoder_capture.Foreground = UtilGtk.RED_LIGHT;
@@ -4682,7 +4677,6 @@ public partial class ChronoJumpWindow
                pen_selected_encoder_capture.Foreground = UtilGtk.SELECTED;
 
                pen_black_encoder_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast, 
Gdk.JoinStyle.Miter);
-               //pen_encoder_capture_inertial_disc.SetLineAttributes (1, Gdk.LineStyle.OnOffDash, 
Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
                pen_selected_encoder_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast, 
Gdk.JoinStyle.Miter);
                
                LogB.Debug("prepareEncoderGraphs() end");


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