Added support for T-Balancer sensorhub and miniNG. Added a Flow sensor-type.
authormoel.mich
Sun, 21 Feb 2010 18:10:30 +0000
changeset 57142907c75be4
parent 56 5cb7eb5bf628
child 58 d787f441286d
Added support for T-Balancer sensorhub and miniNG. Added a Flow sensor-type.
GUI/HardwareNode.cs
GUI/MainForm.Designer.cs
GUI/MainForm.cs
GUI/SensorNode.cs
GUI/SensorNotifyIcon.cs
GUI/TypeNode.cs
Hardware/ISensor.cs
Hardware/TBalancer/TBalancer.cs
OpenHardwareMonitor.csproj
Properties/AssemblyInfo.cs
Resources/flow.png
     1.1 --- a/GUI/HardwareNode.cs	Sat Feb 20 19:51:10 2010 +0000
     1.2 +++ b/GUI/HardwareNode.cs	Sun Feb 21 18:10:30 2010 +0000
     1.3 @@ -58,6 +58,7 @@
     1.4        typeNodes.Add(new TypeNode(SensorType.Temperature));
     1.5        typeNodes.Add(new TypeNode(SensorType.Load));
     1.6        typeNodes.Add(new TypeNode(SensorType.Fan));
     1.7 +      typeNodes.Add(new TypeNode(SensorType.Flow));
     1.8        
     1.9        foreach (ISensor sensor in hardware.Sensors)
    1.10          SensorAdded(sensor);
     2.1 --- a/GUI/MainForm.Designer.cs	Sat Feb 20 19:51:10 2010 +0000
     2.2 +++ b/GUI/MainForm.Designer.cs	Sun Feb 21 18:10:30 2010 +0000
     2.3 @@ -108,6 +108,7 @@
     2.4        this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
     2.5        this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
     2.6        this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     2.7 +      this.flowsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     2.8        this.columnsContextMenuStrip.SuspendLayout();
     2.9        this.menuStrip.SuspendLayout();
    2.10        this.splitContainer.Panel1.SuspendLayout();
    2.11 @@ -339,9 +340,10 @@
    2.12              this.clocksMenuItem,
    2.13              this.tempMenuItem,
    2.14              this.loadMenuItem,
    2.15 -            this.fansMenuItem});
    2.16 +            this.fansMenuItem,
    2.17 +            this.flowsMenuItem});
    2.18        this.sensorsToolStripMenuItem.Name = "sensorsToolStripMenuItem";
    2.19 -      this.sensorsToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
    2.20 +      this.sensorsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
    2.21        this.sensorsToolStripMenuItem.Text = "Sensors";
    2.22        // 
    2.23        // voltMenuItem
    2.24 @@ -350,7 +352,7 @@
    2.25        this.voltMenuItem.CheckOnClick = true;
    2.26        this.voltMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.27        this.voltMenuItem.Name = "voltMenuItem";
    2.28 -      this.voltMenuItem.Size = new System.Drawing.Size(147, 22);
    2.29 +      this.voltMenuItem.Size = new System.Drawing.Size(152, 22);
    2.30        this.voltMenuItem.Text = "Voltages";
    2.31        this.voltMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
    2.32        // 
    2.33 @@ -360,7 +362,7 @@
    2.34        this.clocksMenuItem.CheckOnClick = true;
    2.35        this.clocksMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.36        this.clocksMenuItem.Name = "clocksMenuItem";
    2.37 -      this.clocksMenuItem.Size = new System.Drawing.Size(147, 22);
    2.38 +      this.clocksMenuItem.Size = new System.Drawing.Size(152, 22);
    2.39        this.clocksMenuItem.Text = "Clocks";
    2.40        this.clocksMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
    2.41        // 
    2.42 @@ -370,7 +372,7 @@
    2.43        this.tempMenuItem.CheckOnClick = true;
    2.44        this.tempMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.45        this.tempMenuItem.Name = "tempMenuItem";
    2.46 -      this.tempMenuItem.Size = new System.Drawing.Size(147, 22);
    2.47 +      this.tempMenuItem.Size = new System.Drawing.Size(152, 22);
    2.48        this.tempMenuItem.Text = "Temperatures";
    2.49        this.tempMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
    2.50        // 
    2.51 @@ -380,7 +382,7 @@
    2.52        this.loadMenuItem.CheckOnClick = true;
    2.53        this.loadMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.54        this.loadMenuItem.Name = "loadMenuItem";
    2.55 -      this.loadMenuItem.Size = new System.Drawing.Size(147, 22);
    2.56 +      this.loadMenuItem.Size = new System.Drawing.Size(152, 22);
    2.57        this.loadMenuItem.Text = "Load";
    2.58        this.loadMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
    2.59        // 
    2.60 @@ -390,14 +392,14 @@
    2.61        this.fansMenuItem.CheckOnClick = true;
    2.62        this.fansMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.63        this.fansMenuItem.Name = "fansMenuItem";
    2.64 -      this.fansMenuItem.Size = new System.Drawing.Size(147, 22);
    2.65 +      this.fansMenuItem.Size = new System.Drawing.Size(152, 22);
    2.66        this.fansMenuItem.Text = "Fans";
    2.67        this.fansMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
    2.68        // 
    2.69        // toolStripMenuItem1
    2.70        // 
    2.71        this.toolStripMenuItem1.Name = "toolStripMenuItem1";
    2.72 -      this.toolStripMenuItem1.Size = new System.Drawing.Size(111, 6);
    2.73 +      this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
    2.74        // 
    2.75        // plotMenuItem
    2.76        // 
    2.77 @@ -405,7 +407,7 @@
    2.78        this.plotMenuItem.CheckOnClick = true;
    2.79        this.plotMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.80        this.plotMenuItem.Name = "plotMenuItem";
    2.81 -      this.plotMenuItem.Size = new System.Drawing.Size(114, 22);
    2.82 +      this.plotMenuItem.Size = new System.Drawing.Size(152, 22);
    2.83        this.plotMenuItem.Text = "Plot";
    2.84        this.plotMenuItem.CheckedChanged += new System.EventHandler(this.plotToolStripMenuItem_CheckedChanged);
    2.85        // 
    2.86 @@ -420,10 +422,10 @@
    2.87        this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
    2.88        this.optionsToolStripMenuItem.Text = "Options";
    2.89        // 
    2.90 -      // startMinimizedMenuItem
    2.91 +      // startMinMenuItem
    2.92        // 
    2.93        this.startMinMenuItem.CheckOnClick = true;
    2.94 -      this.startMinMenuItem.Name = "startMinimizedMenuItem";
    2.95 +      this.startMinMenuItem.Name = "startMinMenuItem";
    2.96        this.startMinMenuItem.Size = new System.Drawing.Size(166, 22);
    2.97        this.startMinMenuItem.Text = "Start Minimized";
    2.98        // 
    2.99 @@ -533,6 +535,16 @@
   2.100        this.sensorContextMenuStrip.Name = "sensorContextMenuStrip";
   2.101        this.sensorContextMenuStrip.Size = new System.Drawing.Size(61, 4);
   2.102        // 
   2.103 +      // flowsMenuItem
   2.104 +      // 
   2.105 +      this.flowsMenuItem.Checked = true;
   2.106 +      this.flowsMenuItem.CheckOnClick = true;
   2.107 +      this.flowsMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.108 +      this.flowsMenuItem.Name = "flowsMenuItem";
   2.109 +      this.flowsMenuItem.Size = new System.Drawing.Size(152, 22);
   2.110 +      this.flowsMenuItem.Text = "Flows";
   2.111 +      this.flowsMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
   2.112 +      // 
   2.113        // MainForm
   2.114        // 
   2.115        this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
   2.116 @@ -607,6 +619,7 @@
   2.117      private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
   2.118      private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip;
   2.119      private System.Windows.Forms.ToolStripMenuItem startMinMenuItem;
   2.120 +    private System.Windows.Forms.ToolStripMenuItem flowsMenuItem;
   2.121    }
   2.122  }
   2.123  
     3.1 --- a/GUI/MainForm.cs	Sat Feb 20 19:51:10 2010 +0000
     3.2 +++ b/GUI/MainForm.cs	Sun Feb 21 18:10:30 2010 +0000
     3.3 @@ -143,6 +143,7 @@
     3.4        loadMenuItem.Checked = Config.Get(loadMenuItem.Name, true);
     3.5        tempMenuItem.Checked = Config.Get(tempMenuItem.Name, true);
     3.6        fansMenuItem.Checked = Config.Get(fansMenuItem.Name, true);
     3.7 +      flowsMenuItem.Checked = Config.Get(flowsMenuItem.Name, true);
     3.8       
     3.9        timer.Enabled = true;
    3.10  
    3.11 @@ -259,6 +260,7 @@
    3.12        Config.Set(loadMenuItem.Name, loadMenuItem.Checked);
    3.13        Config.Set(tempMenuItem.Name, tempMenuItem.Checked);
    3.14        Config.Set(fansMenuItem.Name, fansMenuItem.Checked);
    3.15 +      Config.Set(flowsMenuItem.Name, flowsMenuItem.Checked);
    3.16  
    3.17        if (WindowState != FormWindowState.Minimized) {
    3.18          Config.Set("mainForm.Location.X", Location.X);
    3.19 @@ -355,6 +357,7 @@
    3.20          node.SetVisible(SensorType.Load, loadMenuItem.Checked);
    3.21          node.SetVisible(SensorType.Temperature, tempMenuItem.Checked);
    3.22          node.SetVisible(SensorType.Fan, fansMenuItem.Checked);
    3.23 +        node.SetVisible(SensorType.Flow, flowsMenuItem.Checked);
    3.24        }
    3.25      }
    3.26  
     4.1 --- a/GUI/SensorNode.cs	Sat Feb 20 19:51:10 2010 +0000
     4.2 +++ b/GUI/SensorNode.cs	Sun Feb 21 18:10:30 2010 +0000
     4.3 @@ -62,6 +62,7 @@
     4.4          case SensorType.Load: format = "{0:F1} %"; break;
     4.5          case SensorType.Temperature: format = "{0:F1} °C"; break;
     4.6          case SensorType.Fan: format = "{0:F0} RPM"; break;
     4.7 +        case SensorType.Flow: format = "{0:F0} L/h"; break;
     4.8        }      
     4.9      }
    4.10  
     5.1 --- a/GUI/SensorNotifyIcon.cs	Sat Feb 20 19:51:10 2010 +0000
     5.2 +++ b/GUI/SensorNotifyIcon.cs	Sun Feb 21 18:10:30 2010 +0000
     5.3 @@ -152,6 +152,8 @@
     5.4            return string.Format("{0:F0}", sensor.Value);
     5.5          case SensorType.Fan: 
     5.6            return string.Format("{0:F11}", 1e-3f * sensor.Value);
     5.7 +        case SensorType.Flow:
     5.8 +          return string.Format("{0:F11}", 1e-3f * sensor.Value);
     5.9        }
    5.10        return "-";
    5.11      }
    5.12 @@ -224,6 +226,7 @@
    5.13          case SensorType.Load: format = "{0}\n{1}: {2:F1} %"; break;
    5.14          case SensorType.Temperature: format = "{0}\n{1}: {2:F1} °C"; break;
    5.15          case SensorType.Fan: format = "{0}\n{1}: {2:F0} RPM"; break;
    5.16 +        case SensorType.Flow: format = "{0}\n{1}: {2:F0} L/h"; break;
    5.17        }
    5.18  
    5.19        notifyIcon.Text = string.Format(format, sensor.Hardware.Name, sensor.Name,
     6.1 --- a/GUI/TypeNode.cs	Sat Feb 20 19:51:10 2010 +0000
     6.2 +++ b/GUI/TypeNode.cs	Sun Feb 21 18:10:30 2010 +0000
     6.3 @@ -70,6 +70,10 @@
     6.4            this.Image = Utilities.EmbeddedResources.GetImage("fan.png");
     6.5            this.Text = "Fans";
     6.6            break;
     6.7 +        case SensorType.Flow:
     6.8 +          this.Image = Utilities.EmbeddedResources.GetImage("flow.png");
     6.9 +          this.Text = "Flows";
    6.10 +          break;
    6.11        }
    6.12      }
    6.13  
     7.1 --- a/Hardware/ISensor.cs	Sat Feb 20 19:51:10 2010 +0000
     7.2 +++ b/Hardware/ISensor.cs	Sun Feb 21 18:10:30 2010 +0000
     7.3 @@ -45,7 +45,8 @@
     7.4      Clock,    
     7.5      Temperature,
     7.6      Load,
     7.7 -    Fan    
     7.8 +    Fan,
     7.9 +    Flow
    7.10    }
    7.11  
    7.12    public interface ISensorEntry {
     8.1 --- a/Hardware/TBalancer/TBalancer.cs	Sat Feb 20 19:51:10 2010 +0000
     8.2 +++ b/Hardware/TBalancer/TBalancer.cs	Sun Feb 21 18:10:30 2010 +0000
     8.3 @@ -46,36 +46,67 @@
     8.4  namespace OpenHardwareMonitor.Hardware.TBalancer {
     8.5    public class TBalancer : IHardware {
     8.6  
     8.7 +    private string portName;
     8.8      private Image icon;
     8.9      private SerialPort serialPort;
    8.10      private byte protocolVersion;
    8.11      private Sensor[] digitalTemperatures = new Sensor[8];
    8.12      private Sensor[] analogTemperatures = new Sensor[4];
    8.13 +    private Sensor[] sensorhubTemperatures = new Sensor[6];
    8.14 +    private Sensor[] sensorhubFlows = new Sensor[2];
    8.15      private Sensor[] fans = new Sensor[4];
    8.16 +    private Sensor[] miniNGTemperatures = new Sensor[4];
    8.17 +    private Sensor[] miniNGFans = new Sensor[4];
    8.18      private List<ISensor> active = new List<ISensor>();
    8.19      private List<ISensor> deactivating = new List<ISensor>();
    8.20 -    private int[] data;
    8.21 +    private int[] primaryData = new int[0];
    8.22 +    private int[] alternativeData = new int[0];
    8.23  
    8.24      public const byte STARTFLAG = 100;
    8.25 +    public const byte ENDFLAG = 254;
    8.26 +
    8.27 +    private delegate void MethodDelegate();
    8.28 +    private MethodDelegate alternativeRequest;    
    8.29  
    8.30      public TBalancer(string portName, byte protocolVersion) {
    8.31 -      icon = Utilities.EmbeddedResources.GetImage("bigng.png");
    8.32 +      this.portName = portName;
    8.33 +      this.icon = Utilities.EmbeddedResources.GetImage("bigng.png");
    8.34        this.protocolVersion = protocolVersion;
    8.35  
    8.36 +      int offset = 0;
    8.37 +      for (int i = 0; i < digitalTemperatures.Length; i++)
    8.38 +        digitalTemperatures[i] = new Sensor("Digital Sensor #" + (i + 1),
    8.39 +          offset + i, SensorType.Temperature, this);
    8.40 +      offset += digitalTemperatures.Length;
    8.41 +
    8.42 +      for (int i = 0; i < analogTemperatures.Length; i++)
    8.43 +        analogTemperatures[i] = new Sensor("Analog Sensor #" + (i + 1),
    8.44 +          offset + i, SensorType.Temperature, this);
    8.45 +      offset += analogTemperatures.Length;
    8.46 +
    8.47 +      for (int i = 0; i < sensorhubTemperatures.Length; i++)
    8.48 +        sensorhubTemperatures[i] = new Sensor("Sensorhub Sensor #" + (i + 1),
    8.49 +          offset + i, SensorType.Temperature, this);
    8.50 +      offset += sensorhubTemperatures.Length;
    8.51 +
    8.52 +      for (int i = 0; i < sensorhubFlows.Length; i++)
    8.53 +        sensorhubFlows[i] = new Sensor("Flowmeter #" + (i + 1),
    8.54 +          offset + i, SensorType.Flow, this);
    8.55 +      offset += sensorhubFlows.Length;
    8.56 +
    8.57 +      for (int i = 0; i < miniNGTemperatures.Length; i++)
    8.58 +        miniNGTemperatures[i] = new Sensor("miniNG #" + (i / 2 + 1) + 
    8.59 +          " Sensor #" + (i % 2 + 1), offset + i, SensorType.Temperature, this);
    8.60 +      offset += miniNGTemperatures.Length;
    8.61 +
    8.62 +      alternativeRequest = new MethodDelegate(DelayedAlternativeRequest);
    8.63 +
    8.64        try {
    8.65          serialPort = new SerialPort(portName, 19200, Parity.None, 8,
    8.66            StopBits.One);
    8.67          serialPort.Open();
    8.68          Update();
    8.69 -      } catch (IOException) { }
    8.70 -
    8.71 -      for (int i = 0; i < digitalTemperatures.Length; i++) 
    8.72 -        digitalTemperatures[i] = new Sensor("Digital Sensor #" + (i + 1), i, 
    8.73 -          SensorType.Temperature, this);
    8.74 -
    8.75 -      for (int i = 0; i < analogTemperatures.Length; i++)
    8.76 -        analogTemperatures[i] = new Sensor("Analog Sensor #" + (i + 1),
    8.77 -          i + digitalTemperatures.Length, SensorType.Temperature, this);        
    8.78 +      } catch (IOException) { }      
    8.79      }
    8.80  
    8.81      private void ActivateSensor(Sensor sensor) {
    8.82 @@ -98,46 +129,110 @@
    8.83        }     
    8.84      }
    8.85  
    8.86 +    private void ReadminiNG(int[] data, int number) {
    8.87 +      int offset = 1 + number * 65;
    8.88 +
    8.89 +      if (data[offset + 61] != ENDFLAG)
    8.90 +        return;
    8.91 +
    8.92 +      for (int i = 0; i < 2; i++) {
    8.93 +        Sensor sensor = miniNGTemperatures[number * 2 + i];
    8.94 +        if (data[offset + 7 + i] > 0) {
    8.95 +          sensor.Value = 0.5f * data[offset + 7 + i];
    8.96 +          ActivateSensor(sensor);
    8.97 +        } else {
    8.98 +          DeactivateSensor(sensor);
    8.99 +        }
   8.100 +      }
   8.101 +
   8.102 +      for (int i = 0; i < 2; i++) {
   8.103 +        float maxRPM = 20.0f * data[offset + 44 + 2 * i];
   8.104 +
   8.105 +        if (miniNGFans[number * 2 + i] == null)
   8.106 +          miniNGFans[number * 2 + i] = 
   8.107 +            new Sensor("miniNG #" + (number + 1) + " Fan #" + (i + 1),
   8.108 +            4 + number * 2 + i, maxRPM, SensorType.Fan, this);
   8.109 +        
   8.110 +        Sensor sensor = miniNGFans[number * 2 + i];
   8.111 +
   8.112 +        sensor.Value = 20.0f * data[offset + 43 + 2 * i];
   8.113 +        ActivateSensor(sensor);
   8.114 +      }
   8.115 +    }
   8.116 +
   8.117      private void ReadData() {
   8.118        int[] data = new int[285];
   8.119        for (int i = 0; i < data.Length; i++)
   8.120          data[i] = serialPort.ReadByte();
   8.121  
   8.122 -      if (data[0] != STARTFLAG || data[274] != protocolVersion) {
   8.123 +      if (data[0] != STARTFLAG) {
   8.124          serialPort.DiscardInBuffer();   
   8.125          return;
   8.126        }
   8.127  
   8.128 -      for (int i = 0; i < digitalTemperatures.Length; i++)
   8.129 -        if (data[238 + i] > 0) {
   8.130 -          digitalTemperatures[i].Value = 0.5f * data[238 + i];
   8.131 -          ActivateSensor(digitalTemperatures[i]);
   8.132 -        } else {
   8.133 -          DeactivateSensor(digitalTemperatures[i]);
   8.134 +      if (data[1] == 255) { // bigNG
   8.135 +
   8.136 +        if (data[274] != protocolVersion) 
   8.137 +          return;
   8.138 +
   8.139 +        this.primaryData = data;
   8.140 +
   8.141 +        for (int i = 0; i < digitalTemperatures.Length; i++)
   8.142 +          if (data[238 + i] > 0) {
   8.143 +            digitalTemperatures[i].Value = 0.5f * data[238 + i];
   8.144 +            ActivateSensor(digitalTemperatures[i]);
   8.145 +          } else {
   8.146 +            DeactivateSensor(digitalTemperatures[i]);
   8.147 +          }
   8.148 +
   8.149 +        for (int i = 0; i < analogTemperatures.Length; i++)
   8.150 +          if (data[260 + i] > 0) {
   8.151 +            analogTemperatures[i].Value = 0.5f * data[260 + i];
   8.152 +            ActivateSensor(analogTemperatures[i]);
   8.153 +          } else {
   8.154 +            DeactivateSensor(analogTemperatures[i]);
   8.155 +          }
   8.156 +
   8.157 +        for (int i = 0; i < sensorhubTemperatures.Length; i++)
   8.158 +          if (data[246 + i] > 0) {
   8.159 +            sensorhubTemperatures[i].Value = 0.5f * data[246 + i];
   8.160 +            ActivateSensor(sensorhubTemperatures[i]);
   8.161 +          } else {
   8.162 +            DeactivateSensor(sensorhubTemperatures[i]);
   8.163 +          }
   8.164 +
   8.165 +        for (int i = 0; i < sensorhubFlows.Length; i++)
   8.166 +          if (data[231 + i] > 0 && data[234] > 0) {
   8.167 +            float pulsesPerSecond = ((float)data[231 + i]) / data[234];
   8.168 +            const float pulsesPerLiter = 509;
   8.169 +            sensorhubFlows[i].Value = pulsesPerSecond * 3600 / pulsesPerLiter;
   8.170 +            ActivateSensor(sensorhubFlows[i]);
   8.171 +          } else {
   8.172 +            DeactivateSensor(sensorhubFlows[i]);
   8.173 +          }
   8.174 +
   8.175 +        for (int i = 0; i < fans.Length; i++) {
   8.176 +          float maxRPM = 11.5f * ((data[149 + 2 * i] << 8) | data[148 + 2 * i]);
   8.177 +
   8.178 +          if (fans[i] == null)
   8.179 +            fans[i] = new Sensor("Fan #" + (i + 1), i, maxRPM, SensorType.Fan,
   8.180 +              this);
   8.181 +
   8.182 +          if ((data[136] & (1 << i)) == 0)
   8.183 +            fans[i].Value = maxRPM * 0.01f * data[156 + i]; // pwm mode
   8.184 +          else
   8.185 +            fans[i].Value = maxRPM * 0.01f * data[141 + i]; // analog mode
   8.186 +          ActivateSensor(fans[i]);
   8.187          }
   8.188  
   8.189 -      for (int i = 0; i < analogTemperatures.Length; i++)
   8.190 -        if (data[260 + i] > 0) {
   8.191 -          analogTemperatures[i].Value = 0.5f * data[260 + i];
   8.192 -          ActivateSensor(analogTemperatures[i]);
   8.193 -        } else {
   8.194 -          DeactivateSensor(analogTemperatures[i]);
   8.195 -        }
   8.196 -      
   8.197 -      for (int i = 0; i < fans.Length; i++) {
   8.198 -        float maxRPM = 11.5f * ((data[149 + 2 * i] << 8) | data[148 + 2 * i]);
   8.199 -        
   8.200 -        if (fans[i] == null) 
   8.201 -          fans[i] = new Sensor("Fan #" + (i + 1), i, maxRPM, SensorType.Fan, 
   8.202 -            this);
   8.203 +      } else if (data[1] == 253) { // miniNG #1
   8.204 +        this.alternativeData = data;
   8.205  
   8.206 -        if ((data[136] & (1 << i)) == 0)
   8.207 -          fans[i].Value = maxRPM * 0.01f * data[156 + i]; // pwm mode
   8.208 -        else
   8.209 -          fans[i].Value = maxRPM * 0.01f * data[141 + i]; // analog mode
   8.210 -        ActivateSensor(fans[i]);
   8.211 -      }
   8.212 -      this.data = data;
   8.213 +        ReadminiNG(data, 0);        
   8.214 +              
   8.215 +        if (data[66] == 252)  // miniNG #2
   8.216 +          ReadminiNG(data, 1);
   8.217 +      } 
   8.218      }
   8.219  
   8.220      public Image Icon {
   8.221 @@ -150,7 +245,7 @@
   8.222  
   8.223      public string Identifier {
   8.224        get { return "/bigng/" + 
   8.225 -        serialPort.PortName.TrimStart(new char[]{'/'}).ToLower(); }
   8.226 +        this.portName.TrimStart(new char[]{'/'}).ToLower(); }
   8.227      }
   8.228  
   8.229      public ISensor[] Sensors {
   8.230 @@ -164,31 +259,62 @@
   8.231        r.AppendLine();
   8.232        r.Append("Port Name: "); r.AppendLine(serialPort.PortName);
   8.233        r.AppendLine();
   8.234 -      r.AppendLine("System Information Answer");
   8.235 +
   8.236 +      r.AppendLine("Primary System Information Answer");
   8.237        r.AppendLine();
   8.238 -
   8.239        r.AppendLine("       00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
   8.240        r.AppendLine();
   8.241        for (int i = 0; i <= 0x11; i++) {
   8.242          r.Append(" "); r.Append((i << 4).ToString("X3")); r.Append("  ");
   8.243          for (int j = 0; j <= 0xF; j++) {
   8.244            int index = ((i << 4) | j);
   8.245 -          if (index < data.Length) {
   8.246 +          if (index < primaryData.Length) {
   8.247              r.Append(" ");
   8.248 -            r.Append(data[index].ToString("X2"));
   8.249 +            r.Append(primaryData[index].ToString("X2"));
   8.250            }          
   8.251          }
   8.252          r.AppendLine();
   8.253        }
   8.254        r.AppendLine();
   8.255  
   8.256 +      if (alternativeData.Length > 0) {
   8.257 +        r.AppendLine("Alternative System Information Answer");
   8.258 +        r.AppendLine();
   8.259 +        r.AppendLine("       00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
   8.260 +        r.AppendLine();
   8.261 +        for (int i = 0; i <= 0x11; i++) {
   8.262 +          r.Append(" "); r.Append((i << 4).ToString("X3")); r.Append("  ");
   8.263 +          for (int j = 0; j <= 0xF; j++) {
   8.264 +            int index = ((i << 4) | j);
   8.265 +            if (index < alternativeData.Length) {
   8.266 +              r.Append(" ");
   8.267 +              r.Append(alternativeData[index].ToString("X2"));
   8.268 +            }
   8.269 +          }
   8.270 +          r.AppendLine();
   8.271 +        }
   8.272 +        r.AppendLine();
   8.273 +      }
   8.274 +
   8.275        return r.ToString();
   8.276      }
   8.277  
   8.278 +    private void DelayedAlternativeRequest() {
   8.279 +      System.Threading.Thread.Sleep(500);
   8.280 +      try {
   8.281 +        if (serialPort.IsOpen)
   8.282 +          serialPort.Write(new byte[] { 0x37 }, 0, 1);
   8.283 +      } catch (Exception) { }
   8.284 +    }
   8.285 +
   8.286      public void Update() {
   8.287        while (serialPort.BytesToRead >= 285)
   8.288          ReadData();
   8.289 +      if (serialPort.BytesToRead == 1)
   8.290 +        serialPort.ReadByte();
   8.291 +
   8.292        serialPort.Write(new byte[] { 0x38 }, 0, 1);
   8.293 +      alternativeRequest.BeginInvoke(null, null);
   8.294      }
   8.295  
   8.296      public void Close() {
     9.1 --- a/OpenHardwareMonitor.csproj	Sat Feb 20 19:51:10 2010 +0000
     9.2 +++ b/OpenHardwareMonitor.csproj	Sun Feb 21 18:10:30 2010 +0000
     9.3 @@ -68,6 +68,7 @@
     9.4      <Compile Include="Hardware\HDD\HDD.cs" />
     9.5      <Compile Include="Hardware\HDD\HDDGroup.cs" />
     9.6      <Compile Include="Hardware\HDD\SMART.cs" />
     9.7 +    <Compile Include="Hardware\IParameter.cs" />
     9.8      <Compile Include="Hardware\LPC\Chip.cs" />
     9.9      <Compile Include="Hardware\LPC\F718XX.cs" />
    9.10      <Compile Include="Hardware\LPC\LPCHardware.cs" />
    9.11 @@ -153,6 +154,9 @@
    9.12    <ItemGroup>
    9.13      <EmbeddedResource Include="Resources\smallicon.ico" />
    9.14    </ItemGroup>
    9.15 +  <ItemGroup>
    9.16 +    <EmbeddedResource Include="Resources\flow.png" />
    9.17 +  </ItemGroup>
    9.18    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    9.19    <ProjectExtensions>
    9.20      <VisualStudio AllowExistingFolder="true" />
    10.1 --- a/Properties/AssemblyInfo.cs	Sat Feb 20 19:51:10 2010 +0000
    10.2 +++ b/Properties/AssemblyInfo.cs	Sun Feb 21 18:10:30 2010 +0000
    10.3 @@ -69,5 +69,5 @@
    10.4  // You can specify all the values or you can default the Build and Revision Numbers 
    10.5  // by using the '*' as shown below:
    10.6  // [assembly: AssemblyVersion("1.0.*")]
    10.7 -[assembly: AssemblyVersion("0.1.22.1")]
    10.8 -[assembly: AssemblyFileVersion("0.1.22.1")]
    10.9 +[assembly: AssemblyVersion("0.1.23.1")]
   10.10 +[assembly: AssemblyFileVersion("0.1.23.1")]
    11.1 Binary file Resources/flow.png has changed