Skip to content

Commit a261160

Browse files
authored
Merge pull request #175 from Jiogo18/fan_speed_2_bytes
Fixed high fan speed displayed on low RPM
2 parents 256cf3b + ab36c70 commit a261160

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/operate.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,20 @@ int Operate::getGpuTemp() const {
162162
}
163163

164164
int Operate::getFan1Speed() const {
165-
int value = helper.getValue(fan1Address);
165+
// Read 2 bytes (big-endian)
166+
int value0 = helper.getValue(fan1Address);
167+
int value1 = helper.getValue(fan1Address - 1);
168+
int value = (value1 << 8) | value0;
166169
if (value > 0)
167170
return 470000 / value;
168171
return value;
169172
}
170173

171174
int Operate::getFan2Speed() const {
172-
int value = helper.getValue(fan2Address);
175+
// Read 2 bytes (big-endian)
176+
int value0 = helper.getValue(fan2Address);
177+
int value1 = helper.getValue(fan2Address - 1);
178+
int value = (value1 << 8) | value0;
173179
if (value > 0)
174180
return 470000 / value;
175181
return value;

0 commit comments

Comments
 (0)