[chronojump] Photocells show which photocell made the contact on PhaseTime



commit 878b554cb5cd6f787856429fd79bb1c6816ddb27
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Aug 22 12:49:35 2021 +0200

    Photocells show which photocell made the contact on PhaseTime

 src/execute/event.cs      | 11 +++++++++--
 src/execute/run.cs        |  8 ++++----
 src/execute/runObjects.cs |  8 ++++----
 3 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/execute/event.cs b/src/execute/event.cs
index 3ed08053d..cea4cb91c 100644
--- a/src/execute/event.cs
+++ b/src/execute/event.cs
@@ -626,13 +626,16 @@ public class EventExecute
           
 }
 
+//currently only used for photocells
 public class PhaseTime
 {
+       private int photocell; //on not inalambric is -1
        private bool contactIn;
        private double duration;
 
-       public PhaseTime (bool contactIn, double duration)
+       public PhaseTime (int photocell, bool contactIn, double duration)
        {
+               this.photocell = photocell;
                this.contactIn = contactIn;
                this.duration = duration;
        }
@@ -643,8 +646,12 @@ public class PhaseTime
                if(! contactIn)
                        strMode = "OUT (TF)";
 
+               string photocellStr = "";
+               if(photocell >= 0)
+                       photocellStr = string.Format(" - {0}", photocell);
+
                //TODO: use a printf mode to have always same digits
-               return "\n" + Math.Round(UtilAll.DivideSafe(duration, 1000.0), 3) + " - " + strMode;
+               return "\n" + Math.Round(UtilAll.DivideSafe(duration, 1000.0), 3) + photocellStr + " - " + 
strMode;
        }
 
        public bool IsContact
diff --git a/src/execute/run.cs b/src/execute/run.cs
index 69f07a8da..eae4e8273 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -434,7 +434,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                                runEI.ChangePhase(photocell, RunExecuteInspector.Phases.IN,
                                                                string.Format("Arrived (preparing track) 
timestamp: {0}", Math.Round(timestamp, 3)));
 
-                                               runPTL.AddTF(timestamp);
+                                               runPTL.AddTF(photocell, timestamp);
                                        }
                                }
                                else if (has_lifted()) // timestamp is tc
@@ -470,7 +470,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                                 * depending on biggest tc
                                                 */
                                                runDC.DoneTC(timestamp, false);
-                                               runPTL.AddTC(timestamp);
+                                               runPTL.AddTC(photocell, timestamp);
 
                                                feedbackMessage = "";
                                                needShowFeedbackMessage = true;
@@ -486,7 +486,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                                        runEI.ChangePhase(photocell, 
RunExecuteInspector.Phases.OUT,
                                                                string.Format("SpeedStartArrival, tc = {0}", 
Math.Round(lastTc, 3)));
                                                        runDC.DoneTC(timestamp, true);
-                                                       runPTL.AddTC(timestamp);
+                                                       runPTL.AddTC(photocell, timestamp);
                                                }
 
                                                feedbackMessage = "";
@@ -500,7 +500,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                                else
                                                        lastTc = timestamp / 1000.0;
 
-                                               runPTL.AddTC(timestamp);
+                                               runPTL.AddTC(photocell, timestamp);
 
                                                onlyInterval_SetRSAVariables();
                                        }
diff --git a/src/execute/runObjects.cs b/src/execute/runObjects.cs
index 60b6d5e4a..50680873f 100644
--- a/src/execute/runObjects.cs
+++ b/src/execute/runObjects.cs
@@ -529,14 +529,14 @@ public class RunPhaseTimeList
                FirstRPIs = 0;
        }
        
-       public void AddTC(double timestamp)
+       public void AddTC(int photocell, double timestamp)
        {
-               listPhaseTime.Add(new PhaseTime(true, timestamp));
+               listPhaseTime.Add(new PhaseTime(photocell, true, timestamp));
        }
 
-       public void AddTF(double timestamp)
+       public void AddTF(int photocell, double timestamp)
        {
-               listPhaseTime.Add(new PhaseTime(false, timestamp));
+               listPhaseTime.Add(new PhaseTime(photocell, false, timestamp));
        }
 
        public override string ToString()


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