Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func (c *Config) String() string {

func main() {
config := loadConfigFromFlags()
fmt.Println(fmt.Sprintf("%v %v", APPLICATION_NAME, Version))
fmt.Println(config.String())
log.Println(fmt.Sprintf("%v %v", APPLICATION_NAME, Version))
log.Println(config.String())

pollingRateDuration := config.GetPollingRateDuration()

Expand All @@ -80,12 +80,11 @@ func main() {
float32(fanSpeedPercent),
)

fmt.Printf("CPU Temp: %v°C\tDesired Fan Speed: %v\tCurrent Fan Speed: %v\n", cpuTemp, desiredFanSpeedPercent, fanSpeedPercent)
if desiredFanSpeedPercent != math.MaxUint8 { // uint8 max represent maintain current fan speed
setFanSpeed(pin, desiredFanSpeedPercent)
fanSpeedPercent = desiredFanSpeedPercent
}

log.Printf("CPU Temp: %v°C\tFan Speed: %v%%\n", cpuTemp, fanSpeedPercent)
time.Sleep(pollingRateDuration)
}
}
Expand Down Expand Up @@ -133,8 +132,6 @@ func setFanSpeed(pin rpio.Pin, percent uint8) {
percent = 100
}

fmt.Printf("Setting fan speed to %v\n", percent)

pin.DutyCycleWithPwmMode(
uint32(percent),
100,
Expand Down
6 changes: 3 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

set -e

GOARCH=arm64 # Default arm64 because rpi target
GOOS=linux
CGO_ENABLED=0
export GOARCH=arm64 # Default arm64 because rpi target
export GOOS=linux
export CGO_ENABLED=0

while [[ $# -gt 0 ]]; do
case $1 in
Expand Down