Files
chromebox-fan-control-win/README.md
2026-03-22 12:33:04 +08:00

76 lines
4.0 KiB
Markdown
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.
# Chromebox 风扇温控Windows
在刷了 coreboot 的 Chromebox 上,用 **LibreHardwareMonitor** 读取 **CPU 核心温度**,通过 Coolstar **crosec** 自带的 **`ectool`** 设置 **`fanduty`**,并从 **ectool** 读取 **风扇转速RPM**。主界面提供三条实时曲线:温度、目标占空比、转速。
## 依赖
1. 安装 [Coolstar CROS-EC 驱动](https://github.com/coolstar/crwindows)(或您当前使用的 crosec 安装包),确保存在默认可执行文件:
`C:\Program Files\crosec\ectool.exe`
若路径不同,在程序「高级」选项卡中修改。
2. **以管理员身份运行**本程序清单已要求提升权限LHM 与 EC 通信通常需要管理员)。
3. **客户机**`.\build.ps1 -publish`(及带 `-msi` 时)默认**自包含单文件**发布,**已内含 .NET 8 运行时**`dist\` 仅含数个 exe无需再装运行时。若需多 DLL 或依赖系统 .NET 8 以减小体积,可加 `-multiFile``-frameworkDependent`
## 编译
```powershell
.\build.ps1
```
### 发布 MSI 安装包(推荐)
```powershell
.\build.ps1 -publish -msi
```
`-publish` 只生成 `dist\`;加上 **`-msi`** 才用 WiX 生成安装包(需已安装 WiX。输出两个 MSI
| 文件 | 说明 |
|------|------|
| `dist-installer\ChromeboxFanControl-Setup.msi` | **桌面版**GUI + 可选 Windows 服务(功能树中可勾选) |
| `dist-installer\ChromeboxFanControlService-Setup.msi` | **服务版**:仅后台服务,适合无头部署 |
**构建机**需 [.NET 8 SDK](https://dotnet.microsoft.com/download) 与 [WiX Toolset 3](https://wixtoolset.org/docs/wix3/)。**构建前请关闭正在运行的 ChromeboxFanControl.exe**
以**管理员身份**运行 MSI。若尚未安装 ectool可访问 [Chrultrabook 的 ectool 安装说明](https://docs.chrultrabook.com/docs/installing/ectool.html)。服务模式下配置从 `%ProgramData%\ChromeboxFanControl\config.json` 读取。
### 仅发布到 dist\(用于调试或手动打包)
| 命令 | 说明 |
|------|------|
| `.\build.ps1 -publish` | 同时发布桌面版与服务版到 `dist\`(默认单文件) |
| `.\build.ps1 -publishGui` | 仅发布 GUI |
| `.\build.ps1 -publishService` | 仅发布服务并合并进 `dist\` |
| `.\build.ps1 -publish -multiFile` | 保留多 DLL 输出(默认单 exe |
| `.\build.ps1 -publish -frameworkDependent` | 依赖系统 .NET 8无 bundled 运行时) |
## 配置
- 安装目录旁的 **`appsettings.json`**:默认选项。
- **`%AppData%\ChromeboxFanControl\config.json`**GUI 模式下保存后覆盖(用户配置)。
- **`%ProgramData%\ChromeboxFanControl\config.json`**Windows 服务模式下读取的配置;可与 GUI 共用同一份配置逻辑。
重要字段:
| 项 | 说明 |
|----|------|
| `Language` | 界面语言:`auto`(跟随系统)、`en``zh-Hans``zh-Hant`。修改后需重启生效。 |
| `FanRpmArgs` | 读取转速时传给 ectool 的参数(默认 `pwmgetfanrpm` `0`),请用本机 `ectool help` 核对。 |
| `FanDutyArgs` | 读取占空比时传给 ectool 的参数(如 `pwmget` `0`);空则跳过,显示目标占空比。 |
| `AutoFanCtrlArgs` | 退出程序时恢复 EC 自动风扇(默认 `autofanctrl`),若命令名不同请修改。 |
| `TempSource` | `AverageCore``MaxCore`。 |
| `CurvePoints` | 14 个 0100 的占空比控制点(对应温度断点 0,40,45,…,100°C线性插值。 |
## 使用说明
- 启动后任务栏托盘有图标;可「暂停控制」(不再下发 `fanduty`EC 保持上次状态)。
- **退出**或关闭前会尝试执行 **自动风扇恢复**命令(见配置)。
- 若连续多次读不到 CPU 温度,将进入**安全模式**(固定占空比或 `autofanctrl`,见界面选项)。
## 免责声明
软件按「原样」提供。错误的风扇策略可能导致过热或硬件损坏;请自行承担使用风险。
## 许可
本项目为实现计划而编写的原创代码;风扇曲线算法行为参考 Chrultrabook-Tools 的公开逻辑描述,未复制其 GPL 源码。