日常更新
This commit is contained in:
@@ -1,41 +1,41 @@
|
||||
using FanControl.Plugins;
|
||||
|
||||
namespace FanControl.ChromeboxEC;
|
||||
|
||||
/// <summary>风扇控制:ectool fanduty <percent></summary>
|
||||
public sealed class ChromeboxECControlSensor : IPluginControlSensor2
|
||||
{
|
||||
private readonly string _ectoolPath;
|
||||
private readonly string[] _autoFanArgs;
|
||||
private float? _value;
|
||||
|
||||
public ChromeboxECControlSensor(string ectoolPath, string[] autoFanArgs)
|
||||
{
|
||||
_ectoolPath = ectoolPath;
|
||||
_autoFanArgs = autoFanArgs;
|
||||
}
|
||||
|
||||
public string Id => "ChromeboxEC_Control";
|
||||
public string Name => "Chromebox EC Fan";
|
||||
public string Origin => "ectool fanduty";
|
||||
public float? Value => _value;
|
||||
public string? PairedFanSensorId => "ChromeboxEC_Fan";
|
||||
|
||||
/// <summary>设置风扇占空比 0–100,调用 ectool fanduty</summary>
|
||||
public void Set(float val)
|
||||
{
|
||||
_value = val;
|
||||
var duty = (int)Math.Clamp(Math.Round(val), 0, 100);
|
||||
EctoolRunner.Run(_ectoolPath, ["fanduty", duty.ToString()]);
|
||||
}
|
||||
|
||||
/// <summary>禁用控制时恢复 EC 自动风扇,调用 ectool autofanctrl</summary>
|
||||
public void Reset()
|
||||
{
|
||||
_value = null;
|
||||
if (_autoFanArgs is { Length: > 0 })
|
||||
EctoolRunner.Run(_ectoolPath, _autoFanArgs);
|
||||
}
|
||||
|
||||
public void Update() { }
|
||||
}
|
||||
using FanControl.Plugins;
|
||||
|
||||
namespace FanControl.ChromeboxEC;
|
||||
|
||||
/// <summary>风扇控制:ectool fanduty <percent></summary>
|
||||
public sealed class ChromeboxECControlSensor : IPluginControlSensor2
|
||||
{
|
||||
private readonly string _ectoolPath;
|
||||
private readonly string[] _autoFanArgs;
|
||||
private float? _value;
|
||||
|
||||
public ChromeboxECControlSensor(string ectoolPath, string[] autoFanArgs)
|
||||
{
|
||||
_ectoolPath = ectoolPath;
|
||||
_autoFanArgs = autoFanArgs;
|
||||
}
|
||||
|
||||
public string Id => "ChromeboxEC_Control";
|
||||
public string Name => "Chromebox EC Fan";
|
||||
public string Origin => "ectool fanduty";
|
||||
public float? Value => _value;
|
||||
public string? PairedFanSensorId => "ChromeboxEC_Fan";
|
||||
|
||||
/// <summary>设置风扇占空比 0–100,调用 ectool fanduty</summary>
|
||||
public void Set(float val)
|
||||
{
|
||||
_value = val;
|
||||
var duty = (int)Math.Clamp(Math.Round(val), 0, 100);
|
||||
EctoolRunner.Run(_ectoolPath, ["fanduty", duty.ToString()]);
|
||||
}
|
||||
|
||||
/// <summary>禁用控制时恢复 EC 自动风扇,调用 ectool autofanctrl</summary>
|
||||
public void Reset()
|
||||
{
|
||||
_value = null;
|
||||
if (_autoFanArgs is { Length: > 0 })
|
||||
EctoolRunner.Run(_ectoolPath, _autoFanArgs);
|
||||
}
|
||||
|
||||
public void Update() { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user