[chronojump/FS-TFT-Menu] Wichro CairoBars show photocell cut at edges of each bar



commit fb92255a2c10cf271e4601c10b6eb7db0d3f6c73
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 20 11:12:35 2022 +0200

    Wichro CairoBars show photocell cut at edges of each bar

 src/execute/run.cs    | 18 +++++++++++++++---
 src/gui/cairo/bars.cs | 25 +++++++++++++++++++------
 2 files changed, 34 insertions(+), 9 deletions(-)
---
diff --git a/src/execute/run.cs b/src/execute/run.cs
index 4bb21d1eb..f2c93ad89 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -697,12 +697,24 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                                runDC.UpdateStartPos(1);
                                        }
                                }
-
                        }
 
+                       //store because runDC.GetTrackTimeInSecondsAndUpdateStartPos() will change it
+                       int photocellAtStartPos = runDC.GetPhotocellAtStartPos();
+
                        trackTime = runDC.GetTrackTimeInSecondsAndUpdateStartPos(); //will come in seconds
-                       LogB.Information("Wichro photocell is: " + runDC.GetPhotocellAtStartPos());
-                       photocell_l.Add(runDC.GetPhotocellAtStartPos());
+
+                       //add photocell to photocell_l
+                       if(trackTime != 0)
+                       {
+                               if(photocell_l.Count == 0)
+                               {
+                                       photocell_l.Add(photocellAtStartPos);
+                                       LogB.Information("photocell_l.Add at start photocell_l: " + 
photocellAtStartPos.ToString());
+                               }
+                               photocell_l.Add(runDC.GetPhotocellAtStartPos());
+                               LogB.Information("photocell_l.Add photocell_l: " + 
runDC.GetPhotocellAtStartPos().ToString());
+                       }
 
                        runDC.FirstTrackDone = true;
                }
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index 3d8568129..58227875b 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -638,14 +638,27 @@ public abstract class CairoBars : CairoGeneric
 
        protected void plotEdgeBarNums ()
        {
-               for(int i = 0; i < barsXCenter_l.Count; i ++)
-                       if (edgeBarNums_l.Count > 0 && edgeBarNums_l.Count > i && edgeBarNums_l[i] >= 0) 
//not show the non-Wichro -1s
-                       {
-                               printTextInBar(barsXCenter_l[i] +barWidth/2, graphHeight -bottomMargin -10,
-                                               0, textHeight+2, edgeBarNums_l[i].ToString(), g, true, true);
-                       }
+               if (edgeBarNums_l.Count == 0)
+                       return;
+
+               int eCount = 0; //edgeBarNums_l
+
+               //1st edgeBarNums is the beginning (at left of first photocell)
+               if(edgeBarNums_l.Count == barsXCenter_l.Count +1)
+               {
+                       if (edgeBarNums_l[0] >= 0) //not show the non-Wichro -1s
+                               printTextInBar(barsXCenter_l[0] -barWidth/2, graphHeight -bottomMargin -10,
+                                               0, textHeight+2, edgeBarNums_l[0].ToString(), g, true, true);
+                       eCount = 1;
+               }
+
+               for(int bCount = 0; bCount < barsXCenter_l.Count && eCount < edgeBarNums_l.Count; bCount ++, 
eCount ++)
+                       if (edgeBarNums_l[eCount] >= 0) //not show the non-Wichro -1s
+                               printTextInBar(barsXCenter_l[bCount] +barWidth/2, graphHeight -bottomMargin 
-10,
+                                               0, textHeight+2, edgeBarNums_l[eCount].ToString(), g, true, 
true);
        }
 
+
        protected void plotAlternativeLine (List<double> lineData_l)
        {
                //be safe


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