Skip to content

Commit

Permalink
Merge pull request #87 from Smeat/minimum_curve_fix
Browse files Browse the repository at this point in the history
Fix "minimum" fan curve
  • Loading branch information
markusressel authored Feb 3, 2022
2 parents 16f134f + c764d00 commit 5ee84eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/curves/curve.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (c functionSpeedCurve) Evaluate() (value int, err error) {
delta := dmax - dmin
return int(delta), nil
case configuration.FunctionMinimum:
var min float64
var min float64 = 255
for _, v := range values {
min = math.Min(min, float64(v))
}
Expand Down
4 changes: 2 additions & 2 deletions internal/curves/curve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func TestFunctionCurveDelta(t *testing.T) {

func TestFunctionCurveMinimum(t *testing.T) {
// GIVEN
temp1 := 40000.0
temp1 := 60000.0
temp2 := 80000.0

s1 := MockSensor{
Expand Down Expand Up @@ -319,7 +319,7 @@ func TestFunctionCurveMinimum(t *testing.T) {
}

// THEN
assert.Equal(t, 0, result)
assert.Equal(t, 127, result)
}

func TestFunctionCurveMaximum(t *testing.T) {
Expand Down

0 comments on commit 5ee84eb

Please sign in to comment.