| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2017 Edouard Griffiths, F4EXB                                   //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 06:39:30 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QDebug>
 | 
					
						
							|  |  |  | #include <QMessageBox>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "ui_limesdroutputgui.h"
 | 
					
						
							|  |  |  | #include "gui/colormapper.h"
 | 
					
						
							|  |  |  | #include "gui/glspectrum.h"
 | 
					
						
							| 
									
										
										
										
											2018-12-19 00:12:44 +01:00
										 |  |  | #include "gui/crightclickenabler.h"
 | 
					
						
							|  |  |  | #include "gui/basicdevicesettingsdialog.h"
 | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | #include "dsp/dspengine.h"
 | 
					
						
							|  |  |  | #include "dsp/dspcommands.h"
 | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | #include "device/deviceapi.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-30 01:11:35 +01:00
										 |  |  | #include "device/deviceuiset.h"
 | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | #include "limesdroutputgui.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-30 02:54:22 +01:00
										 |  |  | LimeSDROutputGUI::LimeSDROutputGUI(DeviceUISet *deviceUISet, QWidget* parent) : | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  |     DeviceGUI(parent), | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     ui(new Ui::LimeSDROutputGUI), | 
					
						
							| 
									
										
										
										
											2017-10-30 01:11:35 +01:00
										 |  |  |     m_deviceUISet(deviceUISet), | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     m_settings(), | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  |     m_sampleRateMode(true), | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     m_sampleRate(0), | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     m_lastEngineState(DeviceAPI::StNotStarted), | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     m_doApplySettings(true), | 
					
						
							| 
									
										
										
										
											2017-10-14 06:30:31 +02:00
										 |  |  |     m_forceSettings(true), | 
					
						
							| 
									
										
										
										
											2017-07-03 16:58:46 +02:00
										 |  |  |     m_statusCounter(0), | 
					
						
							|  |  |  |     m_deviceStatusCounter(0) | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     setAttribute(Qt::WA_DeleteOnClose, true); | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     m_limeSDROutput = (LimeSDROutput*) m_deviceUISet->m_deviceAPI->getSampleSink(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     ui->setupUi(getContents()); | 
					
						
							|  |  |  |     getContents()->setStyleSheet("#LimeSDROutputGUI { border: 1px solid #C06900 }"); | 
					
						
							|  |  |  |     m_helpURL = "plugins/samplesink/limesdroutput/readme.md"; | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 11:03:22 +01:00
										 |  |  |     float minF, maxF; | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 11:03:22 +01:00
										 |  |  |     m_limeSDROutput->getLORange(minF, maxF); | 
					
						
							| 
									
										
										
										
											2017-05-16 18:27:36 +02:00
										 |  |  |     ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     ui->centerFrequency->setValueRange(7, ((uint32_t) minF)/1000, ((uint32_t) maxF)/1000); // frequency dial is in kHz
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 11:03:22 +01:00
										 |  |  |     m_limeSDROutput->getSRRange(minF, maxF); | 
					
						
							| 
									
										
										
										
											2017-05-16 18:27:36 +02:00
										 |  |  |     ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow)); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     ui->sampleRate->setValueRange(8, (uint32_t) minF, (uint32_t) maxF); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 11:03:22 +01:00
										 |  |  |     m_limeSDROutput->getLPRange(minF, maxF); | 
					
						
							| 
									
										
										
										
											2017-05-16 21:24:25 +02:00
										 |  |  |     ui->lpf->setColorMapper(ColorMapper(ColorMapper::GrayYellow)); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     ui->lpf->setValueRange(6, (minF/1000)+1, maxF/1000); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 21:24:25 +02:00
										 |  |  |     ui->lpFIR->setColorMapper(ColorMapper(ColorMapper::GrayYellow)); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     ui->lpFIR->setValueRange(5, 1U, 56000U); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 18:27:36 +02:00
										 |  |  |     ui->ncoFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     ui->channelNumberText->setText(tr("#%1").arg(m_limeSDROutput->getChannelIndex())); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 01:06:23 +02:00
										 |  |  |     if (m_limeSDROutput->getLimeType() == DeviceLimeSDRParams::LimeMini) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ui->antenna->setItemText(1, "Hi"); | 
					
						
							|  |  |  |         ui->antenna->setItemText(2, "Lo"); | 
					
						
							| 
									
										
										
										
											2020-04-19 12:52:32 +02:00
										 |  |  |         ui->antenna->setToolTip("Hi: 2 - 3.5 GHz, Lo: 10 MHz - 2 GHz"); | 
					
						
							| 
									
										
										
										
											2019-04-21 01:06:23 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ui->antenna->setItemText(1, "Lo"); | 
					
						
							|  |  |  |         ui->antenna->setItemText(2, "Hi"); | 
					
						
							| 
									
										
										
										
											2020-04-19 12:52:32 +02:00
										 |  |  |         ui->antenna->setToolTip("Lo: L port, Hi: H port. All ports are full band"); | 
					
						
							| 
									
										
										
										
											2019-04-21 01:06:23 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); | 
					
						
							|  |  |  |     connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); | 
					
						
							|  |  |  |     m_statusTimer.start(500); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     displaySettings(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     char recFileNameCStr[30]; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceUISet->m_deviceAPI->getDeviceUID()); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |     connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection); | 
					
						
							| 
									
										
										
										
											2017-10-14 06:30:31 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 00:12:44 +01:00
										 |  |  |     CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop); | 
					
						
							|  |  |  |     connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &))); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-14 06:30:31 +02:00
										 |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     makeUIConnections(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | LimeSDROutputGUI::~LimeSDROutputGUI() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     delete ui; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::destroy() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     delete this; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::resetToDefaults() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.resetToDefaults(); | 
					
						
							|  |  |  |     displaySettings(); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QByteArray LimeSDROutputGUI::serialize() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_settings.serialize(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool LimeSDROutputGUI::deserialize(const QByteArray& data) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (m_settings.deserialize(data)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         displaySettings(); | 
					
						
							| 
									
										
										
										
											2017-10-14 06:30:31 +02:00
										 |  |  |         m_forceSettings = true; | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |         sendSettings(); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         resetToDefaults(); | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 00:55:56 +02:00
										 |  |  | void LimeSDROutputGUI::updateFrequencyLimits() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // values in kHz
 | 
					
						
							|  |  |  |     float minF, maxF; | 
					
						
							|  |  |  |     qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0; | 
					
						
							|  |  |  |     m_limeSDROutput->getLORange(minF, maxF); | 
					
						
							|  |  |  |     qint64 minLimit = minF/1000 + deltaFrequency; | 
					
						
							|  |  |  |     qint64 maxLimit = maxF/1000 + deltaFrequency; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit; | 
					
						
							|  |  |  |     maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     qDebug("LimeSDROutputGUI::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->centerFrequency->setValueRange(7, minLimit, maxLimit); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  | bool LimeSDROutputGUI::handleMessage(const Message& message) | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-28 04:04:50 +01:00
										 |  |  |     if (LimeSDROutput::MsgConfigureLimeSDR::match(message)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         const LimeSDROutput::MsgConfigureLimeSDR& cfg = (LimeSDROutput::MsgConfigureLimeSDR&) message; | 
					
						
							|  |  |  |         m_settings = cfg.getSettings(); | 
					
						
							|  |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         displaySettings(); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message)) | 
					
						
							| 
									
										
										
										
											2017-10-24 02:20:57 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-10-25 01:38:39 +02:00
										 |  |  |         DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message; | 
					
						
							| 
									
										
										
										
											2017-10-24 02:20:57 +02:00
										 |  |  |         m_settings.m_devSampleRate = report.getDevSampleRate(); | 
					
						
							|  |  |  |         m_settings.m_log2HardInterp = report.getLog2HardDecimInterp(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-25 01:38:39 +02:00
										 |  |  |         if (!report.getRxElseTx()) { | 
					
						
							|  |  |  |             m_settings.m_centerFrequency = report.getCenterFrequency(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-24 02:20:57 +02:00
										 |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         displaySettings(); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							| 
									
										
										
										
											2017-11-05 10:16:36 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (DeviceLimeSDRShared::MsgReportClockSourceChange::match(message)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         DeviceLimeSDRShared::MsgReportClockSourceChange& report = (DeviceLimeSDRShared::MsgReportClockSourceChange&) message; | 
					
						
							|  |  |  |         m_settings.m_extClockFreq = report.getExtClockFeq(); | 
					
						
							|  |  |  |         m_settings.m_extClock = report.getExtClock(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         ui->extClock->setExternalClockFrequency(m_settings.m_extClockFreq); | 
					
						
							|  |  |  |         ui->extClock->setExternalClockActive(m_settings.m_extClock); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							| 
									
										
										
										
											2017-10-24 02:20:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |     else if (LimeSDROutput::MsgReportStreamInfo::match(message)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         LimeSDROutput::MsgReportStreamInfo& report = (LimeSDROutput::MsgReportStreamInfo&) message; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (report.getSuccess()) | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2017-10-27 00:22:58 +02:00
										 |  |  |             if (report.getActive()) { | 
					
						
							|  |  |  |                 ui->streamStatusLabel->setStyleSheet("QLabel { background-color : green; }"); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 ui->streamStatusLabel->setStyleSheet("QLabel { background-color : blue; }"); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |             ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report.getLinkRate() / 1000000.0f, 'f', 3))); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |             if (report.getUnderrun() > 0) { | 
					
						
							|  |  |  |                 ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }"); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |             if (report.getOverrun() > 0) { | 
					
						
							|  |  |  |                 ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }"); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |             if (report.getDroppedPackets() > 0) { | 
					
						
							|  |  |  |                 ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }"); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2017-04-23 03:36:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |             ui->fifoBar->setMaximum(report.getFifoSize()); | 
					
						
							|  |  |  |             ui->fifoBar->setValue(report.getFifoFilledCount()); | 
					
						
							|  |  |  |             ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report.getFifoFilledCount())).arg(QString::number(report.getFifoSize()))); | 
					
						
							| 
									
										
										
										
											2017-04-23 03:36:10 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |         else | 
					
						
							| 
									
										
										
										
											2017-04-23 03:36:10 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |             ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-04-23 03:36:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(message)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         DeviceLimeSDRShared::MsgReportDeviceInfo& report = (DeviceLimeSDRShared::MsgReportDeviceInfo&) message; | 
					
						
							|  |  |  |         ui->temperatureText->setText(tr("%1C").arg(QString::number(report.getTemperature(), 'f', 0))); | 
					
						
							| 
									
										
										
										
											2018-11-29 23:37:34 +01:00
										 |  |  |         ui->gpioText->setText(tr("%1").arg(report.getGPIOPins(), 2, 16, QChar('0')).toUpper()); | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-04-23 03:36:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |     return false; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::handleInputMessages() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Message* message; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     while ((message = m_inputMessageQueue.pop()) != 0) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (DSPSignalNotification::match(*message)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             qDebug("LimeSDROutputGUI::handleInputMessages: message: %s", message->getIdentifier()); | 
					
						
							|  |  |  |             DSPSignalNotification* notif = (DSPSignalNotification*) message; | 
					
						
							|  |  |  |             m_sampleRate = notif->getSampleRate(); | 
					
						
							|  |  |  |             m_deviceCenterFrequency = notif->getCenterFrequency(); | 
					
						
							|  |  |  |             qDebug("LimeSDROutputGUI::handleInputMessages: DSPSignalNotification: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency()); | 
					
						
							|  |  |  |             updateSampleRateAndFrequency(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |             delete message; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-12-08 15:23:22 +01:00
										 |  |  |         else if (LimeSDROutput::MsgConfigureLimeSDR::match(*message)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             const LimeSDROutput::MsgConfigureLimeSDR& cfg = (LimeSDROutput::MsgConfigureLimeSDR&) *message; | 
					
						
							|  |  |  |             m_settings = cfg.getSettings(); | 
					
						
							|  |  |  |             displaySettings(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             delete message; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |         else if (LimeSDROutput::MsgStartStop::match(*message)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             LimeSDROutput::MsgStartStop& notif = (LimeSDROutput::MsgStartStop&) *message; | 
					
						
							|  |  |  |             blockApplySettings(true); | 
					
						
							|  |  |  |             ui->startStop->setChecked(notif.getStartStop()); | 
					
						
							|  |  |  |             blockApplySettings(false); | 
					
						
							|  |  |  |             delete message; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |         else | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2017-09-17 17:35:03 +02:00
										 |  |  |             if (handleMessage(*message)) { | 
					
						
							|  |  |  |                 delete message; | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2017-07-03 16:58:46 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::updateSampleRateAndFrequency() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-30 01:11:35 +01:00
										 |  |  |     m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate); | 
					
						
							|  |  |  |     m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  |     displaySampleRate(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-06 22:59:29 +02:00
										 |  |  | void LimeSDROutputGUI::updateDACRate() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     uint32_t dacRate = m_settings.m_devSampleRate * (1<<m_settings.m_log2HardInterp); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (dacRate < 100000000) { | 
					
						
							|  |  |  |         ui->dacRateLabel->setText(tr("%1k").arg(QString::number(dacRate / 1000.0f, 'g', 5))); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         ui->dacRateLabel->setText(tr("%1M").arg(QString::number(dacRate / 1000000.0f, 'g', 5))); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  | void LimeSDROutputGUI::displaySampleRate() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     float minF, maxF; | 
					
						
							|  |  |  |     m_limeSDROutput->getSRRange(minF, maxF); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->sampleRate->blockSignals(true); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_sampleRateMode) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(60,60,60); }"); | 
					
						
							|  |  |  |         ui->sampleRateMode->setText("SR"); | 
					
						
							|  |  |  |         ui->sampleRate->setValueRange(8, (uint32_t) minF, (uint32_t) maxF); | 
					
						
							|  |  |  |         ui->sampleRate->setValue(m_settings.m_devSampleRate); | 
					
						
							| 
									
										
										
										
											2019-04-13 23:00:02 +02:00
										 |  |  |         ui->sampleRate->setToolTip("Host to device sample rate (S/s)"); | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  |         ui->deviceRateText->setToolTip("Baseband sample rate (S/s)"); | 
					
						
							|  |  |  |         uint32_t basebandSampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp); | 
					
						
							|  |  |  |         ui->deviceRateText->setText(tr("%1k").arg(QString::number(basebandSampleRate / 1000.0f, 'g', 5))); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(50,50,50); }"); | 
					
						
							|  |  |  |         ui->sampleRateMode->setText("BB"); | 
					
						
							|  |  |  |         ui->sampleRate->setValueRange(8, (uint32_t) minF/(1<<m_settings.m_log2SoftInterp), (uint32_t) maxF/(1<<m_settings.m_log2SoftInterp)); | 
					
						
							|  |  |  |         ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp)); | 
					
						
							|  |  |  |         ui->sampleRate->setToolTip("Baseband sample rate (S/s)"); | 
					
						
							| 
									
										
										
										
											2019-04-13 23:00:02 +02:00
										 |  |  |         ui->deviceRateText->setToolTip("Host to device sample rate (S/s)"); | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  |         ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_settings.m_devSampleRate / 1000.0f, 'g', 5))); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->sampleRate->blockSignals(false); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | void LimeSDROutputGUI::displaySettings() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-16 21:28:35 +01:00
										 |  |  |     ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency); | 
					
						
							|  |  |  |     ui->transverter->setDeltaFrequencyActive(m_settings.m_transverterMode); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-05 05:59:04 +01:00
										 |  |  |     ui->extClock->setExternalClockFrequency(m_settings.m_extClockFreq); | 
					
						
							|  |  |  |     ui->extClock->setExternalClockActive(m_settings.m_extClock); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-25 12:25:50 +02:00
										 |  |  |     updateFrequencyLimits(); | 
					
						
							| 
									
										
										
										
											2018-03-14 06:54:27 +01:00
										 |  |  |     setCenterFrequencyDisplay(); | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  |     displaySampleRate(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ui->hwInterp->setCurrentIndex(m_settings.m_log2HardInterp); | 
					
						
							|  |  |  |     ui->swInterp->setCurrentIndex(m_settings.m_log2SoftInterp); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-06 22:59:29 +02:00
										 |  |  |     updateDACRate(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     ui->lpf->setValue(m_settings.m_lpfBW / 1000); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->lpFIREnable->setChecked(m_settings.m_lpfFIREnable); | 
					
						
							|  |  |  |     ui->lpFIR->setValue(m_settings.m_lpfFIRBW / 1000); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->gain->setValue(m_settings.m_gain); | 
					
						
							|  |  |  |     ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-07 03:05:29 +02:00
										 |  |  |     ui->antenna->setCurrentIndex((int) m_settings.m_antennaPath); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     setNCODisplay(); | 
					
						
							| 
									
										
										
										
											2017-05-12 03:31:42 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ui->ncoEnable->setChecked(m_settings.m_ncoEnable); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::setNCODisplay() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int ncoHalfRange = (m_settings.m_devSampleRate * (1<<(m_settings.m_log2HardInterp)))/2; | 
					
						
							| 
									
										
										
										
											2018-03-14 06:54:27 +01:00
										 |  |  |     ui->ncoFrequency->setValueRange( | 
					
						
							|  |  |  |             false, | 
					
						
							|  |  |  |             8, | 
					
						
							|  |  |  |             -ncoHalfRange, | 
					
						
							| 
									
										
										
										
											2018-03-14 19:52:54 +01:00
										 |  |  |             ncoHalfRange); | 
					
						
							| 
									
										
										
										
											2018-03-14 06:54:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ui->ncoFrequency->blockSignals(true); | 
					
						
							| 
									
										
										
										
											2018-03-14 19:52:54 +01:00
										 |  |  |     ui->ncoFrequency->setToolTip(QString("NCO frequency shift in Hz (Range: +/- %1 kHz)").arg(ncoHalfRange/1000)); | 
					
						
							| 
									
										
										
										
											2018-03-14 06:54:27 +01:00
										 |  |  |     ui->ncoFrequency->setValue(m_settings.m_ncoFrequency); | 
					
						
							|  |  |  |     ui->ncoFrequency->blockSignals(false); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::setCenterFrequencyDisplay() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int64_t centerFrequency = m_settings.m_centerFrequency; | 
					
						
							|  |  |  |     ui->centerFrequency->setToolTip(QString("Main center frequency in kHz (LO: %1 kHz)").arg(centerFrequency/1000)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_settings.m_ncoEnable) { | 
					
						
							|  |  |  |         centerFrequency += m_settings.m_ncoFrequency; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->centerFrequency->blockSignals(true); | 
					
						
							|  |  |  |     ui->centerFrequency->setValue(centerFrequency < 0 ? 0 : (uint64_t) centerFrequency/1000); // kHz
 | 
					
						
							|  |  |  |     ui->centerFrequency->blockSignals(false); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::setCenterFrequencySetting(uint64_t kHzValue) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int64_t centerFrequency = kHzValue*1000; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_settings.m_ncoEnable) { | 
					
						
							|  |  |  |         centerFrequency -= m_settings.m_ncoFrequency; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_settings.m_centerFrequency = centerFrequency < 0 ? 0 : (uint64_t) centerFrequency; | 
					
						
							|  |  |  |     ui->centerFrequency->setToolTip(QString("Main center frequency in kHz (LO: %1 kHz)").arg(centerFrequency/1000)); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::sendSettings() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if(!m_updateTimer.isActive()) | 
					
						
							|  |  |  |         m_updateTimer.start(100); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::updateHardware() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (m_doApplySettings) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         qDebug() << "LimeSDROutputGUI::updateHardware"; | 
					
						
							| 
									
										
										
										
											2017-10-14 06:30:31 +02:00
										 |  |  |         LimeSDROutput::MsgConfigureLimeSDR* message = LimeSDROutput::MsgConfigureLimeSDR::create(m_settings, m_forceSettings); | 
					
						
							| 
									
										
										
										
											2017-09-18 01:11:15 +02:00
										 |  |  |         m_limeSDROutput->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2017-10-14 06:30:31 +02:00
										 |  |  |         m_forceSettings = false; | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |         m_updateTimer.stop(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::updateStatus() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     int state = m_deviceUISet->m_deviceAPI->state(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if(m_lastEngineState != state) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         switch(state) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StNotStarted: | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StIdle: | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : blue; }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StRunning: | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : green; }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |             case DeviceAPI::StError: | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : red; }"); | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |                 QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage()); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |                 break; | 
					
						
							|  |  |  |             default: | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         m_lastEngineState = state; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_statusCounter < 1) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         m_statusCounter++; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         LimeSDROutput::MsgGetStreamInfo* message = LimeSDROutput::MsgGetStreamInfo::create(); | 
					
						
							| 
									
										
										
										
											2017-09-18 01:11:15 +02:00
										 |  |  |         m_limeSDROutput->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |         m_statusCounter = 0; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-07-03 16:58:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (m_deviceStatusCounter < 10) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         m_deviceStatusCounter++; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |         if (m_deviceUISet->m_deviceAPI->isBuddyLeader()) | 
					
						
							| 
									
										
										
										
											2017-07-03 23:29:06 +02:00
										 |  |  |         { | 
					
						
							|  |  |  |             LimeSDROutput::MsgGetDeviceInfo* message = LimeSDROutput::MsgGetDeviceInfo::create(); | 
					
						
							| 
									
										
										
										
											2017-09-18 01:11:15 +02:00
										 |  |  |             m_limeSDROutput->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2017-07-03 23:29:06 +02:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-03 16:58:46 +02:00
										 |  |  |         m_deviceStatusCounter = 0; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::blockApplySettings(bool block) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_doApplySettings = !block; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_startStop_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |     if (m_doApplySettings) | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-12-14 18:02:49 +01:00
										 |  |  |         LimeSDROutput::MsgStartStop *message = LimeSDROutput::MsgStartStop::create(checked); | 
					
						
							|  |  |  |         m_limeSDROutput->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_centerFrequency_changed(quint64 value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-14 06:54:27 +01:00
										 |  |  |     setCenterFrequencySetting(value); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 06:54:27 +01:00
										 |  |  | void LimeSDROutputGUI::on_ncoFrequency_changed(qint64 value) | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-14 06:54:27 +01:00
										 |  |  |     m_settings.m_ncoFrequency = value; | 
					
						
							|  |  |  |     setCenterFrequencyDisplay(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_ncoEnable_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_ncoEnable = checked; | 
					
						
							| 
									
										
										
										
											2018-03-14 06:54:27 +01:00
										 |  |  |     setCenterFrequencyDisplay(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_sampleRate_changed(quint64 value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  |     if (m_sampleRateMode) { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = value; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = value * (1 << m_settings.m_log2SoftInterp); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-06 22:59:29 +02:00
										 |  |  |     updateDACRate(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     setNCODisplay(); | 
					
						
							|  |  |  |     sendSettings();} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-24 03:12:02 +02:00
										 |  |  | void LimeSDROutputGUI::on_hwInterp_currentIndexChanged(int index) | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     if ((index <0) || (index > 5)) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     m_settings.m_log2HardInterp = index; | 
					
						
							| 
									
										
										
										
											2017-07-06 22:59:29 +02:00
										 |  |  |     updateDACRate(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     setNCODisplay(); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-24 03:12:02 +02:00
										 |  |  | void LimeSDROutputGUI::on_swInterp_currentIndexChanged(int index) | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  |     if ((index <0) || (index > 6)) { | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     m_settings.m_log2SoftInterp = index; | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  |     displaySampleRate(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_sampleRateMode) { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = ui->sampleRate->getValueNew(); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2SoftInterp); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_lpf_changed(quint64 value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_lpfBW = value * 1000; | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_lpFIREnable_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_lpfFIREnable = checked; | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_lpFIR_changed(quint64 value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_lpfFIRBW = value * 1000; | 
					
						
							| 
									
										
										
										
											2018-08-13 16:58:43 +02:00
										 |  |  |     sendSettings(); | 
					
						
							| 
									
										
										
										
											2017-04-22 11:41:44 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_gain_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_gain = value; | 
					
						
							|  |  |  |     ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain)); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-05-07 03:05:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_antenna_currentIndexChanged(int index) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_antennaPath = (LimeSDROutputSettings::PathRFE) index; | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-11-05 05:59:04 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::on_extClock_clicked() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_extClock = ui->extClock->getExternalClockActive(); | 
					
						
							|  |  |  |     m_settings.m_extClockFreq = ui->extClock->getExternalClockFrequency(); | 
					
						
							|  |  |  |     qDebug("LimeSDROutputGUI::on_extClock_clicked: %u Hz %s", m_settings.m_extClockFreq, m_settings.m_extClock ? "on" : "off"); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 00:55:56 +02:00
										 |  |  | void LimeSDROutputGUI::on_transverter_clicked() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive(); | 
					
						
							|  |  |  |     m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency(); | 
					
						
							|  |  |  |     qDebug("LimeSDRInputGUI::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off"); | 
					
						
							|  |  |  |     updateFrequencyLimits(); | 
					
						
							|  |  |  |     setCenterFrequencySetting(ui->centerFrequency->getValueNew()); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-09 21:40:33 +02:00
										 |  |  | void LimeSDROutputGUI::on_sampleRateMode_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_sampleRateMode = checked; | 
					
						
							|  |  |  |     displaySampleRate(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 00:12:44 +01:00
										 |  |  | void LimeSDROutputGUI::openDeviceSettingsDialog(const QPoint& p) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     BasicDeviceSettingsDialog dialog(this); | 
					
						
							|  |  |  |     dialog.setUseReverseAPI(m_settings.m_useReverseAPI); | 
					
						
							|  |  |  |     dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress); | 
					
						
							|  |  |  |     dialog.setReverseAPIPort(m_settings.m_reverseAPIPort); | 
					
						
							|  |  |  |     dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     dialog.move(p); | 
					
						
							|  |  |  |     dialog.exec(); | 
					
						
							| 
									
										
										
										
											2018-04-17 00:55:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 00:12:44 +01:00
										 |  |  |     m_settings.m_useReverseAPI = dialog.useReverseAPI(); | 
					
						
							|  |  |  |     m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); | 
					
						
							|  |  |  |     m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); | 
					
						
							|  |  |  |     m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void LimeSDROutputGUI::makeUIConnections() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &LimeSDROutputGUI::on_startStop_toggled); | 
					
						
							|  |  |  |     QObject::connect(ui->centerFrequency, &ValueDial::changed, this, &LimeSDROutputGUI::on_centerFrequency_changed); | 
					
						
							|  |  |  |     QObject::connect(ui->ncoFrequency, &ValueDialZ::changed, this, &LimeSDROutputGUI::on_ncoFrequency_changed); | 
					
						
							|  |  |  |     QObject::connect(ui->ncoEnable, &ButtonSwitch::toggled, this, &LimeSDROutputGUI::on_ncoEnable_toggled); | 
					
						
							|  |  |  |     QObject::connect(ui->sampleRate, &ValueDial::changed, this, &LimeSDROutputGUI::on_sampleRate_changed); | 
					
						
							|  |  |  |     QObject::connect(ui->hwInterp, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &LimeSDROutputGUI::on_hwInterp_currentIndexChanged); | 
					
						
							|  |  |  |     QObject::connect(ui->swInterp, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &LimeSDROutputGUI::on_swInterp_currentIndexChanged); | 
					
						
							|  |  |  |     QObject::connect(ui->lpf, &ValueDial::changed, this, &LimeSDROutputGUI::on_lpf_changed); | 
					
						
							|  |  |  |     QObject::connect(ui->lpFIREnable, &ButtonSwitch::toggled, this, &LimeSDROutputGUI::on_lpFIREnable_toggled); | 
					
						
							|  |  |  |     QObject::connect(ui->lpFIR, &ValueDial::changed, this, &LimeSDROutputGUI::on_lpFIR_changed); | 
					
						
							|  |  |  |     QObject::connect(ui->gain, &QSlider::valueChanged, this, &LimeSDROutputGUI::on_gain_valueChanged); | 
					
						
							|  |  |  |     QObject::connect(ui->antenna, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &LimeSDROutputGUI::on_antenna_currentIndexChanged); | 
					
						
							|  |  |  |     QObject::connect(ui->extClock, &ExternalClockButton::clicked, this, &LimeSDROutputGUI::on_extClock_clicked); | 
					
						
							|  |  |  |     QObject::connect(ui->transverter, &TransverterButton::clicked, this, &LimeSDROutputGUI::on_transverter_clicked); | 
					
						
							|  |  |  |     QObject::connect(ui->sampleRateMode, &QToolButton::toggled, this, &LimeSDROutputGUI::on_sampleRateMode_toggled); | 
					
						
							|  |  |  | } |