Skip to content

Commit

Permalink
tweaking the numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
kybernetyk committed May 5, 2011
1 parent c9f1c95 commit ca7cdbd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include $(GOROOT)/src/Make.inc
TARG=mbpfand
GOFILES=\
config.go\
read.go\
sensor.go\
main.go

include $(GOROOT)/src/Make.cmd
13 changes: 9 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ const (
)

const (
g_min_temp = 40.0 //what we wish our temp would always be to set the fan to 0rpm
//chosing 40.0 here will make our fan spin @ 2000rpm @ 50.0C ...

g_min_fan_speed = 2000.0
)
var g_max_fan_speed float64 = 6200.0

const (
g_job_fire_time = 10.0 //how often the DoWork() function shall be called. time in seconds
)

var g_max_fan_speed float64 = 6200.0
type ModeType int32

const (
mode_Default = iota
mode_Aggressive
)

var g_opt_mode ModeType = mode_Default
10 changes: 7 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ import (
var control_chan chan string = make(chan string)

func calc_fan_speed(temp float64) float64 {
x := math.Log10(temp/g_min_temp)/math.Log10(2.0)*g_max_fan_speed
//clipping to min/max will be done by SetFanSpeed()
return x
switch (g_opt_mode) {
case mode_Default:
return math.Log10(temp/40.0) / 0.3 * g_max_fan_speed //quiet but not so cool
case mode_Aggressive:
return math.Log10(temp/30.0) / 0.35 * g_max_fan_speed //cooler but also louder
}
return g_min_fan_speed
}

//check temp, set speed
Expand Down
File renamed without changes.

0 comments on commit ca7cdbd

Please sign in to comment.