Add FanControl.ChromeboxEC plugin, project background, ectool docs

- Add FanControl.ChromeboxEC plugin for Fan Control
- Add project background/缘由 in README (EN/zh)
- Add docs/ectool-commands-zh.md
- Update sln, appsettings, gitignore

Made-with: Cursor
This commit is contained in:
2026-03-22 15:15:02 +08:00
parent e8c8a759e0
commit 111eb22824
15 changed files with 928 additions and 3 deletions

View File

@@ -0,0 +1,41 @@
using FanControl.Plugins;
namespace FanControl.ChromeboxEC;
/// <summary>风扇控制ectool fanduty &lt;percent&gt;</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>设置风扇占空比 0100调用 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() { }
}