Files
chromebox-fan-control-win/FanControl.ChromeboxEC/ChromeboxECFanSensor.cs
jack 111eb22824 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
2026-03-22 15:15:02 +08:00

28 lines
854 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using FanControl.Plugins;
namespace FanControl.ChromeboxEC;
/// <summary>风扇转速ectool pwmgetfanrpm [index|all]</summary>
public sealed class ChromeboxECFanSensor : IPluginSensor
{
private readonly string _ectoolPath;
private readonly string[] _rpmArgs;
public ChromeboxECFanSensor(string ectoolPath, string[] rpmArgs)
{
_ectoolPath = ectoolPath;
_rpmArgs = rpmArgs is { Length: > 0 } ? rpmArgs : ["pwmgetfanrpm", "0"];
}
public string Id => "ChromeboxEC_Fan";
public string Name => "Chromebox EC Fan RPM";
public string Origin => "ectool pwmgetfanrpm";
public float? Value { get; private set; }
public void Update()
{
var (ok, stdout, _) = EctoolRunner.Run(_ectoolPath, _rpmArgs);
Value = ok && EctoolRunner.TryParseFanRpm(stdout) is { } rpm ? rpm : null;
}
}