You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Ahh, right... Well, I can do a flush function - although busy-waiting in JavaScript is generally not a great idea as it relies on the idle handler firing reasonably often to work properly.

    a way to tell espruino to not fire the next on(data) event until so many bytes have been received, with the option of a timeout.

    I think this is probably overkill to implement in Espruino, and extremely niche. I'd have thought it would be reasonably easy to just create a JS function that would handle that though.

    Personally, I think really to do this reliably you probably need to handle framing yourself rather than relying on forcing it to send in packets - you might always get some chunk of data split up when it shouldn't be - or maybe some data gets sent over bluetooth but then the send fails and has to be retried or something like that.

About

Avatar for Gordon @Gordon started