1.1 --- a/GUI/SoundGraphDisplay.cs Thu Apr 18 16:05:47 2013 +0200
1.2 +++ b/GUI/SoundGraphDisplay.cs Thu Apr 18 19:51:05 2013 +0200
1.3 @@ -113,10 +113,14 @@
1.4
1.5 public void Redraw(bool aPacked, bool aDisplayTime)
1.6 {
1.7 + const int KNumberOfTickBeforeSwitch = 4;
1.8 + const int KMaxCharacterPerLine = 16;
1.9 string packedFirstLine=""; //We have 16 chars per line on our VFD
1.10 string packedSecondLine="";
1.11 int count = 0;
1.12
1.13 + string time = DateTime.Now.ToShortTimeString();
1.14 +
1.15 //Update all sensors from our front view
1.16 foreach (SensorFrontView sensor in list)
1.17 {
1.18 @@ -134,7 +138,7 @@
1.19 else if (count == 2)
1.20 {
1.21 //Add enough spaces
1.22 - while (packedFirstLine.Length + packedText.Length < 16)
1.23 + while (packedFirstLine.Length + packedText.Length < KMaxCharacterPerLine)
1.24 {
1.25 packedFirstLine += " ";
1.26 }
1.27 @@ -147,7 +151,7 @@
1.28 else if (count == 4)
1.29 {
1.30 //Add enough spaces
1.31 - while (packedSecondLine.Length + packedText.Length < 16)
1.32 + while (packedSecondLine.Length + packedText.Length < KMaxCharacterPerLine)
1.33 {
1.34 packedSecondLine += " ";
1.35 }
1.36 @@ -166,7 +170,7 @@
1.37 {
1.38 //string packedLine = "";
1.39 iTickCounter++;
1.40 - if (iTickCounter == 2) //Move to the next sensor only every second tick
1.41 + if (iTickCounter == KNumberOfTickBeforeSwitch) //Move to the next sensor only every so many tick
1.42 {
1.43 iTickCounter = 0;
1.44 if (iNextSensorToDisplay==1)
1.45 @@ -181,7 +185,6 @@
1.46
1.47 if (aDisplayTime)
1.48 {
1.49 - string time = DateTime.Now.ToShortTimeString();
1.50 SetText(time, (iNextSensorToDisplay == 1 && packedSecondLine.Length > 0 ? packedSecondLine : packedFirstLine));
1.51 }
1.52 else
1.53 @@ -194,10 +197,20 @@
1.54 }
1.55 else
1.56 {
1.57 + string secondLine = list[iNextSensorToDisplay].iSecondLine;
1.58 + if (aDisplayTime)
1.59 + {
1.60 + //Add enough spaces
1.61 + while (secondLine.Length + time.Length < KMaxCharacterPerLine)
1.62 + {
1.63 + secondLine += " ";
1.64 + }
1.65 + secondLine += time;
1.66 + }
1.67 //Display current sensor on our FrontView display
1.68 - SetText(list[iNextSensorToDisplay].iFirstLine, list[iNextSensorToDisplay].iSecondLine);
1.69 + SetText(list[iNextSensorToDisplay].iFirstLine, secondLine);
1.70 iTickCounter++;
1.71 - if (iTickCounter == 2) //Move to the next sensor only every second tick
1.72 + if (iTickCounter == KNumberOfTickBeforeSwitch) //Move to the next sensor only every so many tick
1.73 {
1.74 iTickCounter = 0;
1.75 iNextSensorToDisplay++;