@MG33 I already told you what you're doing wrong. Just read it and act accordingly instead of repeating same information again and again.
Accumulate data in a buffer until you got a complete package and then parse it and update your UI.
@CristianoNarcisiVidex said in Run test as superuser inside QtCreator:
because of my OS is Ubuntu, i need the super user permission for opening that port
That's wrong.
You simply have to add your user to the group which has access to the device file of your serial port.
See https://askubuntu.com/questions/58119/changing-permissions-on-serial-port
"The issue with the permissions for /dev/ttyACM0 can be permanantly solved by adding yourself to the dialout group.
You can do this with:
sudo usermod -a -G dialout $USER
Logout and then log back in for the group changes to take effect.
"
@ADR_PT you may want to start using QSerialPort the asynchronous (non-blocking) approach, by using signals & slots.
Take a look at the serial terminal example
@suslucoder said in Open the selected port:
I solved it, you can delete my post.
No, the solved posts don't get deleted. They remain for the benefit of other forum users having same/similar issues.
It's a community driven approach, opposite to a "my problem only" driven approach
@suslucoder
ok im not sure what s does.
Anyway, could you try
(in on_Serial_Read)
memset(dizi, 0, 14);
memcpy(dizi, data.constData(), data.size());
in place ot the line
memcpy(dizi, data.constData(), 14);
and tell if it still stops at 15 ?
@IRBaboon If your PC have no obvious lagging, my issue is an error direction. Here are some ideas you can try:
read help doc seriously or test one other poeple's credible demo on your devie, is it possible to call it incorrectly?(for serial device, It is difficult for others to run your demo)
try the lastest verion of QT
@RunThiner There's no need for such a loop. QSerialPort already provides an asynchronous API and if you really want to wait for data to be available, there's a blocking API for that as shown in the QSerialPort details.
@vishbynature It's config.log file located in the same directory from which you called configure. It is a text file, nothing special. Look for compile errors in that file related to to what you need.
@donquixote said in Serial port data loss:
I used it because i thought maybe the problem is that new incoming data is interrupting the function before the previous one has not finished yet. The problem was still in there before that.
Slots are not interrupted. They are called one by one from the event loop in the background. Think of your slots are like a subroutine that is called from main if there is work to do.
process data and block serial signals at the time
QT'll continue to buffer data at the time
And I guess that will not work out. Even if it works on one platform, it may fail on another one.
OK, got your idea. That should be the problem since i don't wait for readyread signal in the loop, right?
Yeah, but don't wait for readyRead, leave the slot and give Qt the possibility to process the data. It will call your slot again once new data is ready.
Regards