FanControl: Support OLED BIOS 107 with temperature readings

This commit is contained in:
Kamil Trzciński 2023-12-14 10:46:19 +01:00
parent fe644f3e48
commit 9c7c7bfd1d
4 changed files with 33 additions and 17 deletions

View file

@ -12,7 +12,7 @@ namespace FanControl
"APU", new FanSensor()
{
// TODO: Is this correct?
HardwareName = "AMD Custom APU 0405",
HardwareNames = { "AMD Custom APU 0405", "AMD Custom APU 0932" },
HardwareType = HardwareType.Cpu,
SensorName = "Package",
SensorType = SensorType.Power,
@ -48,7 +48,7 @@ namespace FanControl
{
"CPU", new FanSensor()
{
HardwareName = "AMD Custom APU 0405",
HardwareNames = { "AMD Custom APU 0405", "AMD Custom APU 0932" },
HardwareType = HardwareType.Cpu,
SensorName = "Core (Tctl/Tdie)",
SensorType = SensorType.Temperature,
@ -84,11 +84,12 @@ namespace FanControl
{
"GPU", new FanSensor()
{
HardwareName = "AMD Custom GPU 0405",
HardwareNames = { "AMD Custom GPU 0405", "AMD Custom GPU 0932" },
HardwareType = HardwareType.GpuAmd,
SensorName = "GPU Core",
SensorType = SensorType.Temperature,
ValueDeadZone = 0.0f,
InvalidValue = 5.0f,
AvgSamples = 20,
Profiles = new Dictionary<FanMode, FanSensor.Profile>()
{

View file

@ -13,9 +13,11 @@ namespace FanControl
public float ValueDeadZone { get; set; }
public int AvgSamples { get; set; } = 5;
public float InvalidValue { get; set; } = 0.0f;
public float? MaxValue { get; set; }
internal string HardwareName { get; set; } = "";
internal IList<string> HardwareNames { get; set; } = new List<string>();
internal HardwareType HardwareType { get; set; }
internal string SensorName { get; set; } = "";
internal SensorType SensorType { get; set; }
@ -132,11 +134,29 @@ namespace FanControl
CalculatedRPM = 0;
}
private bool MatchesHardwareName(string sensorHardwareName)
{
if (HardwareNames.Count > 0)
{
if (HardwareNames.Any(hardwareName => sensorHardwareName.StartsWith(hardwareName)))
return true;
}
// Empty string matches always
if (HardwareName.Length == 0)
return true;
if (sensorHardwareName.StartsWith(HardwareName))
return true;
return false;
}
public bool Matches(ISensor sensor)
{
return sensor != null &&
sensor.Hardware.HardwareType == HardwareType &&
sensor.Hardware.Name.StartsWith(HardwareName) &&
MatchesHardwareName(sensor.Hardware.Name) &&
sensor.SensorType == SensorType &&
sensor.Name == SensorName;
}
@ -156,7 +176,7 @@ namespace FanControl
public bool Update(string name, float? newValue, FanMode mode)
{
if (!newValue.HasValue || newValue <= 0.0)
if (!newValue.HasValue || newValue <= InvalidValue)
return false;
if (MaxValue.HasValue)

View file

@ -165,7 +165,7 @@ namespace PerformanceOverlay
"CPU_%", new HardwareSensor()
{
HardwareType = HardwareType.Cpu,
HardwareName = "AMD Custom APU 0405",
HardwareNames = { "AMD Custom APU 0405", "AMD Custom APU 0932" },
SensorType = SensorType.Load,
SensorName = "CPU Total",
Format = "F0"
@ -175,7 +175,7 @@ namespace PerformanceOverlay
"CPU_W", new HardwareSensor()
{
HardwareType = HardwareType.Cpu,
HardwareName = "AMD Custom APU 0405",
HardwareNames = { "AMD Custom APU 0405", "AMD Custom APU 0932" },
SensorType = SensorType.Power,
SensorName = "Package",
Format = "F1"
@ -185,7 +185,7 @@ namespace PerformanceOverlay
"CPU_T", new HardwareSensor()
{
HardwareType = HardwareType.Cpu,
HardwareName = "AMD Custom APU 0405",
HardwareNames = { "AMD Custom APU 0405", "AMD Custom APU 0932" },
SensorType = SensorType.Temperature,
SensorName = "Core (Tctl/Tdie)",
Format = "F1",
@ -201,7 +201,7 @@ namespace PerformanceOverlay
return new HardwareSensor()
{
HardwareType = HardwareType.Cpu,
HardwareName = "AMD Custom APU 0405",
HardwareNames = { "AMD Custom APU 0405", "AMD Custom APU 0932" },
SensorType = SensorType.Clock,
SensorName = "Core #" + index.ToString(),
Format = "F0",

View file

@ -4,16 +4,11 @@
[**READ IF PLAYING ONLINE GAMES AND/OR GAMES THAT HAVE ANTI-CHEAT ENABLED**](https://steam-deck-tools.ayufan.dev/#anti-cheat-and-antivirus-software)
## SteamDeck OLED support
- There's incorrect CPU temperature reading
- There's a lack of GPU frequency reading
## #{GIT_TAG_NAME}
## 0.7.1
- SteamDeck OLED: Support bios 107
- SteamDeck OLED: Support Bios 107 with temperature readings
## 0.7.0