-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDeviceFanPluginControlSensor.cs
More file actions
55 lines (44 loc) · 1.34 KB
/
DeviceFanPluginControlSensor.cs
File metadata and controls
55 lines (44 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using FanControl.Plugins;
using System;
namespace FanControl.IntelCtlLibraryPlugin
{
public class DeviceFanPluginControlSensor : IPluginControlSensor
{
private readonly Device _device;
private readonly DeviceFan _fan;
public DeviceFanPluginControlSensor(Device device, DeviceFan fan)
{
_device = device;
_fan = fan;
}
public string Id => $"IntelCtlLibrary/{_device.Index}/control/{_fan.Index}";
public string Name => $"{_device.Name} - Fan {_fan.Index + 1}";
public float? Value { get; private set; }
public void Reset()
{
_fan.Reset();
}
public void Set(float val)
{
var roundedVal = (int)Math.Round(val);
if (roundedVal == Value)
return;
switch (_fan.ControlMode)
{
case DeviceFanControlMode.Table:
_fan.SetFlatFanSpeedTable(roundedVal);
break;
case DeviceFanControlMode.Fixed:
_fan.SetFanSpeedPercent(roundedVal);
break;
default:
return;
}
Value = roundedVal;
}
public void Update()
{
//Value = _fan.GetSpeedPercent();
}
}
}