Changeset - 027be1575c36
[Not reviewed]
default
0 1 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-08-15 12:53:38
hy@ozderya.net
cleanup removed two else clauses reducing the scope depth
1 file changed with 7 insertions and 13 deletions:
0 comments (0 inline, 0 general)
mainwindow.cpp
Show inline comments
 
@@ -234,8 +234,12 @@ void MainWindow::onPortToggled(bool open
 

	
 
void MainWindow::onDataReady()
 
{
 
    if (!ui->actionPause->isChecked())
 
    if (ui->actionPause->isChecked())
 
    {
 
        serialPort.clear(QSerialPort::Input);
 
        return;
 
    }
 

	
 
        // a package is a set of channel data like {CHAN0_SAMPLE, CHAN1_SAMPLE...}
 
        int packageSize = sampleSize * numOfChannels;
 
        int bytesAvailable = serialPort.bytesAvailable();
 
@@ -247,12 +251,8 @@ void MainWindow::onDataReady()
 
            bytesAvailable--;
 
        }
 

	
 
        if (bytesAvailable < packageSize)
 
        {
 
            return;
 
        }
 
        else
 
        {
 
    if (bytesAvailable < packageSize) return;
 

	
 
            int numOfPackagesToRead =
 
                (bytesAvailable - (bytesAvailable % packageSize)) / packageSize;
 
            QVector<DataArray> channelSamples(numOfChannels);
 
@@ -276,12 +276,6 @@ void MainWindow::onDataReady()
 
                addChannelData(ci, channelSamples[ci]);
 
            }
 
        }
 
    }
 
    else
 
    {
 
        serialPort.clear(QSerialPort::Input);
 
    }
 
}
 

	
 
void MainWindow::onDataReadyASCII()
 
{
0 comments (0 inline, 0 general)