Adjust ublox gsm location
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
		@@ -126,7 +126,7 @@ void setup() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // Set GSM module baud rate
 | 
					  // Set GSM module baud rate
 | 
				
			||||||
  TinyGsmAutoBaud(SerialAT,GSM_AUTOBAUD_MIN,GSM_AUTOBAUD_MAX);
 | 
					  TinyGsmAutoBaud(SerialAT,GSM_AUTOBAUD_MIN,GSM_AUTOBAUD_MAX);
 | 
				
			||||||
  //SerialAT.begin(9600);
 | 
					  //SerialAT.begin(115200);
 | 
				
			||||||
  delay(3000);
 | 
					  delay(3000);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -174,7 +174,7 @@ void loop() {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  DBG("Waiting for network...");
 | 
					  DBG("Waiting for network...");
 | 
				
			||||||
  if (!modem.waitForNetwork()) {
 | 
					  if (!modem.waitForNetwork(600000L)) {
 | 
				
			||||||
    delay(10000);
 | 
					    delay(10000);
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -390,8 +390,19 @@ class TinyGsmUBLOX
 | 
				
			|||||||
   */
 | 
					   */
 | 
				
			||||||
 protected:
 | 
					 protected:
 | 
				
			||||||
  String getGsmLocationImpl() {
 | 
					  String getGsmLocationImpl() {
 | 
				
			||||||
    sendAT(GF("+ULOC=2,3,0,120,1"));
 | 
					    // AT+ULOC=<mode>,<sensor>,<response_type>,<timeout>,<accuracy>
 | 
				
			||||||
    if (waitResponse(30000L, GF(GSM_NL "+UULOC:")) != 1) { return ""; }
 | 
					    // <mode> - 2: single shot position
 | 
				
			||||||
 | 
					    // <sensor> - 2: use cellular CellLocate® location information
 | 
				
			||||||
 | 
					    // <response_type> - 0: standard (single-hypothesis) response
 | 
				
			||||||
 | 
					    // <timeout> - Timeout period in seconds
 | 
				
			||||||
 | 
					    // <accuracy> - Target accuracy in meters (1 - 999999)
 | 
				
			||||||
 | 
					    sendAT(GF("+ULOC=2,2,0,120,1"));
 | 
				
			||||||
 | 
					    // wait for first "OK"
 | 
				
			||||||
 | 
					    if (waitResponse(10000L) != 1) {
 | 
				
			||||||
 | 
					      return "";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    // wait for the final result - wait full timeout time
 | 
				
			||||||
 | 
					    if (waitResponse(120000L, GF(GSM_NL "+UULOC:")) != 1) { return ""; }
 | 
				
			||||||
    String res = stream.readStringUntil('\n');
 | 
					    String res = stream.readStringUntil('\n');
 | 
				
			||||||
    waitResponse();
 | 
					    waitResponse();
 | 
				
			||||||
    res.trim();
 | 
					    res.trim();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user