_lp_temp_sensors will now return the hottest temp

* the average may hide temp that are significantly higher than the other temps
* _lp_temp_sensors will also now use more values to calculate system temperature
This commit is contained in:
François Schmidts 2013-05-20 18:39:50 +02:00
parent 4c369bc458
commit 2f7cd163cd

View File

@ -1192,15 +1192,15 @@ _lp_load_color()
######################
_lp_temp_sensors() {
# Return the average system temperature we get through the sensors command
local count=0
# Return the hottest system temperature we get through the sensors command
local temperature=0
for i in $(sensors | grep -E "^(Core|temp).*°(C|F)" |
for i in $(sensors | grep -E "^(CPU|SYS|MB|Core|temp).*°(C|F)" |
sed -r "s/.*: *\+([0-9]*)\..°.*/\1/g"); do
temperature=$(($temperature+$i))
count=$(($count+1))
if [[ $i -gt $temperature ]]; then
temperature=$i
fi
done
echo -ne "$(($temperature/$count))"
echo -ne "$temperature"
}
# Will set _lp_temp_function so the temperature monitoring feature use an