Revert changes
This commit is contained in:
@@ -16,11 +16,20 @@ fi
|
|||||||
x=$(urldecode "$atcmd")
|
x=$(urldecode "$atcmd")
|
||||||
MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}")
|
MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}")
|
||||||
if [ -n "${MYATCMD}" ]; then
|
if [ -n "${MYATCMD}" ]; then
|
||||||
# Capture the response and remove ANSI color codes using awk
|
# Initialize wait time to 200 ms
|
||||||
runcmd=$(atcmd11 '$x' | awk '{ gsub(/\x1B\[[0-9;]*[mG]/, "") }1')
|
wait_time=200
|
||||||
|
while true; do
|
||||||
|
runcmd=$(echo -en "$x\r\n" | microcom -t $wait_time /dev/ttyOUT2)
|
||||||
|
# Check if "OK" or "ERROR" is present in the response
|
||||||
|
if [[ $runcmd =~ "OK" ]] || [[ $runcmd =~ "ERROR" ]]; then
|
||||||
|
break # Exit the loop if "OK" or "ERROR" is found
|
||||||
|
fi
|
||||||
|
# If neither "OK" nor "ERROR" is found, increment wait time by 1 second
|
||||||
|
((wait_time++))
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Content-type: text/plain"
|
echo "Content-type: text/plain"
|
||||||
echo $x
|
echo $x
|
||||||
echo ""
|
echo ""
|
||||||
echo "$runcmd"
|
echo $runcmd
|
||||||
|
|||||||
Reference in New Issue
Block a user