summaryrefslogtreecommitdiff
path: root/package/comgt/files/waitready.comgt
blob: 0de4df5d480f68a6b281e151d9641e5be96b2aae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# wait till the sim is ready
opengt
 set com 115200n81
 set senddelay 0.02
 waitquiet 1 0.2
 flash 0.1
:start
 print "Waiting for SIM..."
 let c=0
:waitready
 send "AT+CPIN?^m"
 waitfor 2 "SIM PUK","SIM PIN","READY","ERROR","ERR"
 if % = -1 goto tryagain
 if % = 0 goto simready
 if % = 1 goto simready
 if % = 2 goto simready
 if % = 3 goto tryagain
 if % = 4 goto tryagain

:tryagain
 if c > 120 goto waittimeout
 let c=c+2
 print "."
 goto waitready

:waittimeout
 print " Timeout
"
 exit 1

:simready
 print " OK
"
 exit 0