Changeset - aa93a4eacbb9
[Not reviewed]
default
0 1 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-06-22 05:53:23
hy@ozderya.net
fix pause not working with ASCII data
1 file changed with 7 insertions and 0 deletions:
0 comments (0 inline, 0 general)
mainwindow.cpp
Show inline comments
 
@@ -227,24 +227,31 @@ void MainWindow::onDataReady()
 
    }
 
    else
 
    {
 
        serialPort.clear(QSerialPort::Input);
 
    }
 
}
 

	
 
void MainWindow::onDataReadyASCII()
 
{
 
    while(serialPort.canReadLine())
 
    {
 
        QByteArray line = serialPort.readLine();
 

	
 
        // discard data if paused
 
        if (ui->actionPause->isChecked())
 
        {
 
            return;
 
        }
 

	
 
        line = line.trimmed();
 
        auto separatedValues = line.split(',');
 

	
 
        if (separatedValues.length() >= int(numOfChannels))
 
        {
 
            for (unsigned int ci = 0; ci < numOfChannels; ci++)
 
            {
 
                double channelSample = separatedValues[ci].toDouble();
 
                addChannelData(ci, DataArray({channelSample}));
 
            }
 
        }
 
        else // there is missing channel data
0 comments (0 inline, 0 general)