From 7b54c152ddcfad9c3eb6849d2520e4f94aad5294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Grome=C5=A1?= Date: Sat, 31 Mar 2018 10:06:45 +0200 Subject: [PATCH] Added variable AT line feed characters --- src/ESP8266.cpp | 1 + src/Module.cpp | 2 +- src/Module.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ESP8266.cpp b/src/ESP8266.cpp index d51abdec..d7322402 100644 --- a/src/ESP8266.cpp +++ b/src/ESP8266.cpp @@ -7,6 +7,7 @@ ESP8266::ESP8266(Module* module) { } uint8_t ESP8266::begin(long speed) { + _mod->AtLineFeed = "\r\n"; _mod->baudrate = speed; _mod->init(USE_UART, INT_NONE); _mod->ATemptyBuffer(); diff --git a/src/Module.cpp b/src/Module.cpp index f205e9ae..7371dd74 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -62,7 +62,7 @@ bool Module::ATsendCommand(String& cmd) { bool Module::ATsendCommand(const char* cmd) { ATemptyBuffer(); ModuleSerial->print(cmd); - ModuleSerial->print("\r\n"); + ModuleSerial->print(AtLineFeed); return(ATgetResponse()); } diff --git a/src/Module.h b/src/Module.h index 37b2f1a8..3346b37f 100644 --- a/src/Module.h +++ b/src/Module.h @@ -18,6 +18,7 @@ class Module { SoftwareSerial* ModuleSerial; uint32_t baudrate = 9600; + String AtLineFeed = "\r\n"; uint8_t init(uint8_t interface, uint8_t gpio);