diff --git a/src/dataformatpanel.cpp b/src/dataformatpanel.cpp --- a/src/dataformatpanel.cpp +++ b/src/dataformatpanel.cpp @@ -1,5 +1,5 @@ /* - Copyright © 2015 Hasan Yavuz Özderya + Copyright © 2016 Hasan Yavuz Özderya This file is part of serialplot. @@ -49,6 +49,8 @@ DataFormatPanel::DataFormatPanel(QSerial connect(&bsReader, SIGNAL(dataAdded()), this, SIGNAL(dataAdded())); connect(&bsReader, SIGNAL(numOfChannelsChanged(unsigned)), this, SIGNAL(numOfChannelsChanged(unsigned))); + connect(&bsReader, SIGNAL(samplesPerSecondChanged(unsigned)), + this, SIGNAL(samplesPerSecondChanged(unsigned))); // initalize reader selection buttons connect(ui->rbBinary, &QRadioButton::toggled, [this](bool checked) @@ -61,12 +63,6 @@ DataFormatPanel::DataFormatPanel(QSerial if (checked) selectReader(&asciiReader); }); - // Init sps (sample per second) counter - // sampleCount = 0; - // QObject::connect(&spsTimer, &QTimer::timeout, - // this, &DataFormatPanel::spsTimerTimeout); - // spsTimer.start(SPS_UPDATE_TIMEOUT * 1000); - // Init demo mode demoCount = 0; demoTimer.setInterval(100); @@ -79,23 +75,11 @@ DataFormatPanel::~DataFormatPanel() delete ui; } -// TODO: remove -bool DataFormatPanel::skipByteEnabled() -{ - return false; -} - unsigned DataFormatPanel::numOfChannels() { return currentReader->numOfChannels(); } -// TODO: remove -void DataFormatPanel::requestSkipByte() -{ - skipByteRequested = true; -} - void DataFormatPanel::pause(bool enabled) { currentReader->pause(enabled); @@ -113,17 +97,6 @@ void DataFormatPanel::enableDemo(bool en } } -void DataFormatPanel::spsTimerTimeout() -{ - // unsigned currentSps = _samplesPerSecond; - // _samplesPerSecond = (sampleCount/_numOfChannels)/SPS_UPDATE_TIMEOUT; - // if (currentSps != _samplesPerSecond) - // { - // emit samplesPerSecondChanged(_samplesPerSecond); - // } - // sampleCount = 0; -} - void DataFormatPanel::demoTimerTimeout() { const double period = 100; @@ -146,7 +119,6 @@ void DataFormatPanel::addChannelData(uns double* data, unsigned size) { _channelMan->addChannelData(channel, data, size); - sampleCount += size; } void DataFormatPanel::selectReader(AbstractReader* reader) @@ -159,6 +131,8 @@ void DataFormatPanel::selectReader(Abstr connect(reader, SIGNAL(dataAdded()), this, SIGNAL(dataAdded())); connect(reader, SIGNAL(numOfChannelsChanged(unsigned)), this, SIGNAL(numOfChannelsChanged(unsigned))); + connect(reader, SIGNAL(samplesPerSecondChanged(unsigned)), + this, SIGNAL(samplesPerSecondChanged(unsigned))); // switch the settings widget ui->horizontalLayout->removeWidget(currentReader->settingsWidget());