-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
17,443 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FanCtrl | ||
{ | ||
public class LiquidctlControl : BaseControl | ||
{ | ||
public string DeviceName { get; set; } | ||
|
||
public string Address { get; set; } | ||
|
||
public string ChannelName { get; set; } | ||
|
||
public LiquidctlControl(int index, string deviceName, string name, string address, string channelName) : base(LIBRARY_TYPE.Liquidctl) | ||
{ | ||
ID = string.Format("liquidctl/{0}/{1}/Control/{2}", deviceName, address, index); | ||
DeviceName = deviceName; | ||
Name = name; | ||
Address = address; | ||
ChannelName = channelName; | ||
Value = LastValue = NextValue = 50; | ||
} | ||
|
||
public override int setSpeed(int value) | ||
{ | ||
if (Address.Length == 0 || ChannelName.Length == 0) | ||
return Value; | ||
|
||
Task.Run(() => { | ||
var p = new Process(); | ||
p.StartInfo.FileName = LiquidctlManager.getInstance().LiquidctlPath; | ||
p.StartInfo.Arguments = string.Format("--address \"{0}\" set {1} speed {2}", Address, ChannelName, NextValue); | ||
p.StartInfo.CreateNoWindow = true; | ||
p.StartInfo.UseShellExecute = false; | ||
if (p.Start() == true) | ||
{ | ||
p.Close(); | ||
} | ||
}); | ||
|
||
Value = LastValue = NextValue = value; | ||
return value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FanCtrl | ||
{ | ||
public class LiquidctlSpeed : BaseSensor | ||
{ | ||
private LiquidctlStatusData mLiquidctlStatusData; | ||
|
||
public LiquidctlSpeed(LiquidctlStatusData statusData) : base(LIBRARY_TYPE.Liquidctl) | ||
{ | ||
ID = string.Format("liquidctl/{0}/{1}/{2}/Fan", statusData.LiquidctlData.Description, statusData.LiquidctlData.Address, statusData.Key); | ||
Name = statusData.Key; | ||
mLiquidctlStatusData = statusData; | ||
} | ||
|
||
public override string getString() | ||
{ | ||
return Value + " RPM"; | ||
} | ||
public override void update() | ||
{ | ||
try | ||
{ | ||
double value = double.Parse(mLiquidctlStatusData.Value); | ||
Value = (int)Math.Round(value); | ||
} | ||
catch { } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FanCtrl | ||
{ | ||
public class LiquidctlTemp : BaseSensor | ||
{ | ||
private LiquidctlStatusData mLiquidctlStatusData; | ||
|
||
public LiquidctlTemp(LiquidctlStatusData statusData) : base(LIBRARY_TYPE.Liquidctl) | ||
{ | ||
ID = string.Format("liquidctl/{0}/{1}/{2}/Temp", statusData.LiquidctlData.Description, statusData.LiquidctlData.Address, statusData.Key); | ||
Name = statusData.Key; | ||
mLiquidctlStatusData = statusData; | ||
} | ||
|
||
public override string getString() | ||
{ | ||
if (OptionManager.getInstance().IsFahrenheit == true) | ||
return Util.getFahrenheit(Value) + " °F"; | ||
else | ||
return Value + " °C"; | ||
} | ||
public override void update() | ||
{ | ||
try | ||
{ | ||
double value = double.Parse(mLiquidctlStatusData.Value); | ||
Value = (int)Math.Round(value); | ||
} | ||
catch { } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace FanCtrl | ||
{ | ||
public class LiquidctlData | ||
{ | ||
public string Bus { get; set; } | ||
|
||
public string Address { get; set; } | ||
|
||
public string Description { get; set; } | ||
|
||
private List<LiquidctlStatusData> mStatusDataList = new List<LiquidctlStatusData>(); | ||
private object mLock = new object(); | ||
|
||
public int getStatusCount() | ||
{ | ||
Monitor.Enter(mLock); | ||
int count = mStatusDataList.Count; | ||
Monitor.Exit(mLock); | ||
return count; | ||
} | ||
|
||
public LiquidctlStatusData getStatusData(int index) | ||
{ | ||
Monitor.Enter(mLock); | ||
if (index >= mStatusDataList.Count) | ||
{ | ||
Monitor.Exit(mLock); | ||
return null; | ||
} | ||
var data = mStatusDataList[index]; | ||
Monitor.Exit(mLock); | ||
return data; | ||
} | ||
|
||
public void addStatusData(LiquidctlStatusData data) | ||
{ | ||
Monitor.Enter(mLock); | ||
mStatusDataList.Add(data); | ||
Monitor.Exit(mLock); | ||
} | ||
} | ||
} |
Oops, something went wrong.