bug serial
Posted: Mon Feb 09, 2015 3:31 am
Hello guys, I'm new here, I bought a ESP8266
with firmware:
I'm not getting the "SEND OK" when I have in my ByteArray code 0x00, but if I do not have in my ByteArray code 0x00 and everything ok.
with firmware:
Code: Select all
ets Jan 8 2013,rst cause:4, boot mode:(3,1)
wdt reset
load 0x40100000, len 25052, room 16
tail 12
chksum 0x0b
ho 0 tail 12 room 4
load 0x3ffe8000, len 3312, room 12
tail 4
chksum 0x53
load 0x3ffe8cf0, len 6576, room 4
tail 12
chksum 0x0d
csum 0x0d
[Vendor:www.ai-thinker.com Version:0.9.2.4]
I'm not getting the "SEND OK" when I have in my ByteArray code 0x00, but if I do not have in my ByteArray code 0x00 and everything ok.
Code: Select all
boolean Send(byte id, uint8_t str[260], int MessageLength){
Serial.print("AT+CIPSEND=");
Serial.print(id);
Serial.print(",");
Serial.println(MessageLength);
#ifdef varDebug
DebugSerial.println("<---------------------------------------");
DebugSerial.print("AT+CIPSEND=");
DebugSerial.print(id);
DebugSerial.print(",");
DebugSerial.println(MessageLength);
DebugSerial.println("--------------------------------------->");
#endif
unsigned long start;
start = millis();
bool found;
while (millis()-start<5000) {
if(Serial.find(">")==true )
{
found = true;
break;
}
}
if(found){
Serial.write(str, MessageLength);
// DebugSerial.write(str, MessageLength);
#ifdef varDebug
DebugSerial.println("<---------------------------------------");
DebugSerial.write(str, MessageLength);
DebugSerial.println("--------------------------------------->");
#endif
}else{
return false;
}
String data;
start = millis();
while (millis()-start<5000) {
if(Serial.available()>0)
{
char a =Serial.read();
data=data+a;
}
if (data.indexOf("SEND OK")!=-1)
{
#ifdef varDebug
DebugSerial.println("<---------------------------------------");
DebugSerial.println("SEND OK");
DebugSerial.println("--------------------------------------->");
#endif
return true;
}
}
#ifdef varDebug
DebugSerial.println("<---------------------------------------");
DebugSerial.println("SEND NON OK");
DebugSerial.println(data);
DebugSerial.println("--------------------------------------->");
#endif
return false;
}