-
Notifications
You must be signed in to change notification settings - Fork 3
/
OpenFanManagementControlSensor.cs
44 lines (32 loc) · 1.15 KB
/
OpenFanManagementControlSensor.cs
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
using FanControl.Plugins;
namespace FanControl.OpenFanPlugin
{
public class OpenFanManagementControlSensor: IPluginControlSensor
{
private readonly int _fanIndex;
private float? _lastSetValue;
public OpenFanManagementControlSensor(int fanIndex) => _fanIndex = fanIndex;
public float? Value { get; private set; }
public string Name => $"OpenFAN Fan #{_fanIndex + 1}";
public string Origin => $"OpenFAN";
public string Id => "OpenFan/Control/" + _fanIndex.ToString();
public void Reset()
{
// set back the original control value, is there a command to get the current value we could use
// to get the original value at the start?
}
public void Set(float val)
{
_lastSetValue = val;
}
public void Update(){ }
public void SetFanSpeed(OpenFan_Serial serial)
{
if (Value != _lastSetValue)
{
serial.SetPercent(_fanIndex, (int)_lastSetValue);
Value = _lastSetValue;
}
}
}
}