Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf695e5

Browse files
committed
If value is the same, skip
1 parent 25f2444 commit cf695e5

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

DeviceFanPluginControlSensor.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ public void Reset()
2727

2828
public void Set(float val)
2929
{
30-
var rounded = (int)Math.Round(val);
31-
_fan.SetFlatFanSpeedTable(rounded);
32-
Value = rounded;
30+
var roundedVal = (int)Math.Round(val);
31+
32+
if (roundedVal == Value)
33+
return;
34+
35+
_fan.SetFlatFanSpeedTable(roundedVal);
36+
Value = roundedVal;
3337
}
3438

3539
public void Update()

0 commit comments

Comments
 (0)