[arm-allstar] Shari Node Fan Control? Take #2, bugfix
David McGough
kb4fxc at inttek.net
Mon May 31 09:15:45 EDT 2021
Someone just pointed out that on some RPi boards, the temperature reported
from the vcgencmd command needs to be converted to an integer or the bash
script tests fail....So, for example, if the reported temp is: 44.4, it
needs to be converted to 44. I updated the script, below, to fix this.
73, David KB4FXC
###################################################################################
#!/bin/bash
#
# Simple CPU temp monitor script. KB4FXC 2021-05-31
#
hi=60
lo=50
fanstate=unknown
function fan_on
{
echo "fan on"
}
function fan_off
{
echo "fan off"
}
while true ; do
temp=$(/opt/vc/bin/vcgencmd measure_temp | awk -F= '{j=$2 - 0; print int(j)}')
[ $temp -ge $hi ] && fanneeded=on
[ $temp -le $lo ] && fanneeded=off
if [ "$fanstate" != "$fanneeded" ] ; then
[ "$fanneeded" = "on" ] && fan_on
[ "$fanneeded" = "off" ] && fan_off
fanstate=$fanneeded
fi
sleep 5
done
###################################################################################
More information about the ARM-allstar
mailing list