Browse Source

Adjust ublox gsm location

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
v_master
Sara Damiano 5 years ago
parent
commit
badcee518e
2 changed files with 15 additions and 4 deletions
  1. +2
    -2
      examples/AllFunctions/AllFunctions.ino
  2. +13
    -2
      src/TinyGsmClientUBLOX.h

+ 2
- 2
examples/AllFunctions/AllFunctions.ino View File

@ -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;
} }


+ 13
- 2
src/TinyGsmClientUBLOX.h View File

@ -390,8 +390,19 @@ class TinyGsmUBLOX
*/ */
protected: protected:
String getGsmLocationImpl() { String getGsmLocationImpl() {
sendAT(GF("+ULOC=2,3,0,120,1"));
if (waitResponse(30000L, GF(GSM_NL "+UULOC:")) != 1) { return ""; }
// AT+ULOC=<mode>,<sensor>,<response_type>,<timeout>,<accuracy>
// <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();


Loading…
Cancel
Save