Changeset - bee157994ef3
[Not reviewed]
default
0 1 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-07-30 15:13:32
hy@ozderya.net
demo mode changed to show fourier components of a square wave instead of a simple sawtooth signal
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
mainwindow.cpp
Show inline comments
 
@@ -627,21 +627,24 @@ void MainWindow::spsTimerTimeout()
 
    spsLabel.setText(QString::number(sampleCount/SPS_UPDATE_TIMEOUT) + "sps");
 
    sampleCount = 0;
 
}
 

	
 
void MainWindow::demoTimerTimeout()
 
{
 
    const double period = 100;
 
    demoCount++;
 
    if (demoCount > 100) demoCount = 0;
 

	
 
    if (!ui->actionPause->isChecked())
 
    {
 
        for (unsigned int ci = 0; ci < numOfChannels; ci++)
 
        {
 
            DataArray data(1);
 
            data.replace(0, (ci + 1)*demoCount);
 
            // we are calculating the fourier components of square wave
 
            double value = 4*sin(2*M_PI*double((ci+1)*demoCount)/period)/((2*(ci+1))*M_PI);
 
            data.replace(0, value);
 
            addChannelData(ci, data);
 
        }
 
    }
 
}
 

	
 
void MainWindow::enableDemo(bool enabled)
0 comments (0 inline, 0 general)