# HG changeset patch
# User StephaneLenclud
# Date 1366307465 -7200
# Node ID 70d865489ff3861b5afe63d9bd53cb052d782172
# Parent  5bc1000c7e1aba69b1bb93c2b3dd6eebf1f08654
FrontView can now display time when not packed.
Now waiting 4 ticks before cycling.

diff -r 5bc1000c7e1a -r 70d865489ff3 GUI/SoundGraphDisplay.cs
--- a/GUI/SoundGraphDisplay.cs	Thu Apr 18 16:05:47 2013 +0200
+++ b/GUI/SoundGraphDisplay.cs	Thu Apr 18 19:51:05 2013 +0200
@@ -113,10 +113,14 @@
 
         public void Redraw(bool aPacked, bool aDisplayTime)
         {
+            const int KNumberOfTickBeforeSwitch = 4;
+            const int KMaxCharacterPerLine = 16;
             string packedFirstLine=""; //We have 16 chars per line on our VFD
             string packedSecondLine="";
             int count = 0;
 
+            string time = DateTime.Now.ToShortTimeString();
+
             //Update all sensors from our front view
             foreach (SensorFrontView sensor in list)
             {
@@ -134,7 +138,7 @@
                     else if (count == 2)
                     {
                         //Add enough spaces
-                        while (packedFirstLine.Length + packedText.Length < 16)
+                        while (packedFirstLine.Length + packedText.Length < KMaxCharacterPerLine)
                         {
                             packedFirstLine += " ";
                         }
@@ -147,7 +151,7 @@
                     else if (count == 4)
                     {
                         //Add enough spaces
-                        while (packedSecondLine.Length + packedText.Length < 16)
+                        while (packedSecondLine.Length + packedText.Length < KMaxCharacterPerLine)
                         {
                             packedSecondLine += " ";
                         }
@@ -166,7 +170,7 @@
                 {
                     //string packedLine = "";
                     iTickCounter++;
-                    if (iTickCounter == 2) //Move to the next sensor only every second tick
+                    if (iTickCounter == KNumberOfTickBeforeSwitch) //Move to the next sensor only every so many tick
                     {
                         iTickCounter = 0;
                         if (iNextSensorToDisplay==1)
@@ -181,7 +185,6 @@
 
                     if (aDisplayTime)
                     {
-                        string time = DateTime.Now.ToShortTimeString();
                         SetText(time, (iNextSensorToDisplay == 1 && packedSecondLine.Length > 0 ? packedSecondLine : packedFirstLine));
                     }
                     else
@@ -194,10 +197,20 @@
                 }
                 else
                 {
+                    string secondLine = list[iNextSensorToDisplay].iSecondLine;
+                    if (aDisplayTime)
+                    {
+                        //Add enough spaces
+                        while (secondLine.Length + time.Length < KMaxCharacterPerLine)
+                        {
+                            secondLine += " ";
+                        }
+                        secondLine += time;
+                    }
                     //Display current sensor on our FrontView display
-                    SetText(list[iNextSensorToDisplay].iFirstLine, list[iNextSensorToDisplay].iSecondLine);
+                    SetText(list[iNextSensorToDisplay].iFirstLine, secondLine);
                     iTickCounter++;
-                    if (iTickCounter == 2) //Move to the next sensor only every second tick
+                    if (iTickCounter == KNumberOfTickBeforeSwitch) //Move to the next sensor only every so many tick
                     {
                         iTickCounter = 0;
                         iNextSensorToDisplay++;