[chronojump] Fixed run interval capture (time limited) since double 1.8.1



commit aaeee3559877f856ab70ff0544e1e726a49323ad
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon May 28 17:57:13 2018 +0200

    Fixed run interval capture (time limited) since double 1.8.1

 src/execute/run.cs | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/src/execute/run.cs b/src/execute/run.cs
index c4800e39..ce8f16ef 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -843,6 +843,7 @@ public class RunIntervalExecute : RunExecute
                distanceIntervalFixed = distanceInterval;
                tracks = 0;
                countForSavingTempTable = 0;
+               finishByTimeReturnedTrueAtThisCapture = false;
 
                //initialize eventDone as a RunInterval
                eventDone = new RunInterval();
@@ -1000,20 +1001,37 @@ public class RunIntervalExecute : RunExecute
 
        }
 
-       protected override bool shouldFinishByTime() {
+       static bool finishByTimeReturnedTrueAtThisCapture;
+       protected override bool shouldFinishByTime()
+       {
+               //do not call FinishDo n times while waiting catchedTimeOut there
+               if(finishByTimeReturnedTrueAtThisCapture)
+                       return false;
+
                //check if it should finish now (time limited, not unlimited and time exceeded)
                //check that the run started
                //if( ! tracksLimited && limitAsDouble != -1 && timerCount > limitAsDouble 
-               if( ! tracksLimited && limitAsDouble != -1 && Util.GetTotalTime(intervalTimesString) > 
limitAsDouble 
+               if( ! tracksLimited && limitAsDouble != -1
                                && !(runPhase == runPhases.PRE_RUNNING) 
                                && !(runPhase == runPhases.PLATFORM_INI_NO_TIME)
                                && !(runPhase == runPhases.PLATFORM_INI_YES_TIME)
+                               && timerLastTf > DateTime.MinValue
+                               && (Util.GetTotalTime(intervalTimesString) + (DateTime.Now - 
timerLastTf).TotalSeconds) > limitAsDouble
                                ) 
+               {
+                       LogB.Information("shouldFinishByTime finishes Chronopic calling FinishDo");
+                       //as we will be on waitEvent do { ok = cp.Read_event ... }
+                       //call this to end Read_cambio called by Read_event
+                       Chronopic.FinishDo();
+
+                       finishByTimeReturnedTrueAtThisCapture = true;
+
                        return true;
+               }
                else
                        return false;
        }
-       
+
        protected override void updateTimeProgressBar() {
                /* 4 situations:
                 *   1- if we start out and have not arrived to platform, it should be a pulse with no time 
value on label:


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