Hardware/Mainboard/SuperIOHardware.cs
changeset 428 3c1cdc197b24
parent 416 f117373bd190
     1.1 --- a/Hardware/Mainboard/SuperIOHardware.cs	Sun Dec 28 22:42:36 2014 +0000
     1.2 +++ b/Hardware/Mainboard/SuperIOHardware.cs	Tue Dec 30 16:02:52 2014 +0000
     1.3 @@ -4,7 +4,7 @@
     1.4    License, v. 2.0. If a copy of the MPL was not distributed with this
     1.5    file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.6   
     1.7 -  Copyright (C) 2009-2013 Michael Möller <mmoeller@openhardwaremonitor.org>
     1.8 +  Copyright (C) 2009-2014 Michael Möller <mmoeller@openhardwaremonitor.org>
     1.9  	
    1.10  */
    1.11  
    1.12 @@ -72,18 +72,37 @@
    1.13              this, settings);
    1.14            Control control = new Control(sensor, settings, 0, 100);
    1.15            control.ControlModeChanged += (cc) => {
    1.16 -            if (cc.ControlMode == ControlMode.Default) {
    1.17 -              superIO.SetControl(index, null);
    1.18 -            } else {
    1.19 -              superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
    1.20 +            switch (cc.ControlMode) {
    1.21 +              case ControlMode.Undefined:
    1.22 +                return;
    1.23 +              case ControlMode.Default:
    1.24 +                superIO.SetControl(index, null);
    1.25 +                break;
    1.26 +              case ControlMode.Software:
    1.27 +                superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
    1.28 +                break;
    1.29 +              default:
    1.30 +                return;
    1.31              }
    1.32            };
    1.33            control.SoftwareControlValueChanged += (cc) => {
    1.34              if (cc.ControlMode == ControlMode.Software)
    1.35                superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
    1.36            };
    1.37 -          if (control.ControlMode == ControlMode.Software)
    1.38 -            superIO.SetControl(index, (byte)(control.SoftwareValue * 2.55));
    1.39 +
    1.40 +          switch (control.ControlMode) {
    1.41 +            case ControlMode.Undefined:
    1.42 +              break;
    1.43 +            case ControlMode.Default:
    1.44 +              superIO.SetControl(index, null);
    1.45 +              break;
    1.46 +            case ControlMode.Software:
    1.47 +              superIO.SetControl(index, (byte)(control.SoftwareValue * 2.55));
    1.48 +              break;
    1.49 +            default:
    1.50 +              break;
    1.51 +          }            
    1.52 +
    1.53            sensor.Control = control;
    1.54            controls.Add(sensor);
    1.55            ActivateSensor(sensor);