Redid streamWrite
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TinyGSM",
|
"name": "TinyGSM",
|
||||||
"version": "0.3.9",
|
"version": "0.3.10",
|
||||||
"description": "A small Arduino library for GPRS modules, that just works. Includes examples for Blynk, MQTT, File Download, and Web Client. Supports GSM modules with AT command interface: SIM800, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900, SIM900A, SIM900D, SIM908, SIM968",
|
"description": "A small Arduino library for GPRS modules, that just works. Includes examples for Blynk, MQTT, File Download, and Web Client. Supports GSM modules with AT command interface: SIM800, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900, SIM900A, SIM900D, SIM908, SIM968",
|
||||||
"keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968",
|
"keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968",
|
||||||
"authors":
|
"authors":
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
name=TinyGSM
|
name=TinyGSM
|
||||||
version=0.3.9
|
version=0.3.10
|
||||||
author=Volodymyr Shymanskyy
|
author=Volodymyr Shymanskyy
|
||||||
maintainer=Volodymyr Shymanskyy
|
maintainer=Volodymyr Shymanskyy
|
||||||
sentence=A small Arduino library for GPRS modules, that just works.
|
sentence=A small Arduino library for GPRS modules, that just works.
|
||||||
|
@@ -635,7 +635,7 @@ fail:
|
|||||||
if (!writeChanges()) goto fail;
|
if (!writeChanges()) goto fail;
|
||||||
|
|
||||||
exitCommand();
|
exitCommand();
|
||||||
stream.print(text);
|
streamWrite(text);
|
||||||
stream.write((char)0x0D); // close off with the carriage return
|
stream.write((char)0x0D); // close off with the carriage return
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -727,6 +727,17 @@ public:
|
|||||||
|
|
||||||
/* Utilities */
|
/* Utilities */
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void streamWrite(T last) {
|
||||||
|
stream.print(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T, typename... Args>
|
||||||
|
void streamWrite(T head, Args... tail) {
|
||||||
|
stream.print(head);
|
||||||
|
streamWrite(tail...);
|
||||||
|
}
|
||||||
|
|
||||||
void streamClear(void) {
|
void streamClear(void) {
|
||||||
TINY_GSM_YIELD();
|
TINY_GSM_YIELD();
|
||||||
while (stream.available()) { stream.read(); }
|
while (stream.available()) { stream.read(); }
|
||||||
@@ -740,7 +751,7 @@ public:
|
|||||||
// Cannot send anything for 1 "guard time" before entering command mode
|
// Cannot send anything for 1 "guard time" before entering command mode
|
||||||
// Default guard time is 1s, but the init fxn decreases it to 250 ms
|
// Default guard time is 1s, but the init fxn decreases it to 250 ms
|
||||||
delay(guardTime);
|
delay(guardTime);
|
||||||
stream.print(GF("+++")); // enter command mode
|
streamWrite(GF("+++")); // enter command mode
|
||||||
DBG("\r\n+++");
|
DBG("\r\n+++");
|
||||||
success = (1 == waitResponse(guardTime*2));
|
success = (1 == waitResponse(guardTime*2));
|
||||||
triesMade ++;
|
triesMade ++;
|
||||||
@@ -773,7 +784,7 @@ public:
|
|||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void sendAT(Args... cmd) {
|
void sendAT(Args... cmd) {
|
||||||
stream.print("AT", cmd..., GSM_NL);
|
streamWrite("AT", cmd..., GSM_NL);
|
||||||
stream.flush();
|
stream.flush();
|
||||||
TINY_GSM_YIELD();
|
TINY_GSM_YIELD();
|
||||||
// DBG("### AT:", cmd...);
|
// DBG("### AT:", cmd...);
|
||||||
|
Reference in New Issue
Block a user