[chronojump] Encoder fixed showNRepetitions on ec at capture



commit 88c284ab6f50eb2356aa41a0f58067e47fe9ab5a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Jul 22 13:27:17 2019 +0200

    Encoder fixed showNRepetitions on ec at capture

 src/gui/encoder.cs | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 8cdaf0ff..333156fd 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -5140,17 +5140,44 @@ public partial class ChronoJumpWindow
                int graphWidth=encoder_capture_curves_bars_drawingarea.Allocation.Width;
                int graphHeight=encoder_capture_curves_bars_drawingarea.Allocation.Height;
        
+               string eccon = findEccon(true);
                ArrayList data = new ArrayList (data6Variables.Count);
                int count = 0;
                int showNRepetitions = preferences.encoderCaptureShowNRepetitions;
+               bool lastIsEcc = false;
 
+               //discard repetitions according to showNRepetitions
                foreach(EncoderBarsData ebd in data6Variables)
                {
+                       LogB.Information(string.Format("count: {0}, value: {1}", count, 
ebd.GetValue(mainVariable)));
                        //when capture ended, show all repetitions
                        if(showNRepetitions == -1 || ! capturing)
                                data.Add(ebd.GetValue(mainVariable));
-                       else if(data6Variables.Count <= showNRepetitions || count >= data6Variables.Count - 
showNRepetitions)
-                               data.Add(ebd.GetValue(mainVariable));
+                       else {
+                               if(eccon == "c" && ( data6Variables.Count <= showNRepetitions ||        
//total repetitions are less than show repetitions threshold ||
+                                               count >= data6Variables.Count - showNRepetitions ) )    
//count is from the last group of reps (reps that have to be shown)
+                               {
+                                       data.Add(ebd.GetValue(mainVariable));
+                               }
+                               else if(eccon != "c" && (
+                                               data6Variables.Count <= 2 * showNRepetitions ||
+                                               count >= data6Variables.Count - 2 * showNRepetitions) )
+                               {
+                                       if(! Util.IsEven(count +1))     //if it is "impar"
+                                       {
+                                               LogB.Information("added ecc");
+                                               data.Add(ebd.GetValue(mainVariable));
+                                               lastIsEcc = true;
+                                       } else {                        //it is "par"
+                                               if(lastIsEcc)
+                                               {
+                                                       data.Add(ebd.GetValue(mainVariable));
+                                                       LogB.Information("added con");
+                                                       lastIsEcc = false;
+                                               }
+                                       }
+                               }
+                       }
                        count ++;
                }
                count = 0;
@@ -5166,8 +5193,6 @@ public partial class ChronoJumpWindow
                double countValid = 0;
                double sumValid = 0;
 
-               string eccon = findEccon(true);
-
                foreach(double d in data)
                {
                        if(d > maxThisSet)


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