Skip to content

Commit 69fb2ae

Browse files
committed
Add special fan 7 for MSI MEG Z790 GODLIKE MAX.
* Add optional temperature sensors. * Rename pump fan.
1 parent 8a2e45b commit 69fb2ae

2 files changed

Lines changed: 55 additions & 23 deletions

File tree

OpenHardwareMonitorLib/Hardware/Motherboard/Lpc/Nct677X.cs

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Diagnostics;
66
using System.Diagnostics.CodeAnalysis;
77
using System.Globalization;
8+
using System.Linq;
89
using System.Text;
910
using System.Threading;
1011

@@ -393,7 +394,7 @@ public Nct677X(LpcPort lpcPort, Chip chip, byte revision, ushort port)
393394
case Chip.NCT6683D:
394395
case Chip.NCT6686D:
395396
case Chip.NCT6687D:
396-
Fans = new float?[16];
397+
Fans = new float?[17];
397398
Controls = new float?[8];
398399
Voltages = new float?[14];
399400
Temperatures = new float?[11];
@@ -441,7 +442,7 @@ public Nct677X(LpcPort lpcPort, Chip chip, byte revision, ushort port)
441442
_voltageRegisters = [0x120, 0x122, 0x124, 0x126, 0x128, 0x12A, 0x12C, 0x12E, 0x130, 0x13A, 0x13E, 0x136, 0x138, 0x13C];
442443

443444
// CPU Fan
444-
// PUMP Fan
445+
// PUMP Fan 1
445446
// SYS Fan 1 on some older NCT6687Ds, Nil on others
446447
// SYS Fan 2 on some older NCT6687Ds, EZConn on others
447448
// SYS Fan 3 on some older NCT6687Ds
@@ -454,7 +455,17 @@ public Nct677X(LpcPort lpcPort, Chip chip, byte revision, ushort port)
454455
// SYS Fan 3 on newer NCT6687Ds
455456
// SYS Fan 2 on newer NCT6687Ds
456457
// SYS Fan 1 on newer NCT6687Ds
457-
_fanRpmRegister = [0x140, 0x142, 0x144, 0x146, 0x148, 0x14A, 0x14C, 0x14E, 0x150, 0x152, 0x154, 0x156, 0x158, 0x15A, 0x15C, 0x15E];
458+
// SYS Fan 7 on some NCT6687Ds - 0x852 (e.g. Z790 GODLIKE MAX)
459+
_fanRpmRegister = [0x140, 0x142, 0x144, 0x146, 0x148, 0x14A, 0x14C, 0x14E, 0x150, 0x152, 0x154, 0x156, 0x158, 0x15A, 0x15C, 0x15E, 0x852];
460+
461+
// On some boards, there will be SYS Fan 7 (e.g. MSI MEG Z790 GODLIKE MAX)
462+
_fanCountRegister = [0x852];
463+
464+
// max value for 13-bit fan counter
465+
_maxFanCount = 0x1FFF;
466+
467+
// min value that could be transferred to 16-bit RPM registers
468+
_minFanCount = 0x15;
458469

459470
_restoreDefaultFanControlRequired = new bool[_fanRpmRegister.Length];
460471
_initialFanControlMode = new byte[_fanRpmRegister.Length];
@@ -518,7 +529,7 @@ public Nct677X(LpcPort lpcPort, Chip chip, byte revision, ushort port)
518529
// NOTHING
519530
// NOTHING
520531
// NOTHING
521-
// NOTHING
532+
// SYS Fan 7 0x152
522533
// SYS Fan 1 0x15E
523534
// SYS Fan 2 0x15C
524535
// SYS Fan 3 0x15A
@@ -820,6 +831,28 @@ public void Update()
820831
Temperatures[i] = temperature;
821832
}
822833

834+
void Update13BitFan(int i, byte low, byte high)
835+
{
836+
int count = (high << 5) | (low & 0x1F);
837+
if (count < _maxFanCount)
838+
{
839+
if (count >= _minFanCount)
840+
{
841+
Fans[i] = 1.35e6f / count;
842+
}
843+
else
844+
{
845+
Fans[i] = null;
846+
}
847+
}
848+
else
849+
{
850+
Fans[i] = 0;
851+
}
852+
}
853+
854+
var fcrList = _fanCountRegister?.ToList() ?? new List<ushort>();
855+
823856
for (int i = 0; i < Fans.Length; i++)
824857
{
825858
if (Chip is not Chip.NCT6683D and not Chip.NCT6686D and not Chip.NCT6687D and not Chip.NCT6687DR)
@@ -829,22 +862,7 @@ public void Update()
829862
byte high = ReadByte(_fanCountRegister[i]);
830863
byte low = ReadByte((ushort)(_fanCountRegister[i] + 1));
831864

832-
int count = (high << 5) | (low & 0x1F);
833-
if (count < _maxFanCount)
834-
{
835-
if (count >= _minFanCount)
836-
{
837-
Fans[i] = 1.35e6f / count;
838-
}
839-
else
840-
{
841-
Fans[i] = null;
842-
}
843-
}
844-
else
845-
{
846-
Fans[i] = 0;
847-
}
865+
Update13BitFan(i, low, high);
848866
}
849867
else
850868
{
@@ -857,7 +875,18 @@ public void Update()
857875
}
858876
else
859877
{
860-
Fans[i] = (ReadByte(_fanRpmRegister[i]) << 8) | ReadByte((ushort)(_fanRpmRegister[i] + 1));
878+
byte high = ReadByte(_fanRpmRegister[i]);
879+
byte low = ReadByte((ushort)(_fanRpmRegister[i] + 1));
880+
881+
//13-bit fan ?
882+
if (fcrList.Contains(_fanRpmRegister[i]))
883+
{
884+
Update13BitFan(i, low, high);
885+
}
886+
else
887+
{
888+
Fans[i] = (high << 8) | low;
889+
}
861890
}
862891
}
863892

OpenHardwareMonitorLib/Hardware/Motherboard/SuperIOHardware.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,22 +549,25 @@ private static void GetBoardSpecificConfiguration
549549
t.Add(new Temperature("VRM MOS", 2));
550550
t.Add(new Temperature("PCH", 3));
551551
t.Add(new Temperature("CPU Socket", 4));
552+
t.Add(new Temperature("Temperature Sensor 1", 5));
553+
t.Add(new Temperature("Temperature Sensor 2", 6));
552554
t.Add(new Temperature("PCIe #1", 7));
553555
t.Add(new Temperature("PCIe #2", 8));
554556
t.Add(new Temperature("M2 #1", 9));
555557
t.Add(new Temperature("M2 #4", 10));
556558

557559
f.Add(new Fan("CPU Fan", 0));
558-
f.Add(new Fan("Pump Fan", 1));
560+
f.Add(new Fan("Pump Fan #1", 1));
559561
f.Add(new Fan("System Fan #1", 2));
560562
f.Add(new Fan("System Fan #2", 3));
561563
f.Add(new Fan("System Fan #3", 4));
562564
f.Add(new Fan("System Fan #4", 5));
563565
f.Add(new Fan("System Fan #5", 6));
564566
f.Add(new Fan("System Fan #6", 7));
567+
f.Add(new Fan("System Fan #7", 16));
565568

566569
c.Add(new Control("CPU Fan", 0));
567-
c.Add(new Control("Pump Fan", 1));
570+
c.Add(new Control("Pump Fan #1", 1));
568571
c.Add(new Control("System Fan #1", 2));
569572
c.Add(new Control("System Fan #2", 3));
570573
c.Add(new Control("System Fan #3", 4));

0 commit comments

Comments
 (0)