Hello Gordon,
I tried to solve it like this yesterday night:
/* Send data. Returns the number of bytes sent - 0 is ok. Less than 0 */ send: function(sckt, data) { if (busy || at.isBusy() || socks[sckt]=="Wait") return 0; if (!socks[sckt]) return -1; // error - close it busy = true; at.register('>', function() { console.log('READY'); at.unregister('>'); at.write(data); return ""; }); at.registerLine(sckt + ', SEND OK', function() { at.unregisterLine(sckt + ', SEND OK'); busy = false; return ""; }); at.cmd('AT+CIPSEND='+sckt+','+data.length+'\r\n'); at.debug(); return data.length; } };
But for some reason I ran into a deadlock situation where busy was set to true but no SEND OK came in to remove it in some cases.
I will try your solution without waiting for SEND OK and give you a feedback.
@net-tobi started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hello Gordon,
I tried to solve it like this yesterday night:
But for some reason I ran into a deadlock situation where busy was set to true but no SEND OK came in to remove it in some cases.
I will try your solution without waiting for SEND OK and give you a feedback.