Skip to content

Commit

Permalink
Revert fan RPM "optimisation" due to breakage
Browse files Browse the repository at this point in the history
Integer math, my beloved...
  • Loading branch information
Sparronator9999 committed Dec 19, 2024
1 parent 3f6132b commit 31d87d7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions YAMDCC.Service/FanControlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -590,21 +590,20 @@ private int GetFanRPM(int clientId, string args)
if (success)
{
int rpm;
if (rpmValue <= 0)
#pragma warning disable IDE0045 // Supress "if statement can be simplified" suggestion
if (cfg.RPMConf.Invert)
{
rpm = 0;
rpm = cfg.RPMConf.DivideByMult
? cfg.RPMConf.RPMMult / rpmValue
: 1 / (rpmValue * cfg.RPMConf.RPMMult);
}
else
{
rpm = cfg.RPMConf.DivideByMult
? rpmValue / cfg.RPMConf.RPMMult
: rpmValue * cfg.RPMConf.RPMMult;

if (cfg.RPMConf.Invert)
{
rpm = 1 / rpm;
}
}
#pragma warning restore IDE0045
IPCServer.PushMessage(new ServiceResponse(
Response.FanRPM, $"{rpm}"), clientId);
return 0;
Expand Down

0 comments on commit 31d87d7

Please sign in to comment.