Added support for a second miniNG on the T-Balancer bigNG.
1.1 --- a/Hardware/TBalancer/TBalancer.cs Mon Jun 07 20:03:48 2010 +0000
1.2 +++ b/Hardware/TBalancer/TBalancer.cs Mon Jun 07 20:35:05 2010 +0000
1.3 @@ -56,6 +56,7 @@
1.4 private Sensor[] controls = new Sensor[4];
1.5 private Sensor[] miniNGTemperatures = new Sensor[4];
1.6 private Sensor[] miniNGFans = new Sensor[4];
1.7 + private Sensor[] miniNGControls = new Sensor[4];
1.8 private List<ISensor> active = new List<ISensor>();
1.9 private List<ISensor> deactivating = new List<ISensor>();
1.10 private int[] primaryData = new int[0];
1.11 @@ -105,9 +106,13 @@
1.12 });
1.13
1.14 for (int i = 0; i < controls.Length; i++) {
1.15 - controls[i] = new Sensor("Fan Channel " + i, i,
1.16 - SensorType.Control, this, null);
1.17 - ActivateSensor(controls[i]);
1.18 + controls[i] = new Sensor("Fan Channel " + i, i, SensorType.Control,
1.19 + this, null);
1.20 + }
1.21 +
1.22 + for (int i = 0; i < miniNGControls.Length; i++) {
1.23 + miniNGControls[i] = new Sensor("miniNG #" + (i / 2 + 1) +
1.24 + " Fan Channel " + (i % 2 + 1), 4 + i, SensorType.Control, this, null);
1.25 }
1.26
1.27 alternativeRequest = new MethodDelegate(DelayedAlternativeRequest);
1.28 @@ -166,13 +171,19 @@
1.29 sensor.Value = 20.0f * data[offset + 43 + 2 * i];
1.30 ActivateSensor(sensor);
1.31 }
1.32 +
1.33 + for (int i = 0; i < 2; i++) {
1.34 + Sensor sensor = miniNGControls[number * 2 + i];
1.35 + sensor.Value = data[offset + 15 + i];
1.36 + ActivateSensor(sensor);
1.37 + }
1.38 }
1.39
1.40 private void ReadData() {
1.41 int[] data = new int[285];
1.42 for (int i = 0; i < data.Length; i++)
1.43 data[i] = FTD2XX.ReadByte(handle);
1.44 -
1.45 +
1.46 if (data[0] != STARTFLAG) {
1.47 FTD2XX.FT_Purge(handle, FT_PURGE.FT_PURGE_RX);
1.48 return;
1.49 @@ -241,7 +252,8 @@
1.50 fans[i].Value = fans[i].Parameters[0].Value * value;
1.51 ActivateSensor(fans[i]);
1.52
1.53 - controls[i].Value = 100 * value;
1.54 + controls[i].Value = 100 * value;
1.55 + ActivateSensor(controls[i]);
1.56 }
1.57
1.58 } else if (data[1] == 253) { // miniNG #1
1.59 @@ -249,7 +261,7 @@
1.60
1.61 ReadminiNG(data, 0);
1.62
1.63 - if (data[66] == 252) // miniNG #2
1.64 + if (data[66] == 253) // miniNG #2
1.65 ReadminiNG(data, 1);
1.66 }
1.67 }