Cleanups to fancontrol:

* Use let for arithmetic evaluation. Patch taken from the Suse package.
* Kill old commented-out code.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4436 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-06-10 08:05:18 +00:00
1 parent 5804515677
commit 2b327cd4ad
2 files changed
+5 -41

No files matched your search

+1
View File
@@ -14,6 +14,7 @@ SVN HEAD
Program i2cdump: Use the new I2C block read function
Program isadump: Detect when address bit 7 is a busy flag
Fix Super-I/O exit sequence for Winbond/Fintek chips
Program fancontrol: Use let for arithmetic evaluation
Program pwmconfig: Use smaller steps for low PWM values
Program rrd: Support non-i2c devices (hwmon class)
Add missing shell declarations
+4 -41
View File
@@ -2,7 +2,7 @@
#
# Simple script implementing a temperature dependent fan speed control
#
# Version 0.63
# Version 0.64
#
# Usage: fancontrol [CONFIGFILE]
#
@@ -188,7 +188,7 @@ function restorefans()
do
pwmo=${AFCPWM[$fcvcount]}
pwmdisable $pwmo
fcvcount=$fcvcount+1
let fcvcount=$fcvcount+1
done
echo 'Verify fans have returned to full speed'
exit 1
@@ -287,7 +287,7 @@ function UpdateFanSpeeds {
then
echo "new pwmval=$pwmval"
fi
fcvcount=$fcvcount+1
let fcvcount=$fcvcount+1
done
}
@@ -302,7 +302,7 @@ do
echo "Error enabling PWM on $DIR/$pwmo"
restorefans
fi
fcvcount=$fcvcount+1
let fcvcount=$fcvcount+1
done
echo 'Starting automatic fan control...'
@@ -313,40 +313,3 @@ do
UpdateFanSpeeds
sleep $INTERVAL
done
# some old stuff/missing features, will clean this up soon
#if ( test "$regulationtype" = "quad" ) ; then
# while true ; do
# temp=`cat ${temp1} | cut -b 12-13`
# if (( ${temp} < ${mintemp} )) ;
# then pwm=0
# elif (( ${temp} > ${maxtemp} )) ;
# then pwm=255
# else
# pwm=`calc "((10/(${maxtemp}-${mintemp})*(${temp}-${mintemp}))^2/1000*(${maxtemp}-${mintemp})*(255-${minspeed})+${minspeed})"`
# #no optimization here for readability (or sloth :))
# fi ;
# echo $pwm > ${pwm1} ;
#
# sleep 10 ;
# done ;
#elif ( test "$regulationtype" = "exp" ) ; then
#add support for exponential calculation here
#else
# pwmconst=$[(255-${minspeed})/(${maxtemp}-${mintemp})]
# while true ; do
# let temp=`cat temp1 | cut -b 12-13` ;
# if (( ${temp} < ${mintemp} )) ;
# then pwm=0
# elif (( ${temp} > ${maxtemp} )) ;
# then pwm=255
# else
# pwm=$[(${temp}-${mintemp})*${pwmconst}+${minspeed}]
# fi ;
# echo $pwm > pwm2 ;
#
# sleep 10 ;
# done ;
#fi