[chronojump] Wichro know which photocell is before the biggest contact (50% done)



commit 3e06e5579f098e578fa4e0a1ef0f983469a65ed6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Apr 14 11:32:31 2022 +0200

    Wichro know which photocell is before the biggest contact (50% done)

 src/execute/run.cs        |  9 +++++----
 src/execute/runObjects.cs | 35 ++++++++++++++++++++++++++---------
 2 files changed, 31 insertions(+), 13 deletions(-)
---
diff --git a/src/execute/run.cs b/src/execute/run.cs
index 65bbf0a6d..857c9007a 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -427,7 +427,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                                //prevent double contact stuff
                                                if(runDC.UseDoubleContacts())
                                                {
-                                                       runDC.DoneTF (timestamp);
+                                                       runDC.DoneTF (timestamp, photocell);
                                                        timerLastTf = DateTime.Now;
                                                        needCheckIfTrackEnded = true;
                                                } else
@@ -475,7 +475,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                                 * other double contacts that will come just after
                                                 * depending on biggest tc
                                                 */
-                                               runDC.DoneTC(timestamp, false);
+                                               runDC.DoneTC(timestamp, false, photocell);
                                                runPTL.AddTC(photocell, timestamp);
 
                                                feedbackMessage = "";
@@ -491,7 +491,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                                        lastTc = timestamp / 1000.0;
                                                        runEI.ChangePhase(photocell, 
RunExecuteInspector.Phases.OUT,
                                                                string.Format("SpeedStartArrival, tc = {0}", 
Math.Round(lastTc, 3)));
-                                                       runDC.DoneTC(timestamp, true);
+                                                       runDC.DoneTC(timestamp, true, photocell);
                                                        runPTL.AddTC(photocell, timestamp);
                                                }
 
@@ -502,7 +502,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                                                string.Format("SpeedStartArrival, timestamp = 
{0}", timestamp));
 
                                                if(runDC.UseDoubleContacts())
-                                                       runDC.DoneTC(timestamp, true);
+                                                       runDC.DoneTC(timestamp, true, photocell);
                                                else
                                                        lastTc = timestamp / 1000.0;
 
@@ -691,6 +691,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                        }
 
                        trackTime = runDC.GetTrackTimeInSecondsAndUpdateStartPos(); //will come in seconds
+                       LogB.Information("WWWWW photocell is: " + runDC.GetPhotocellAtStartPos());
                        runDC.FirstTrackDone = true;
                }
                else {
diff --git a/src/execute/runObjects.cs b/src/execute/runObjects.cs
index 15068f0d7..7ceca3101 100644
--- a/src/execute/runObjects.cs
+++ b/src/execute/runObjects.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2018  Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2022  Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -30,12 +30,14 @@ public class RunPhaseInfo
        public Types type;
        public double startMSInSequence; //unused right now
        public double duration;
+       public int photocell; //for Wichro (non Wichro will be -1)
 
-       public RunPhaseInfo (Types type, double startMSInSequence, double duration)
+       public RunPhaseInfo (Types type, double startMSInSequence, double duration, int photocell)
        {
                this.type = type;
                this.startMSInSequence = startMSInSequence;
                this.duration = duration;
+               this.photocell = photocell;
        }
 
        public bool IsContact()
@@ -49,8 +51,8 @@ public class RunPhaseInfo
 
        public override string ToString()
        {
-               return string.Format("type: {0}, startMSInSequence: {1}, duration: {2}",
-                               type, startMSInSequence, duration);
+               return string.Format("photocell: {0}, type: {1}, startMSInSequence: {2}, duration: {3}",
+                               photocell, type, startMSInSequence, duration);
        }
 
 }
@@ -64,6 +66,7 @@ public class RunPhaseInfoManage
        //TCs and TFs before startPos have been added as tracks
        //do not count again in track operations
        private int startPos;
+//     private int startPosPhotocell; //photocell at startPos
 
        public RunPhaseInfoManage (int checkTime)
        {
@@ -71,6 +74,7 @@ public class RunPhaseInfoManage
 
                list = new List<RunPhaseInfo>();
                startPos = 0;
+//             startPosPhotocell = -1;
                TrackDoneHasToBeCalledAgain = false;
        }
 
@@ -306,6 +310,14 @@ public class RunPhaseInfoManage
                startPos = bigTCPosition;
        }
 
+       public int GetPhotocellAtStartPos ()
+       {
+               if(startPos >= list.Count)
+                       return -1;
+
+               return ((RunPhaseInfo) list[startPos]).photocell;
+       }
+
        public string PrintList()
        {
                string str = "\n";
@@ -406,25 +418,25 @@ public class RunDoubleContact
                return (mode != Constants.DoubleContact.NONE);
        }
 
-       public void DoneTC (double timestamp, bool timeStarted)
+       public void DoneTC (double timestamp, bool timeStarted, int photocell)
        {
                LogB.Information("DONETC timestamp: " + timestamp + timestamp.ToString());
                lastTc = timestamp;
-               listCaptureThread.Add(new RunPhaseInfo(RunPhaseInfo.Types.CONTACT, timeAcumulated, 
timestamp));
+               listCaptureThread.Add(new RunPhaseInfo(RunPhaseInfo.Types.CONTACT, timeAcumulated, timestamp, 
photocell));
                if(timeStarted)
                        timeAcumulated += timestamp;
 
                LogB.Information(string.Format("DoneTC -> lastTc: {0}", lastTc));
        }
 
-       public void DoneTF (double timestamp)
+       public void DoneTF (double timestamp, int photocell)
        {
                LogB.Information("DONETF timestamp: " + timestamp + timestamp.ToString());
                LogB.Information(string.Format(
                                        "lastTc + timestamp <= checkTime ?, lastTc: {0}; timestamp: {1}; 
checkTime: {2}",
                                        lastTc, timestamp, checkTime));
 
-               listCaptureThread.Add(new RunPhaseInfo(RunPhaseInfo.Types.FLIGHT, timeAcumulated, timestamp));
+               listCaptureThread.Add(new RunPhaseInfo(RunPhaseInfo.Types.FLIGHT, timeAcumulated, timestamp, 
photocell));
                timeAcumulated += timestamp;
        }
 
@@ -484,6 +496,11 @@ public class RunDoubleContact
                rpim.UpdateStartPos(newPos);
        }
 
+       public int GetPhotocellAtStartPos () //TODO; or maybe before
+       {
+               return rpim.GetPhotocellAtStartPos();
+       }
+
        /*
         * <---------------------- end of called by GTK thread --------------
         */
@@ -494,7 +511,7 @@ public class RunDoubleContact
        {
                int bigTCPosition = GetPosOfBiggestTC(true);
                double sum = rpim.SumUntilPos(bigTCPosition, FirstTrackDone, SpeedStart, speedStartArrival);
-               LogB.Information(string.Format("trackDoing getDBBiggestTC bigTCPosition: {0}, Sum: {1}", 
bigTCPosition, sum));
+               LogB.Information(string.Format("trackDoing getDCBiggestTC bigTCPosition: {0}, Sum: {1}", 
bigTCPosition, sum));
 
                //fix problem of a tc + tf lower than checkTime
                if(sum < checkTime)


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