More resiliant soc temp reading when kernels fails to output proper data.

This commit is contained in:
Igor Pecovnik 2017-11-29 11:48:27 +01:00
parent a50100eb1e
commit 5cb346e80f
2 changed files with 4 additions and 4 deletions

View File

@ -34,8 +34,8 @@ function display() {
function getboardtemp() {
if [ -f /etc/armbianmonitor/datasources/soctemp ]; then
read raw_temp </etc/armbianmonitor/datasources/soctemp
if [ ${raw_temp} -le 200 ]; then
read raw_temp </etc/armbianmonitor/datasources/soctemp 2>/dev/null
if [ ! -z "${raw_temp##*[!0-9]*}" ] && [ "${raw_temp}" -le 200 ]; then
# Allwinner legacy kernels output degree C
board_temp=${raw_temp}
else

View File

@ -343,14 +343,14 @@ MonitorMode() {
echo -e "\n$(date "+%H:%M:%S"): --- $(printf "%5s" ${LoadAvg}) ${procStats}\c"
;;
esac
if [ "X${SocTemp}" != "Xn/a" ]; then
if [ "X${SocTemp}" != "Xn/a" ] && [ ! -z "${raw_temp##*[!0-9]*}" ]; then
read SocTemp <"${Sensors}/soctemp"
if [ ${SocTemp} -ge 1000 ]; then
SocTemp=$(awk '{printf ("%0.1f",$1/1000); }' <<<${SocTemp})
fi
echo -e " $(printf "%4s" ${SocTemp})°C\c"
fi
if [ "X${PMICTemp}" != "Xn/a" ]; then
if [ "X${PMICTemp}" != "Xn/a" ] && [ ! -z "${PMICTemp##*[!0-9]*}" ]; then
read PMICTemp <"${Sensors}/pmictemp"
if [ ${PMICTemp} -ge 1000 ]; then
PMICTemp=$(awk '{printf ("%0.1f",$1/1000); }' <<<${PMICTemp})