From 50d7fb4b6b536780323d68e490eadc11b66d15eb Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 19 Mar 2019 10:38:26 -0400 Subject: [PATCH 1/2] Fix #199 --- src/TinyGsmClientUBLOX.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/TinyGsmClientUBLOX.h b/src/TinyGsmClientUBLOX.h index b50f420..7188ade 100644 --- a/src/TinyGsmClientUBLOX.h +++ b/src/TinyGsmClientUBLOX.h @@ -275,10 +275,15 @@ public: DBG(GF("### SARA N2 NB-IoT modems not supported!"), name); } int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); } - return (getSimStatus() == SIM_READY); } String getModemName() { @@ -383,7 +388,7 @@ public: if (waitResponse(10000L) != 1) { return false; } - delay(3000); + delay(3000); // TODO: Verify delay timing here return init(); } @@ -513,7 +518,7 @@ public: if (waitResponse() != 1) { return false; } - sendAT(GF("+URAT="), urat); // Radio Access Technology (RAT) selection + sendAT(GF("+URAT="), urat); // Radio Access Technology (RAT) selection if (waitResponse() != 1) { return false; } From 19c377b68a41a5196c84894e9d8e880c4a91b505 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 19 Mar 2019 10:39:57 -0400 Subject: [PATCH 2/2] Version bump. Also print version in init for debugging --- library.json | 2 +- library.properties | 2 +- src/TinyGsmClientA6.h | 1 + src/TinyGsmClientBG96.h | 1 + src/TinyGsmClientESP8266.h | 1 + src/TinyGsmClientM590.h | 1 + src/TinyGsmClientM95.h | 1 + src/TinyGsmClientMC60.h | 1 + src/TinyGsmClientSIM7000.h | 1 + src/TinyGsmClientSIM800.h | 1 + src/TinyGsmClientUBLOX.h | 1 + src/TinyGsmClientXBee.h | 3 ++- src/TinyGsmCommon.h | 3 +++ 13 files changed, 16 insertions(+), 3 deletions(-) diff --git a/library.json b/library.json index 9a47399..325b10d 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TinyGSM", - "version": "0.6.0", + "version": "0.6.1", "description": "A small Arduino library for GPRS modules, that just works. Includes examples for Blynk, MQTT, File Download, and Web Client. Supports many GSM, LTE, and WiFi modules with AT command interfaces.", "keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM7000, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968, M95, MC60, MC60E, BG96, ublox, Quectel, SIMCOM, AI Thinker, LTE, LTE-M", "authors": diff --git a/library.properties b/library.properties index 9020230..146f48b 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TinyGSM -version=0.6.0 +version=0.6.1 author=Volodymyr Shymanskyy maintainer=Volodymyr Shymanskyy sentence=A small Arduino library for GPRS modules, that just works. diff --git a/src/TinyGsmClientA6.h b/src/TinyGsmClientA6.h index 3eac97b..8fa02bb 100644 --- a/src/TinyGsmClientA6.h +++ b/src/TinyGsmClientA6.h @@ -184,6 +184,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { return false; } diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index 4c37db3..d75ba25 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -220,6 +220,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { return false; } diff --git a/src/TinyGsmClientESP8266.h b/src/TinyGsmClientESP8266.h index 3330e32..f6c7419 100644 --- a/src/TinyGsmClientESP8266.h +++ b/src/TinyGsmClientESP8266.h @@ -201,6 +201,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { return false; } diff --git a/src/TinyGsmClientM590.h b/src/TinyGsmClientM590.h index 7adff18..1f5ea00 100644 --- a/src/TinyGsmClientM590.h +++ b/src/TinyGsmClientM590.h @@ -181,6 +181,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { return false; } diff --git a/src/TinyGsmClientM95.h b/src/TinyGsmClientM95.h index eff3c4a..a3818ce 100644 --- a/src/TinyGsmClientM95.h +++ b/src/TinyGsmClientM95.h @@ -220,6 +220,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { return false; } diff --git a/src/TinyGsmClientMC60.h b/src/TinyGsmClientMC60.h index 842b37f..b3239b3 100644 --- a/src/TinyGsmClientMC60.h +++ b/src/TinyGsmClientMC60.h @@ -224,6 +224,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { return false; } diff --git a/src/TinyGsmClientSIM7000.h b/src/TinyGsmClientSIM7000.h index c30ae86..ef64d5d 100644 --- a/src/TinyGsmClientSIM7000.h +++ b/src/TinyGsmClientSIM7000.h @@ -246,6 +246,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { return false; } diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index e917bcc..1e19928 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -241,6 +241,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { return false; } diff --git a/src/TinyGsmClientUBLOX.h b/src/TinyGsmClientUBLOX.h index 7188ade..d5e4912 100644 --- a/src/TinyGsmClientUBLOX.h +++ b/src/TinyGsmClientUBLOX.h @@ -251,6 +251,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { return false; } diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 480b7d5..865139c 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -281,6 +281,7 @@ public: */ bool init(const char* pin = NULL) { + DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (resetPin >= 0) { pinMode(resetPin, OUTPUT); @@ -457,7 +458,7 @@ public: exitCommand(); - return true; + return init(); } void setupPinSleep(bool maintainAssociation = false) { diff --git a/src/TinyGsmCommon.h b/src/TinyGsmCommon.h index 0bf3b85..a8c7be4 100644 --- a/src/TinyGsmCommon.h +++ b/src/TinyGsmCommon.h @@ -9,6 +9,9 @@ #ifndef TinyGsmCommon_h #define TinyGsmCommon_h +// The current library version number +#define TINYGSM_VERSION "0.6.1" + #if defined(SPARK) || defined(PARTICLE) #include "Particle.h" #elif defined(ARDUINO)