From 74973edf267dc9517707371f01e592cc989c4b8c Mon Sep 17 00:00:00 2001 From: Marc Hoppe Date: Sun, 16 Dec 2012 18:39:14 +0100 Subject: [PATCH] fancontrol --- fancontrol | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fancontrol b/fancontrol index b07ccfd..d5fab3a 100755 --- a/fancontrol +++ b/fancontrol @@ -335,21 +335,20 @@ function UpdateFanSpeeds { echo "pwmpval=$pwmpval" echo "fanval=$fanval" fi - - if (( $tval <= $offt )) - then pwmval=$minpwm # below min temp, use defined min pwm - elif (( $tval >= $maxt )) - then pwmval=$maxpwm # over max temp, use defined max pwm - elif(( $tval > $mint )) - then + if (( $tval <= $offt )); then + pwmval=$minpwm # below min temp, use defined min pwm + elif (( $tval >= $maxt )); then + pwmval=$maxpwm # over max temp, use defined max pwm + elif(( $tval > $mint )); then + pwmval=$maxpwm # over max temp, use defined max pwm # calculate the new value from temperature and settings - pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}" - if [ $pwmpval -eq 0 -o $fanval -eq 0 ] - then # if fan was stopped start it using a safe value - echo $minsa > $pwmo - # Sleep while still handling signals - read < <(exec sleep 1) - fi + #pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}" + #if [ $pwmpval -eq 0 -o $fanval -eq 0 ] + #then # if fan was stopped start it using a safe value + # echo $minsa > $pwmo + # # Sleep while still handling signals + # read < <(exec sleep 1) + #fi #else ( > offt and < mint ) # keep running on current value fi @@ -382,6 +381,7 @@ do done echo 'Starting automatic fan control...' +pwmval=$maxpwm # main loop calling the main function at specified intervals while true