[chronojump] On inertial, end capture also when 2*inactivity endTime since last phase



commit 6b0e1e5709e83425f43f32fee98efb18e4b6213d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Mar 3 18:01:21 2020 +0100

    On inertial, end capture also when 2*inactivity endTime since last phase

 src/encoderCapture.cs  | 11 ++++++++---
 src/gui/preferences.cs |  4 +++-
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/encoderCapture.cs b/src/encoderCapture.cs
index 31af19ba..cb66d59b 100644
--- a/src/encoderCapture.cs
+++ b/src/encoderCapture.cs
@@ -247,6 +247,7 @@ public abstract class EncoderCapture
 
                lastTriggerOn = 0;
                inertialCalibratedFirstCross0Pos = 0;
+               int lastInertialPhase_i = 0;
 
                //only for cutByTriggers == Preferences.TriggerTypes.START_AT_FIRST_ON
                bool firstTriggerHappened = false;
@@ -389,8 +390,9 @@ public abstract class EncoderCapture
                                /*
                                 * process ends
                                 * (
-                                * when a curve has been found and then there are n seconds of inactivity, or
-                                * when not in cont and a curve has not been found and then there are 2*n 
seconds of inactivity
+                                * -> when a curve has been found and then there are n seconds of inactivity, 
or
+                                * -> when not in cont and a curve has not been found and then there are 2*n 
seconds of inactivity
+                                * -> on inertial, if a curve has been found, and now passed double end time 
since last phase (to end when there is no capture but there is "activity" because cone is slowly rolling
                                 * ) and if consecutiveZeros > restClustersSeconds * 1.500
                                 *
                                 * 1500 is conversion to milliseconds and * 1.5 to have enough time to move 
after clusters res
@@ -399,7 +401,8 @@ public abstract class EncoderCapture
                                                automaticallyEndByTime &&
                                                (
                                                 (Ecca.curvesAccepted > 0 && consecutiveZeros >= 
consecutiveZerosMax) ||
-                                                (! cont && Ecca.curvesAccepted == 0 && consecutiveZeros >= 
(2* consecutiveZerosMax))
+                                                (! cont && Ecca.curvesAccepted == 0 && consecutiveZeros >= 
(2* consecutiveZerosMax)) ||
+                                                (inertialCalibrated && Ecca.curvesAccepted > 0 && i - 
lastInertialPhase_i >= (2* consecutiveZerosMax))
                                                ) &&
                                                (restClustersSeconds == 0 || consecutiveZeros > 
restClustersSeconds * 1500)
                                  )
@@ -604,6 +607,8 @@ public abstract class EncoderCapture
                                                        lastDirectionStoredIsUp = ecc.up;
                                                }
 
+                                               if(inertialCalibrated)
+                                                       lastInertialPhase_i = i;
                                        }
 
                                        //on inertial is different
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 49232891..72a669ff 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -1567,7 +1567,9 @@ public class PreferencesWindow
                new DialogMessage(Constants.MessageTypes.INFO, 
                                Catalog.GetString("If a repetition has been found, test will end at selected 
inactivity seconds.") + "\n\n" +
                                Catalog.GetString("If a repetition has not been found, test will end at 
selected inactivity seconds (x2).") + "\n" +
-                               Catalog.GetString("This will let the person to have more time to start 
movement.")
+                               Catalog.GetString("This will let the person to have more time to start 
movement.") + "\n\n" +
+                               "On inertial, to avoid never ending capture because cone is slowly moving at 
the end, this criteria is added:" + "\n" +
+                               "If passed the double of configured inactivity seconds since last phase, 
capture will end."
                                );
        }
 


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