Jelajahi Sumber

guess we need to explicitly turn on the gps

Abram Connelly 6 tahun lalu
induk
melakukan
5a78caf31d
1 mengubah file dengan 24 tambahan dan 0 penghapusan
  1. 24 0
      busunit/scripts/reset-gps.py

+ 24 - 0
busunit/scripts/reset-gps.py

@@ -41,6 +41,30 @@ VERBOSE = True
 
 ser = serial.Serial(DEVGPS, GPS_BAUD, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=0, rtscts=0)
 
+###
+###
+
+
+if DEBUG: print "send:", "AT+CGPS=1"
+
+ser.write("AT+CGPS=1\r")
+ser.flush()
+resp = ser.readline()
+while (len(resp) > 0) and (resp[0] == '$'):
+  resp = ser.readline()
+if not  re.search(r'[aA][tT]', resp): print "WARNING: got response: '" + str(resp) + "', expecting 'OK'. continuing"
+resp = ser.readline()
+while (len(resp) > 0) and (resp[0] == '$'):
+  resp = ser.readline()
+if not  re.search(r'[oO][kK]', resp): print "WARNING: got response: '" + str(resp) + "', expecting 'OK'. continuing"
+
+if DEBUG: print "got:", resp
+
+time.sleep(1)
+
+###
+###
+
 if DEBUG: print "send:", "AT+CGPSINFOCFG=" + str(FREQ_SECOND) + "," + str(BITMASK) 
 
 ser.write("AT+CGPSINFOCFG=" + str(FREQ_SECOND) + "," + str(BITMASK) + "\r")