日常更新
This commit is contained in:
@@ -1,41 +1,41 @@
|
||||
using FanControl.Plugins;
|
||||
|
||||
namespace FanControl.ChromeboxEC;
|
||||
|
||||
/// <summary>
|
||||
/// Fan Control 插件:通过 ectool 读取 Chromebox EC 温度、控制风扇。
|
||||
/// 命令参见 docs/ectool-commands-zh.md
|
||||
/// </summary>
|
||||
public sealed class ChromeboxECPlugin : IPlugin
|
||||
{
|
||||
private PluginConfig? _config;
|
||||
private bool _available;
|
||||
|
||||
public string Name => "Chromebox EC";
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
_config = PluginConfig.Load();
|
||||
_available = !string.IsNullOrWhiteSpace(_config.EctoolPath) &&
|
||||
File.Exists(_config.EctoolPath);
|
||||
}
|
||||
|
||||
public void Load(IPluginSensorsContainer container)
|
||||
{
|
||||
if (!_available || _config == null)
|
||||
return;
|
||||
|
||||
var tempArgs = _config.TempArgs is { Length: > 0 } ta ? ta : ["temps", "0"];
|
||||
var rpmArgs = _config.FanRpmArgs is { Length: > 0 } ra ? ra : ["pwmgetfanrpm", "0"];
|
||||
|
||||
container.TempSensors.Add(new ChromeboxECTempSensor(_config.EctoolPath, tempArgs));
|
||||
container.FanSensors.Add(new ChromeboxECFanSensor(_config.EctoolPath, rpmArgs));
|
||||
container.ControlSensors.Add(new ChromeboxECControlSensor(_config.EctoolPath, _config.AutoFanCtrlArgs));
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
_config = null;
|
||||
_available = false;
|
||||
}
|
||||
}
|
||||
using FanControl.Plugins;
|
||||
|
||||
namespace FanControl.ChromeboxEC;
|
||||
|
||||
/// <summary>
|
||||
/// Fan Control 插件:通过 ectool 读取 Chromebox EC 温度、控制风扇。
|
||||
/// 命令参见 docs/ectool-commands-zh.md
|
||||
/// </summary>
|
||||
public sealed class ChromeboxECPlugin : IPlugin
|
||||
{
|
||||
private PluginConfig? _config;
|
||||
private bool _available;
|
||||
|
||||
public string Name => "Chromebox EC";
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
_config = PluginConfig.Load();
|
||||
_available = !string.IsNullOrWhiteSpace(_config.EctoolPath) &&
|
||||
File.Exists(_config.EctoolPath);
|
||||
}
|
||||
|
||||
public void Load(IPluginSensorsContainer container)
|
||||
{
|
||||
if (!_available || _config == null)
|
||||
return;
|
||||
|
||||
var tempArgs = _config.TempArgs is { Length: > 0 } ta ? ta : ["temps", "0"];
|
||||
var rpmArgs = _config.FanRpmArgs is { Length: > 0 } ra ? ra : ["pwmgetfanrpm", "0"];
|
||||
|
||||
container.TempSensors.Add(new ChromeboxECTempSensor(_config.EctoolPath, tempArgs));
|
||||
container.FanSensors.Add(new ChromeboxECFanSensor(_config.EctoolPath, rpmArgs));
|
||||
container.ControlSensors.Add(new ChromeboxECControlSensor(_config.EctoolPath, _config.AutoFanCtrlArgs));
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
_config = null;
|
||||
_available = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user