Allow all protocols 2X for T-Balancer.
authormoel.mich
Sun, 14 Feb 2010 21:09:08 +0000
changeset 45eadad41d21a6
parent 44 c150de283ca0
child 46 f847947b7f8e
Allow all protocols 2X for T-Balancer.
Hardware/TBalancer/TBalancer.cs
Hardware/TBalancer/TBalancerGroup.cs
Properties/AssemblyInfo.cs
     1.1 --- a/Hardware/TBalancer/TBalancer.cs	Sun Feb 14 20:16:30 2010 +0000
     1.2 +++ b/Hardware/TBalancer/TBalancer.cs	Sun Feb 14 21:09:08 2010 +0000
     1.3 @@ -57,8 +57,6 @@
     1.4      private int[] data;
     1.5  
     1.6      public const byte STARTFLAG = 100;
     1.7 -    public const byte PROTOCOL_VERSION_2A = 0x2A;
     1.8 -    public const byte PROTOCOL_VERSION_2C = 0x2C;
     1.9  
    1.10      public TBalancer(string portName, byte protocolVersion) {
    1.11        icon = Utilities.EmbeddedResources.GetImage("bigng.png");
     2.1 --- a/Hardware/TBalancer/TBalancerGroup.cs	Sun Feb 14 20:16:30 2010 +0000
     2.2 +++ b/Hardware/TBalancer/TBalancerGroup.cs	Sun Feb 14 21:09:08 2010 +0000
     2.3 @@ -83,10 +83,8 @@
     2.4                    for (int k = 1; k < data.Length; k++)
     2.5                      data[k] = (byte)serialPort.ReadByte();
     2.6  
     2.7 -                  // check protocol version
     2.8 -                  isValid =
     2.9 -                    data[274] == TBalancer.PROTOCOL_VERSION_2A ||
    2.10 -                    data[274] == TBalancer.PROTOCOL_VERSION_2C;
    2.11 +                  // check protocol version 2X (protocols seen: 2C, 2A, 28)
    2.12 +                  isValid = (data[274] & 0xF0) == 0x20;
    2.13                    protocolVersion = data[274];
    2.14                    if (!isValid) {
    2.15                      report.Append("Status: Wrong Protocol Version: 0x");
    2.16 @@ -131,7 +129,8 @@
    2.17      public string GetReport() {
    2.18        if (report.Length > 0) {
    2.19          report.Insert(0, "Serial Port T-Balancer" + Environment.NewLine +
    2.20 -          Environment.NewLine);        
    2.21 +          Environment.NewLine);
    2.22 +        report.AppendLine();
    2.23          return report.ToString();
    2.24        } else
    2.25          return null;
     3.1 --- a/Properties/AssemblyInfo.cs	Sun Feb 14 20:16:30 2010 +0000
     3.2 +++ b/Properties/AssemblyInfo.cs	Sun Feb 14 21:09:08 2010 +0000
     3.3 @@ -69,5 +69,5 @@
     3.4  // You can specify all the values or you can default the Build and Revision Numbers 
     3.5  // by using the '*' as shown below:
     3.6  // [assembly: AssemblyVersion("1.0.*")]
     3.7 -[assembly: AssemblyVersion("0.1.20.0")]
     3.8 -[assembly: AssemblyFileVersion("0.1.20.0")]
     3.9 +[assembly: AssemblyVersion("0.1.20.1")]
    3.10 +[assembly: AssemblyFileVersion("0.1.20.1")]