Libreria basica para el manejo del ESP01

Dependents:   Gateway_Cotosys Gateway_Cotosys_os5

Files at this revision

API Documentation at this revision

Comitter:
Thrillex13
Date:
Mon Jan 06 04:39:26 2020 +0000
Parent:
8:ef9014a530cf
Commit message:
Se arreglo la funcion ReceiveSingleReply para evitar que se quede atascado en un loop.

Changed in this revision

ESP01.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ef9014a530cf -r 21290fc75c17 ESP01.cpp
--- a/ESP01.cpp	Sun Sep 15 20:54:35 2019 +0000
+++ b/ESP01.cpp	Mon Jan 06 04:39:26 2020 +0000
@@ -81,7 +81,7 @@
 bool ESP01::GetIP(char *ip)
 {
     SendCMD("AT+CIFSR");
-    return RcvReply(ip, 2000);
+    return RcvReply(ip, 3000);
 }
 
 //Defines wifi mode; Parameter: mode; 1= STA, 2= AP, 3=both
@@ -188,14 +188,16 @@
 {
     bool ended = 0;
     char c;
+    Timer t;
 
     strcpy(r, "");
+    t.start();
     while(!ended) {
         if(comm.readable()) {
             c = comm.getc();
             AddChar(r, c);
         }
-        if(c == 0x0D) {
+        if((c==0x0D)||(t.read_ms() > 5000)) {
             ended = 1;
         }
     }