1.1 --- a/Hardware/LPC/F71882.cs Sun Jan 31 20:57:18 2010 +0000
1.2 +++ b/Hardware/LPC/F71882.cs Sun Jan 31 22:00:31 2010 +0000
1.3 @@ -146,9 +146,10 @@
1.4 }
1.5
1.6 foreach (Sensor sensor in temperatures) {
1.7 - int value = ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * sensor.Index));
1.8 + sbyte value = (sbyte)ReadByte((byte)(
1.9 + TEMPERATURE_BASE_REG + 2 * sensor.Index));
1.10 sensor.Value = value;
1.11 - if (value < 254)
1.12 + if (value < sbyte.MaxValue && value > 0)
1.13 ActivateSensor(sensor);
1.14 else
1.15 DeactivateSensor(sensor);
1.16 @@ -170,14 +171,16 @@
1.17 private void ActivateSensor(Sensor sensor) {
1.18 if (!active.Contains(sensor)) {
1.19 active.Add(sensor);
1.20 - SensorAdded(sensor);
1.21 + if (SensorAdded != null)
1.22 + SensorAdded(sensor);
1.23 }
1.24 }
1.25
1.26 private void DeactivateSensor(Sensor sensor) {
1.27 if (active.Contains(sensor)) {
1.28 active.Remove(sensor);
1.29 - SensorRemoved(sensor);
1.30 + if (SensorRemoved != null)
1.31 + SensorRemoved(sensor);
1.32 }
1.33 }
1.34