mirror of
https://github.com/Fishwaldo/build.git
synced 2025-03-17 12:21:23 +00:00
Bugfix when temperature is not present or readings are invalid
This commit is contained in:
parent
dbca9c7ed3
commit
7f2337ed53
1 changed files with 11 additions and 6 deletions
|
@ -344,18 +344,23 @@ MonitorMode() {
|
|||
;;
|
||||
esac
|
||||
if [ "X${SocTemp}" != "Xn/a" ]; then
|
||||
read SocTemp <"${Sensors}/soctemp"
|
||||
if [ ${SocTemp} -ge 1000 ]; then
|
||||
read SocTemp <"${Sensors}/soctemp" 2>/dev/null
|
||||
if [ ! -z $(echo "$SocTemp" | grep -o "^[1-9][0-9]*\.\?[0-9]*$") ] && (( $(echo "${SocTemp} > 1000" |bc -l) )); then
|
||||
SocTemp=$(awk '{printf ("%0.1f",$1/1000); }' <<<${SocTemp})
|
||||
echo -e " $(printf "%4s" ${SocTemp})°C\c"
|
||||
else
|
||||
echo -e " n/a\c"
|
||||
fi
|
||||
echo -e " $(printf "%4s" ${SocTemp})°C\c"
|
||||
fi
|
||||
if [ "X${PMICTemp}" != "Xn/a" ]; then
|
||||
read PMICTemp <"${Sensors}/pmictemp"
|
||||
if [ ${PMICTemp} -ge 1000 ]; then
|
||||
read PMICTemp <"${Sensors}/pmictemp" 2>/dev/null
|
||||
if [ ! -z $(echo "$PMICTemp" | grep -o "^[1-9][0-9]*\.\?[0-9]*$") ] && (( $(echo "${PMICTemp} > 1000" |bc -l) )); then
|
||||
PMICTemp=$(awk '{printf ("%0.1f",$1/1000); }' <<<${PMICTemp})
|
||||
echo -e " $(printf "%4s" ${PMICTemp})°C\c"
|
||||
else
|
||||
echo -e " n/a\c"
|
||||
fi
|
||||
echo -e " $(printf "%4s" ${PMICTemp})°C\c"
|
||||
|
||||
fi
|
||||
[ "X${DCIN}" != "Xn/a" ] && \
|
||||
(DCINvoltage=$(awk '{printf ("%0.2f",$1/1000000); }' <"${DCIN}") ; echo -e " $(printf "%5s" ${DCINvoltage})V\c")
|
||||
|
|
Loading…
Add table
Reference in a new issue