# HG changeset patch # User StephaneLenclud # Date 1366307465 -7200 # Node ID 8c139748f17975f8804a7e1165858538800dc62a # Parent 782b486895134895ed6da0f3274c75d9fdcfe3c6 FrontView can now display time when not packed. Now waiting 4 ticks before cycling. diff -r 782b48689513 -r 8c139748f179 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++;