From beb80763d803a7725b20a9a46963ce5c9b719dce Mon Sep 17 00:00:00 2001 From: fujr Date: Wed, 13 Nov 2024 21:10:19 +0800 Subject: [PATCH] fix temperature display --- luci/luci-app-qmodem/root/usr/share/qmodem/quectel.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/quectel.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/quectel.sh index 8aceec0..653683e 100755 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/quectel.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/quectel.sh @@ -305,10 +305,13 @@ get_temperature() local line=1 QTEMP=$(at ${at_port} ${at_command} | grep "+QTEMP:") for line in $( echo -e "$QTEMP" ); do - temp=$(echo $line | grep -o "[0-9]\{1,3\}") - if [ -n "$temp" ]; then - break - fi + templine=$(echo $line | grep -o "[0-9]\{1,3\}") + for tmp in $(echo $templine); do + [ "$tmp" -gt 0 ] && [ "$tmp" -lt 255 ] && temp=$tmp + if [ -n "$temp" ]; then + break + fi + done done if [ -n "$temp" ]; then temp="${temp}$(printf "\xc2\xb0")C"