# HG changeset patch # User StephaneLenclud # Date 1366293947 -7200 # Node ID 782b486895134895ed6da0f3274c75d9fdcfe3c6 # Parent 2a02ad86a7768c4250dea1703f8284aef02151ec Implementing FrontView support for packed mode and time display. diff -r 2a02ad86a776 -r 782b48689513 GUI/MainForm.cs --- a/GUI/MainForm.cs Wed Apr 17 17:09:21 2013 +0200 +++ b/GUI/MainForm.cs Thu Apr 18 16:05:47 2013 +0200 @@ -562,7 +562,7 @@ if (soundGraphDisplay != null) { - soundGraphDisplay.Redraw(); + soundGraphDisplay.Redraw(frontViewPacked.Value,frontViewDisplayTime.Value); /* displayTick=!displayTick; if (displayTick) diff -r 2a02ad86a776 -r 782b48689513 GUI/SoundGraphDisplay.cs --- a/GUI/SoundGraphDisplay.cs Wed Apr 17 17:09:21 2013 +0200 +++ b/GUI/SoundGraphDisplay.cs Thu Apr 18 16:05:47 2013 +0200 @@ -111,25 +111,97 @@ } - public void Redraw() + public void Redraw(bool aPacked, bool aDisplayTime) { + string packedFirstLine=""; //We have 16 chars per line on our VFD + string packedSecondLine=""; + int count = 0; + //Update all sensors from our front view foreach (SensorFrontView sensor in list) { + count++; sensor.Update(); + + if (aPacked) + { + string packedText = ""; + packedText = sensor.iFirstLine.Substring(0, 3) + ":" + sensor.iSecondLine; + if (count == 1) + { + packedFirstLine = packedText; + } + else if (count == 2) + { + //Add enough spaces + while (packedFirstLine.Length + packedText.Length < 16) + { + packedFirstLine += " "; + } + packedFirstLine += packedText; + } + else if (count == 3) + { + packedSecondLine = packedText; + } + else if (count == 4) + { + //Add enough spaces + while (packedSecondLine.Length + packedText.Length < 16) + { + packedSecondLine += " "; + } + packedSecondLine += packedText; + } + + + } //SetText(sensor.iFirstLine, sensor.iSecondLine); } //Alternate between sensors if (list.Count > 0) { - //Display current sensor on our FrontView display - SetText(list[iNextSensorToDisplay].iFirstLine, list[iNextSensorToDisplay].iSecondLine); - iTickCounter++; - if (iTickCounter==2) //Move to the next sensor only every second tick + if (aPacked) { - iTickCounter = 0; - iNextSensorToDisplay++; + //string packedLine = ""; + iTickCounter++; + if (iTickCounter == 2) //Move to the next sensor only every second tick + { + iTickCounter = 0; + if (iNextSensorToDisplay==1) + { + iNextSensorToDisplay=0; + } + else + { + iNextSensorToDisplay=1; + } + } + + if (aDisplayTime) + { + string time = DateTime.Now.ToShortTimeString(); + SetText(time, (iNextSensorToDisplay == 1 && packedSecondLine.Length > 0 ? packedSecondLine : packedFirstLine)); + } + else + { + //Display packed sensors on our FrontView display + SetText(packedFirstLine, packedSecondLine); + } + + + } + else + { + //Display current sensor on our FrontView display + SetText(list[iNextSensorToDisplay].iFirstLine, list[iNextSensorToDisplay].iSecondLine); + iTickCounter++; + if (iTickCounter == 2) //Move to the next sensor only every second tick + { + iTickCounter = 0; + iNextSensorToDisplay++; + } } }