The blocking connect works in this case because the library is sending a Serial request and can then happily block waiting for a serial response
No, it doesn't block at all. Your implementation just needs to do:
bool isBusy = false; function esp8266_connected() { isBusy = false; } function esp8266_sent() { isBusy = false; } function esp8266_received() { isBusy = false; } function connect() { esp8266_connect(...); isBusy = true; } function send() { if (isBusy) return 0; isBusy = true; esp8266_send(...); return bytes_sent; } function recv() { if (isBusy) return 0; isBusy = true; esp8266_recv(...); return bytes_received; }
@Gordon 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.
No, it doesn't block at all. Your implementation just needs to do: