Is there a way to force the buffers to immediately flush?
Sometimes I want to send just a specific chunk of data as a uart update.
On the other end, I have a function called from an on data callback that adds another temporary listener to combine the output of multiple packets into one buffer. The issue is that the initial packet sent to the first callback is still in the buffer by the time I run the code, so it becomes part of the start of the combined buffer.
There’s a workaround I’ve found to wrap it in a timeout of 0, but that’s not the cleanest to deal with
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.
Is there a way to force the buffers to immediately flush?
Sometimes I want to send just a specific chunk of data as a uart update.
On the other end, I have a function called from an on data callback that adds another temporary listener to combine the output of multiple packets into one buffer. The issue is that the initial packet sent to the first callback is still in the buffer by the time I run the code, so it becomes part of the start of the combined buffer.
There’s a workaround I’ve found to wrap it in a timeout of 0, but that’s not the cleanest to deal with