Permalink
Browse files

revert bad assumption about how ESP8266 handled send

  • Loading branch information...
gfwilliams committed Oct 2, 2018
1 parent 9a9b551 commit 7b4b448647bdf24fe22dadd15b135227e2cc8ad0
Showing with 14 additions and 6 deletions.
  1. +8 −4 devices/ESP8266WiFi_0v25.js
  2. +6 −2 devices/EspruinoWiFi.js
@@ -169,11 +169,14 @@ var netCallbacks = {
}
var cmd = 'AT+CIPSEND='+sckt+','+data.length+extra+'\r\n';
at.cmd(cmd, 2000, function cb(d) {
at.cmd(cmd, 10000, function cb(d) {
//console.log("SEND "+JSON.stringify(d));
if (d=="OK") {
} else if (d=="> ") {
at.write(data);
at.register('> ', function(l) {
at.unregister('> ');
at.write(data);
return l.substr(2);
});
} else if (d=="Recv "+data.length+" bytes" || d=="busy s...") {
// all good, we expect this
// Not sure why we get "busy s..." in this case (2 sends one after the other) but it all seems ok.
@@ -184,9 +187,10 @@ var netCallbacks = {
return;
} else {
socks[sckt]=undefined; // uh-oh. Error. If undefined it was probably a timeout
at.unregister('> ');
return;
}
return cb;
return cb
});
// if we obey the above, we shouldn't get the 'busy p...' prompt
socks[sckt]="Wait"; // wait for data to be sent
View
@@ -159,8 +159,11 @@ var netCallbacks = {
at.cmd(cmd, 2000, function cb(d) {
//console.log("SEND "+JSON.stringify(d));
if (d=="OK") {
} else if (d=="> ") {
at.write(data);
at.register('> ', function(l) {
at.unregister('> ');
at.write(data);
return l.substr(2);
});
} else if (d=="Recv "+data.length+" bytes" || d=="busy s...") {
// all good, we expect this
// Not sure why we get "busy s..." in this case (2 sends one after the other) but it all seems ok.
@@ -171,6 +174,7 @@ var netCallbacks = {
return;
} else {
socks[sckt]=undefined; // uh-oh. Error. If undefined it was probably a timeout
at.unregister('> ');
return;
}
return cb;

0 comments on commit 7b4b448

Please sign in to comment.