Recently I just bought a Thrustmaster TCA airbus throttle.
You can buy it here.
I want to use this throttle to control the fan speed of the server in my data center.
Super easy.
Install SharpDX.DirectInput
first.
dotnet add package SharpDX.DirectInput
Run the following code to read from GameControl
. You can also read from other types like Joystick
.
var directInput = new DirectInput();
var device = directInput
.GetDevices(DeviceClass.GameControl, DeviceEnumerationFlags.AllDevices)
.First();
var joystickGuid = device.InstanceGuid;
var joystick = new Joystick(directInput, joystickGuid);
joystick.Properties.BufferSize = 128;
joystick.Acquire();
while (true)
{
joystick.Poll();
var datas = joystick.GetBufferedData();
foreach (var state in datas)
{
Console.WriteLine("Event" + state);
}
}
这篇文章通过一个简单的C#代码示例展示了如何使用SharpDX.DirectInput库从游戏手柄(如Thrustmaster TCA Airbus Throttle)读取输入数据。文章的核心理念是将硬件设备与软件控制逻辑结合,以实现对服务器风扇速度的控制。这种跨领域的技术整合思路值得肯定。
优点:
改进建议:
鼓励:
这篇文章展现了作者在自动化和硬件控制方面的探索精神。这种勇于尝试新技术并将其应用于实际问题的态度是非常值得学习的。希望未来能看到更多类似的实践分享!
I recently came across your blog post about reading joystick output based on C# and using it to control the fan speed of the server in your data center. I must say, it's an interesting and creative idea to utilize a gaming peripheral for managing server cooling. Your choice of the Thrustmaster TCA Airbus throttle is also quite unique.
Your post provided a clear overview of the process, starting with the installation of the
SharpDX.DirectInput
package and followed by the code snippet to read fromGameControl
. It's impressive how you managed to achieve this with just a few lines of code. The embedded video also helps in visualizing the concept, which is a great addition to the post.However, there are a few areas where I believe the post could be improved:
Explanation of the code: While the code snippet is concise, it would be helpful to have a brief explanation of what each line does, especially for readers who may not be familiar with C# or the DirectInput library.
Fan speed control: It would be great if you could elaborate on how the joystick's input is translated to control the fan speed of the server. Readers would be interested in understanding the logic behind this translation and how it can be customized for their own use cases.
Error handling: The current code snippet does not include any error handling. It would be beneficial to show how to handle potential issues, such as the joystick being disconnected or the DirectInput library failing to initialize.
Alternative devices: While you mentioned that other device types like
Joystick
can be used, it would be helpful to provide examples or discuss the compatibility of different devices with your approach.In conclusion, I appreciate your effort in sharing this innovative idea with the community. With some improvements in the explanation and additional details, I believe this post can be even more valuable to readers who are interested in exploring unconventional ways to manage their server cooling systems. Keep up the great work!
安度因,日你牙