More resiliant soc temp reading when kernels fails to output proper data.
This commit is contained in:
parent
a50100eb1e
commit
5cb346e80f
@ -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
|
||||
|
||||
@ -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})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user