Hi,
Is there any way to combine these two buffers which are coming out of a serial in node simultaneously. The device which is sending this serial data sometimes sends the whole buffer (which is desirable ) but sometimes it sends in the form of two buffers as shown in the figure. Is there any way or idea to deal with this issue and why is this happening? I appreciate your help. Thanks in advance
If you happen to be in control of the sending device's code, I believe flushing the serial buffer before sending would help. Otherwise you'll need to sort it out in the receiving end (no tips to give at this time).
I think the default is to split (lines) on the \n (0x0A) character - so if that is meant to be part of the data and not the line end then you will need a different to decide when the line end is... - maybe a number of characters or maybe a small timeout ?
Thank you for the reply @dceejay . Actually the buffer size is not fixed all the time, I think end of line based on number of characters would not work, what do you say?
The alternative of using a timeout was also suggested. That is available in the node config. Then when data has been received and then stops it will be supplied by the node.