mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-06 06:43:49 +00:00
Add initial FanControl
This commit is contained in:
parent
0cbff4171b
commit
573a8e2f4a
6 changed files with 250 additions and 0 deletions
82
FanControl/Program.cs
Normal file
82
FanControl/Program.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
|
||||
namespace FanControl
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
public class UpdateVisitor : IVisitor
|
||||
{
|
||||
public void VisitComputer(IComputer computer)
|
||||
{
|
||||
computer.Traverse(this);
|
||||
}
|
||||
public void VisitHardware(IHardware hardware)
|
||||
{
|
||||
hardware.Update();
|
||||
foreach (IHardware subHardware in hardware.SubHardware) subHardware.Accept(this);
|
||||
}
|
||||
public void VisitSensor(ISensor sensor) { }
|
||||
public void VisitParameter(IParameter parameter) { }
|
||||
}
|
||||
|
||||
public static void Monitor()
|
||||
{
|
||||
Computer computer = new Computer
|
||||
{
|
||||
IsCpuEnabled = true,
|
||||
IsGpuEnabled = true,
|
||||
IsMemoryEnabled = true,
|
||||
IsMotherboardEnabled = true,
|
||||
IsControllerEnabled = true,
|
||||
IsNetworkEnabled = true,
|
||||
IsStorageEnabled = true
|
||||
};
|
||||
|
||||
computer.Open();
|
||||
computer.Accept(new UpdateVisitor());
|
||||
|
||||
foreach (IHardware hardware in computer.Hardware)
|
||||
{
|
||||
Console.WriteLine("Hardware: {0}", hardware.Name);
|
||||
|
||||
foreach (IHardware subhardware in hardware.SubHardware)
|
||||
{
|
||||
Console.WriteLine("\tSubhardware: {0}", subhardware.Name);
|
||||
|
||||
foreach (ISensor sensor in subhardware.Sensors)
|
||||
{
|
||||
Console.WriteLine("\t\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ISensor sensor in hardware.Sensors)
|
||||
{
|
||||
Console.WriteLine("\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
|
||||
}
|
||||
}
|
||||
|
||||
computer.Close();
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Monitor();
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(300);
|
||||
|
||||
Vlv0100.SetFanControl(false);
|
||||
Vlv0100.SetFanDesiredRPM(6000);
|
||||
|
||||
Console.WriteLine("Fan RPM: {0}", Vlv0100.GetFanRPM());
|
||||
Console.WriteLine("Fan Desired RPM: {0}", Vlv0100.GetFanDesiredRPM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue