Browse Source

Tweaks to SIM7000

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
v_master
Sara Damiano 5 years ago
parent
commit
fe323288c4
2 changed files with 18 additions and 5 deletions
  1. +12
    -4
      src/TinyGsmClientSIM7000.h
  2. +6
    -1
      src/TinyGsmClientSIM800.h

+ 12
- 4
src/TinyGsmClientSIM7000.h View File

@ -168,7 +168,14 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
// Enable Local Time Stamp for getting network time // Enable Local Time Stamp for getting network time
sendAT(GF("+CLTS=1")); sendAT(GF("+CLTS=1"));
if (waitResponse(10000L) != 1) { return false; }
if (waitResponse(10000L) != 1) { return false;
}
// Enable battery checks
sendAT(GF("+CBATCHK=1"));
if (waitResponse() != 1) {
return false;
}
int ret = getSimStatus(); int ret = getSimStatus();
// if the sim isn't ready and a pin has been provided, try to unlock the sim // if the sim isn't ready and a pin has been provided, try to unlock the sim
@ -209,8 +216,9 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
sendAT(GF("+CFUN=0")); sendAT(GF("+CFUN=0"));
if (waitResponse(10000L) != 1) { return false; } if (waitResponse(10000L) != 1) { return false; }
sendAT(GF("+CFUN=1,1")); sendAT(GF("+CFUN=1,1"));
if (waitResponse(10000L) != 1) { return false; }
delay(3000); // TODO(SRGDamia1): Test this delay
if (waitResponse(10000L) != 1) { return false;
}
waitResponse(60000L, GF("SMS Ready"));
return init(); return init();
} }
@ -233,7 +241,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
*/ */
public: public:
RegStatus getRegistrationStatus() { RegStatus getRegistrationStatus() {
return (RegStatus)getRegistrationStatusXREG("CGREG");
return (RegStatus)getRegistrationStatusXREG("CEREG");
} }
protected: protected:


+ 6
- 1
src/TinyGsmClientSIM800.h View File

@ -170,7 +170,12 @@ class TinyGsmSim800
// Enable Local Time Stamp for getting network time // Enable Local Time Stamp for getting network time
sendAT(GF("+CLTS=1")); sendAT(GF("+CLTS=1"));
if (waitResponse(10000L) != 1) { return false; }
if (waitResponse(10000L) != 1) { return false;
}
// Enable battery checks
sendAT(GF("+CBATCHK=1"));
waitResponse();
int ret = getSimStatus(); int ret = getSimStatus();
// if the sim isn't ready and a pin has been provided, try to unlock the sim // if the sim isn't ready and a pin has been provided, try to unlock the sim


Loading…
Cancel
Save