Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Wrong data when reading from serial port
erytcg last edited by A Former User
ok I use qSort similar The sort algorithm is efficient on large data sets. It operates in linear-logarithmic time, O(n log n).
But I have one more question when I fast read serial port I get
it's correct data buffer:
I use this function
data = serialPort->read(33); //read buffer
[Edit: forked as this is a whole new topic ~~ @Wieland]
From the looks of it, you are receiving the same frame several times one after the other. You are reading the serial port as if it was a file but it's not. You'll be getting data when they arrive, your application might not receive a frame when it starts listening to the serial port so it's up to you to devise a way to know when you did in fact get a full frame e.g. size of data and
\rbeing the last character.
erytcg last edited by
I know but how I'm supposed to know when data frame is ready?
You know the device and the protocol. From what you wrote it looks like you need to have retrieved a frame once you have at least 33 chars which last one is