Added monitoring feature of ESP8266's UART
Dependents: ESP8266_W7500_Example DualNetworkInterface-Basic
Fork of ESP8266Interface by
Revision 49:2c05d747bb91, committed 2015-07-14
- Comitter:
- SteveKim
- Date:
- Tue Jul 14 09:09:55 2015 +0000
- Parent:
- 48:03fd9333670d
- Commit message:
- Added monitoring-feature of ESP8266's UART.
Changed in this revision
ESP8266/ESP8266.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 03fd9333670d -r 2c05d747bb91 ESP8266/ESP8266.cpp --- a/ESP8266/ESP8266.cpp Wed Jun 10 15:47:33 2015 +0000 +++ b/ESP8266/ESP8266.cpp Tue Jul 14 09:09:55 2015 +0000 @@ -220,6 +220,7 @@ +CIFSR:STAMAC,"18:fe:34:9f:3a:f5" grabbing IP from first set of quotation marks */ +extern RawSerial pc; char* ESP8266::getIPAddress() { char result[30] = {0}; @@ -237,6 +238,14 @@ pos2 = resultString.find('"',pos1+1); //pos3 = resultString.find('"',pos2+1); //would find mac address //pos4 = resultString.find('"',pos3+1); +// sekim XXXXX +/* +if ( pos2<=pos1 ) +{ + pc.printf("\r\n IP String Error : (%d) (%d, %d) \r\n", strlen(result), pos1, pos2); + return NULL; +} +*/ strncpy(ipString,resultString.substr(pos1,pos2).c_str(),sizeof(ipString)); ipString[pos2 - pos1 +1] = 0; // null terminate string correctly. INFO("IP: %s",ipString); @@ -294,6 +303,9 @@ return true; } +// sekim XXXX +extern CircBuffer<char> buffer_ESP8266_recv; + void ESP8266::handler_rx(void) { //read characters @@ -302,6 +314,9 @@ c=wifi.getc(); buf_ESP8266.queue(c); //if (state.cmdMode) pc.printf("%c",c); //debug echo, needs fast serial console to prevent UART overruns + + // sekim XXXX + buffer_ESP8266_recv.queue(c); } } @@ -312,7 +327,7 @@ } else { wifi.attach(this, &ESP8266::handler_rx); - } + } } int ESP8266::readable() @@ -475,3 +490,4 @@ DBG("result: %d", result) return result; } +