2020-11-10 10:38:12 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2023-11-18 00:28:24 -05:00
|
|
|
// Copyright (C) 2018-2023 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
|
|
|
// Copyright (C) 2021-2023 Jon Beniston, M7RCE <jon@beniston.com> //
|
2020-11-10 10:38:12 -05:00
|
|
|
// //
|
|
|
|
// 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 //
|
|
|
|
// (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// 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 <QLocale>
|
|
|
|
|
|
|
|
#include "device/deviceuiset.h"
|
|
|
|
#include "gui/basicchannelsettingsdialog.h"
|
2022-12-20 05:31:15 -05:00
|
|
|
#include "gui/dialogpositioner.h"
|
2020-11-10 10:38:12 -05:00
|
|
|
#include "dsp/hbfilterchainconverter.h"
|
|
|
|
#include "dsp/scopevis.h"
|
|
|
|
#include "dsp/spectrumvis.h"
|
|
|
|
#include "maincore.h"
|
|
|
|
|
|
|
|
#include "interferometergui.h"
|
|
|
|
#include "interferometer.h"
|
|
|
|
#include "ui_interferometergui.h"
|
|
|
|
|
|
|
|
InterferometerGUI* InterferometerGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *channelMIMO)
|
|
|
|
{
|
2024-08-25 17:36:46 -04:00
|
|
|
auto* gui = new InterferometerGUI(pluginAPI, deviceUISet, channelMIMO);
|
2020-11-10 10:38:12 -05:00
|
|
|
return gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::resetToDefaults()
|
|
|
|
{
|
|
|
|
m_settings.resetToDefaults();
|
|
|
|
displaySettings();
|
|
|
|
applySettings(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray InterferometerGUI::serialize() const
|
|
|
|
{
|
|
|
|
return m_settings.serialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool InterferometerGUI::deserialize(const QByteArray& data)
|
|
|
|
{
|
|
|
|
if (m_settings.deserialize(data))
|
|
|
|
{
|
|
|
|
displaySettings();
|
|
|
|
applySettings(true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageQueue* InterferometerGUI::getInputMessageQueue()
|
|
|
|
{
|
|
|
|
return &m_inputMessageQueue;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool InterferometerGUI::handleMessage(const Message& message)
|
|
|
|
{
|
|
|
|
if (Interferometer::MsgBasebandNotification::match(message))
|
|
|
|
{
|
2024-08-25 17:36:46 -04:00
|
|
|
auto& notif = (const Interferometer::MsgBasebandNotification&) message;
|
2020-11-10 10:38:12 -05:00
|
|
|
m_sampleRate = notif.getSampleRate();
|
|
|
|
m_centerFrequency = notif.getCenterFrequency();
|
|
|
|
displayRateAndShift();
|
2022-05-26 06:28:18 -04:00
|
|
|
updateAbsoluteCenterFrequency();
|
2020-11-10 10:38:12 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (Interferometer::MsgConfigureInterferometer::match(message))
|
|
|
|
{
|
2024-08-25 17:36:46 -04:00
|
|
|
auto& cfg = (const Interferometer::MsgConfigureInterferometer&) message;
|
2024-05-11 21:52:19 -04:00
|
|
|
|
|
|
|
if (cfg.getForce()) {
|
|
|
|
m_settings = cfg.getSettings();
|
|
|
|
} else {
|
|
|
|
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
|
|
|
}
|
|
|
|
|
2021-11-30 18:20:14 -05:00
|
|
|
ui->scopeGUI->updateSettings();
|
|
|
|
ui->spectrumGUI->updateSettings();
|
2021-12-03 17:08:48 -05:00
|
|
|
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
|
2020-11-10 10:38:12 -05:00
|
|
|
displaySettings();
|
|
|
|
return true;
|
|
|
|
}
|
2024-05-11 21:52:19 -04:00
|
|
|
else if (Interferometer::MsgReportDevices::match(message))
|
|
|
|
{
|
2024-08-25 17:36:46 -04:00
|
|
|
auto& msg = const_cast<Message&>(message);
|
|
|
|
auto& report = (Interferometer::MsgReportDevices&) msg;
|
2024-05-11 21:52:19 -04:00
|
|
|
updateDeviceSetList(report.getDeviceSetIndexes());
|
|
|
|
return true;
|
|
|
|
}
|
2020-11-10 10:38:12 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
InterferometerGUI::InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *channelMIMO, QWidget* parent) :
|
|
|
|
ChannelGUI(parent),
|
|
|
|
ui(new Ui::InterferometerGUI),
|
|
|
|
m_pluginAPI(pluginAPI),
|
|
|
|
m_deviceUISet(deviceUISet),
|
|
|
|
m_sampleRate(48000),
|
|
|
|
m_centerFrequency(435000000),
|
|
|
|
m_tickCount(0)
|
|
|
|
{
|
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
2022-04-24 06:28:56 -04:00
|
|
|
m_helpURL = "plugins/channelmimo/interferometer/readme.md";
|
|
|
|
RollupContents *rollupContents = getRollupContents();
|
|
|
|
ui->setupUi(rollupContents);
|
|
|
|
setSizePolicy(rollupContents->sizePolicy());
|
|
|
|
rollupContents->arrangeRollups();
|
|
|
|
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
2020-11-10 10:38:12 -05:00
|
|
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
|
|
|
|
|
|
|
m_interferometer = (Interferometer*) channelMIMO;
|
|
|
|
m_spectrumVis = m_interferometer->getSpectrumVis();
|
2021-05-30 07:12:00 -04:00
|
|
|
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
|
|
|
m_scopeVis = m_interferometer->getScopeVis();
|
|
|
|
m_scopeVis->setGLScope(ui->glScope);
|
2024-08-25 17:36:46 -04:00
|
|
|
m_interferometer->setMessageQueueToGUI(InterferometerGUI::getInputMessageQueue());
|
2020-11-10 10:38:12 -05:00
|
|
|
m_sampleRate = m_interferometer->getDeviceSampleRate();
|
|
|
|
|
2023-04-09 05:47:50 -04:00
|
|
|
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
|
|
|
|
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
|
|
|
|
|
2020-11-10 10:38:12 -05:00
|
|
|
ui->glSpectrum->setCenterFrequency(0);
|
|
|
|
ui->glSpectrum->setSampleRate(m_sampleRate);
|
|
|
|
ui->glSpectrum->setLsbDisplay(false);
|
2023-04-09 05:47:50 -04:00
|
|
|
|
|
|
|
SpectrumSettings spectrumSettings = m_spectrumVis->getSettings();
|
|
|
|
spectrumSettings.m_displayWaterfall = true;
|
|
|
|
spectrumSettings.m_displayMaxHold = true;
|
|
|
|
spectrumSettings.m_ssb = false;
|
|
|
|
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
|
|
|
m_spectrumVis->getInputMessageQueue()->push(msg);
|
|
|
|
|
2020-11-10 10:38:12 -05:00
|
|
|
ui->glScope->setTraceModulo(Interferometer::m_fftSize);
|
|
|
|
|
|
|
|
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
|
|
|
|
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
|
|
|
|
|
|
|
m_channelMarker.blockSignals(true);
|
|
|
|
m_channelMarker.addStreamIndex(1);
|
|
|
|
m_channelMarker.setColor(m_settings.m_rgbColor);
|
|
|
|
m_channelMarker.setCenterFrequency(0);
|
|
|
|
m_channelMarker.setTitle("Interferometer");
|
|
|
|
m_channelMarker.blockSignals(false);
|
|
|
|
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
|
|
|
|
|
|
|
m_settings.setChannelMarker(&m_channelMarker);
|
2022-01-08 23:27:12 -05:00
|
|
|
m_settings.setRollupState(&m_rollupState);
|
2020-11-10 10:38:12 -05:00
|
|
|
m_settings.setScopeGUI(ui->scopeGUI);
|
|
|
|
m_settings.setSpectrumGUI(ui->spectrumGUI);
|
|
|
|
|
|
|
|
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
|
|
|
|
|
|
|
m_scopeVis->setTraceChunkSize(Interferometer::m_fftSize); // Set scope trace length unit to FFT size
|
|
|
|
ui->scopeGUI->traceLengthChange();
|
|
|
|
|
2024-08-25 17:36:46 -04:00
|
|
|
connect(InterferometerGUI::getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
2020-11-10 10:38:12 -05:00
|
|
|
|
2024-05-11 21:52:19 -04:00
|
|
|
updateDeviceSetList(m_interferometer->getDeviceSetList());
|
2020-11-10 10:38:12 -05:00
|
|
|
displaySettings();
|
2022-04-12 10:20:45 -04:00
|
|
|
makeUIConnections();
|
2020-11-10 10:38:12 -05:00
|
|
|
displayRateAndShift();
|
|
|
|
applySettings(true);
|
2023-11-13 15:51:03 -05:00
|
|
|
m_resizer.enableChildMouseTracking();
|
2020-11-10 10:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
InterferometerGUI::~InterferometerGUI()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::blockApplySettings(bool block)
|
|
|
|
{
|
|
|
|
m_doApplySettings = !block;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::applySettings(bool force)
|
|
|
|
{
|
|
|
|
if (m_doApplySettings)
|
|
|
|
{
|
|
|
|
setTitleColor(m_channelMarker.getColor());
|
|
|
|
|
2024-05-11 21:52:19 -04:00
|
|
|
Interferometer::MsgConfigureInterferometer* message = Interferometer::MsgConfigureInterferometer::create(m_settings, m_settingsKeys, force);
|
2020-11-10 10:38:12 -05:00
|
|
|
m_interferometer->getInputMessageQueue()->push(message);
|
|
|
|
}
|
2024-05-11 21:52:19 -04:00
|
|
|
|
|
|
|
m_settingsKeys.clear();
|
2020-11-10 10:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::displaySettings()
|
|
|
|
{
|
|
|
|
ui->correlationType->setCurrentIndex((int) m_settings.m_correlationType);
|
|
|
|
|
|
|
|
m_channelMarker.blockSignals(true);
|
|
|
|
m_channelMarker.setCenterFrequency(0);
|
|
|
|
m_channelMarker.setTitle(m_settings.m_title);
|
|
|
|
m_channelMarker.setBandwidth(m_sampleRate);
|
|
|
|
m_channelMarker.setMovable(false); // do not let user move the center arbitrarily
|
|
|
|
m_channelMarker.blockSignals(false);
|
|
|
|
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
|
|
|
|
|
|
|
setTitleColor(m_settings.m_rgbColor);
|
|
|
|
setWindowTitle(m_channelMarker.getTitle());
|
2022-04-12 10:20:45 -04:00
|
|
|
setTitle(m_channelMarker.getTitle());
|
2020-11-10 10:38:12 -05:00
|
|
|
|
|
|
|
blockApplySettings(true);
|
2024-05-12 15:53:09 -04:00
|
|
|
int index = getLocalDeviceIndexInCombo(m_settings.m_localDeviceIndex);
|
|
|
|
if (index >= 0) {
|
|
|
|
ui->localDevice->setCurrentIndex(index);
|
|
|
|
}
|
|
|
|
ui->localDevicePlay->setChecked(m_settings.m_play);
|
2020-11-10 10:38:12 -05:00
|
|
|
ui->decimationFactor->setCurrentIndex(m_settings.m_log2Decim);
|
|
|
|
applyDecimation();
|
|
|
|
ui->phaseCorrection->setValue(m_settings.m_phase);
|
|
|
|
ui->phaseCorrectionText->setText(tr("%1").arg(m_settings.m_phase));
|
2024-05-11 18:00:06 -04:00
|
|
|
ui->gain->setValue(m_settings.m_gain);
|
|
|
|
ui->gainText->setText(QString("%1").arg(m_settings.m_gain / 10.0, 0, 'f', 1));
|
2022-04-12 10:20:45 -04:00
|
|
|
getRollupContents()->restoreState(m_rollupState);
|
2022-05-26 06:28:18 -04:00
|
|
|
updateAbsoluteCenterFrequency();
|
2020-11-10 10:38:12 -05:00
|
|
|
blockApplySettings(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::displayRateAndShift()
|
|
|
|
{
|
2024-08-25 17:36:46 -04:00
|
|
|
auto shift = (int) (m_shiftFrequencyFactor * m_sampleRate);
|
2020-11-10 10:38:12 -05:00
|
|
|
double channelSampleRate = ((double) m_sampleRate) / (1<<m_settings.m_log2Decim);
|
|
|
|
QLocale loc;
|
|
|
|
ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
|
|
|
|
ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
|
|
|
|
m_channelMarker.setCenterFrequency(shift);
|
2024-08-25 17:36:46 -04:00
|
|
|
m_channelMarker.setBandwidth((int) channelSampleRate);
|
|
|
|
ui->glSpectrum->setSampleRate((int) channelSampleRate);
|
|
|
|
m_scopeVis->setLiveRate((int) channelSampleRate);
|
2020-11-10 10:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::leaveEvent(QEvent*)
|
|
|
|
{
|
|
|
|
m_channelMarker.setHighlighted(false);
|
|
|
|
}
|
|
|
|
|
2022-11-17 09:36:12 -05:00
|
|
|
void InterferometerGUI::enterEvent(EnterEventType*)
|
2020-11-10 10:38:12 -05:00
|
|
|
{
|
|
|
|
m_channelMarker.setHighlighted(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::handleSourceMessages()
|
|
|
|
{
|
|
|
|
Message* message;
|
|
|
|
|
2024-08-25 17:36:46 -04:00
|
|
|
while ((message = getInputMessageQueue()->pop()) != nullptr)
|
2020-11-10 10:38:12 -05:00
|
|
|
{
|
|
|
|
if (handleMessage(*message))
|
|
|
|
{
|
|
|
|
delete message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-25 17:36:46 -04:00
|
|
|
void InterferometerGUI::onWidgetRolled(const QWidget* widget, bool rollDown)
|
2020-11-10 10:38:12 -05:00
|
|
|
{
|
|
|
|
(void) widget;
|
|
|
|
(void) rollDown;
|
2021-11-24 04:50:42 -05:00
|
|
|
|
dd maximize button to MainSpectrum and expandible Channels and Features.
Add sizeToContents in ChannelGUI and FeatureGUI, called when widget is
rolled, so we can remove resizing code from all of the individual
channels and features.
In RollupContents, use minimumSizeHint for calculated size, so that
minimumWidth can come from .ui file.
In DeviceGUI::sizeToContents(), call adjustSize(), so Device GUIs start
out at minimum needed size (which should restore appearance prior to
last patch).
In stackSubWindows, use available space for channels if no
spectrum/features present.
In stackSubWindows, fix spectrum from being sized too big, resulting in
scroll bars appearing.
Reset user-defined channel width in stackSubWindows, when channels are
removed.
Don't stack maximized windows.
There's one hack in Channel/FeatureGUI::maximizeWindow(). It seems that
when maximimzing a window, QOpenGLWidgets aren't always paint properly
immediately afterwards, so the code forces an additional update. I can't
see why the first call to paintGL doesn't work.
2022-11-11 07:24:27 -05:00
|
|
|
getRollupContents()->saveState(m_rollupState);
|
2021-11-24 04:50:42 -05:00
|
|
|
applySettings();
|
2020-11-10 10:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::onMenuDialogCalled(const QPoint &p)
|
|
|
|
{
|
2024-08-25 17:36:46 -04:00
|
|
|
if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
|
2020-11-10 10:38:12 -05:00
|
|
|
{
|
|
|
|
BasicChannelSettingsDialog dialog(&m_channelMarker, 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.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex);
|
2022-04-17 19:42:03 -04:00
|
|
|
dialog.setDefaultTitle(m_displayedName);
|
2020-11-10 10:38:12 -05:00
|
|
|
|
|
|
|
dialog.move(p);
|
2022-12-20 05:31:15 -05:00
|
|
|
new DialogPositioner(&dialog, false);
|
2020-11-10 10:38:12 -05:00
|
|
|
dialog.exec();
|
|
|
|
|
|
|
|
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
|
|
|
|
m_settings.m_title = m_channelMarker.getTitle();
|
|
|
|
m_settings.m_useReverseAPI = dialog.useReverseAPI();
|
|
|
|
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
|
|
|
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
|
|
|
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
|
|
|
m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex();
|
|
|
|
|
|
|
|
setWindowTitle(m_settings.m_title);
|
2022-04-12 10:20:45 -04:00
|
|
|
setTitle(m_channelMarker.getTitle());
|
2020-11-10 10:38:12 -05:00
|
|
|
setTitleColor(m_settings.m_rgbColor);
|
|
|
|
|
2024-05-11 21:52:19 -04:00
|
|
|
m_settingsKeys.append("title");
|
|
|
|
m_settingsKeys.append("rgbColor");
|
|
|
|
m_settingsKeys.append("useReverseAPI");
|
|
|
|
m_settingsKeys.append("reverseAPIAddress");
|
|
|
|
m_settingsKeys.append("reverseAPIPort");
|
|
|
|
m_settingsKeys.append("reverseAPIFeatureSetIndex");
|
|
|
|
m_settingsKeys.append("reverseAPIFeatureIndex");
|
|
|
|
|
2020-11-10 10:38:12 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
resetContextMenuType();
|
|
|
|
}
|
|
|
|
|
2024-05-11 21:52:19 -04:00
|
|
|
void InterferometerGUI::updateDeviceSetList(const QList<int>& deviceSetIndexes)
|
|
|
|
{
|
2024-08-25 17:36:46 -04:00
|
|
|
auto it = deviceSetIndexes.begin();
|
2024-05-11 21:52:19 -04:00
|
|
|
|
|
|
|
ui->localDevice->blockSignals(true);
|
|
|
|
|
|
|
|
ui->localDevice->clear();
|
|
|
|
|
|
|
|
for (; it != deviceSetIndexes.end(); ++it) {
|
|
|
|
ui->localDevice->addItem(QString("R%1").arg(*it), *it);
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->localDevice->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
2024-08-25 17:36:46 -04:00
|
|
|
int InterferometerGUI::getLocalDeviceIndexInCombo(int localDeviceIndex) const
|
2024-05-12 15:53:09 -04:00
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
for (; index < ui->localDevice->count(); index++)
|
|
|
|
{
|
|
|
|
if (localDeviceIndex == ui->localDevice->itemData(index).toInt()) {
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-11-10 10:38:12 -05:00
|
|
|
void InterferometerGUI::on_decimationFactor_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_log2Decim = index;
|
2024-05-11 21:52:19 -04:00
|
|
|
m_settingsKeys.append("log2Decim");
|
2020-11-10 10:38:12 -05:00
|
|
|
applyDecimation();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::on_position_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_filterChainHash = value;
|
2024-05-11 21:52:19 -04:00
|
|
|
m_settingsKeys.append("filterChainHash");
|
2020-11-10 10:38:12 -05:00
|
|
|
applyPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::on_phaseCorrection_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_phase = value;
|
2024-05-11 21:52:19 -04:00
|
|
|
m_settingsKeys.append("phase");
|
2020-11-10 10:38:12 -05:00
|
|
|
ui->phaseCorrectionText->setText(tr("%1").arg(value));
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2024-05-11 18:00:06 -04:00
|
|
|
void InterferometerGUI::on_gain_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_gain = value;
|
2024-05-11 21:52:19 -04:00
|
|
|
m_settingsKeys.append("gain");
|
2024-05-11 18:00:06 -04:00
|
|
|
ui->gainText->setText(QString("%1").arg(m_settings.m_gain / 10.0, 0, 'f', 1));
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::on_phaseCorrectionLabel_clicked()
|
|
|
|
{
|
|
|
|
m_settings.m_phase = 0;
|
|
|
|
ui->phaseCorrection->setValue(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::on_gainLabel_clicked()
|
|
|
|
{
|
|
|
|
m_settings.m_gain = 0;
|
|
|
|
ui->gain->setValue(0);
|
|
|
|
}
|
|
|
|
|
2020-11-10 10:38:12 -05:00
|
|
|
void InterferometerGUI::on_correlationType_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_correlationType = (InterferometerSettings::CorrelationType) index;
|
2024-05-11 21:52:19 -04:00
|
|
|
m_settingsKeys.append("correlationType");
|
2020-11-10 10:38:12 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2024-05-12 15:53:09 -04:00
|
|
|
void InterferometerGUI::on_localDevice_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
if (index >= 0)
|
|
|
|
{
|
|
|
|
m_settings.m_localDeviceIndex = ui->localDevice->currentData().toInt();
|
|
|
|
m_settingsKeys.append("localDeviceIndex");
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::on_localDevicePlay_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_play = checked;
|
|
|
|
m_settingsKeys.append("play");
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2020-11-10 10:38:12 -05:00
|
|
|
void InterferometerGUI::applyDecimation()
|
|
|
|
{
|
|
|
|
uint32_t maxHash = 1;
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < m_settings.m_log2Decim; i++) {
|
|
|
|
maxHash *= 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->position->setMaximum(maxHash-1);
|
|
|
|
ui->position->setValue(m_settings.m_filterChainHash);
|
|
|
|
m_settings.m_filterChainHash = ui->position->value();
|
2024-05-11 21:52:19 -04:00
|
|
|
m_settingsKeys.append("filterChainHash");
|
2020-11-10 10:38:12 -05:00
|
|
|
applyPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::applyPosition()
|
|
|
|
{
|
|
|
|
ui->filterChainIndex->setText(tr("%1").arg(m_settings.m_filterChainHash));
|
|
|
|
QString s;
|
|
|
|
m_shiftFrequencyFactor = HBFilterChainConverter::convertToString(m_settings.m_log2Decim, m_settings.m_filterChainHash, s);
|
|
|
|
ui->filterChainText->setText(s);
|
|
|
|
|
|
|
|
displayRateAndShift();
|
2022-05-26 06:28:18 -04:00
|
|
|
updateAbsoluteCenterFrequency();
|
2020-11-10 10:38:12 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterferometerGUI::tick()
|
|
|
|
{
|
|
|
|
if (++m_tickCount == 20) { // once per second
|
|
|
|
m_tickCount = 0;
|
|
|
|
}
|
|
|
|
}
|
2022-04-12 10:20:45 -04:00
|
|
|
|
2024-08-25 17:36:46 -04:00
|
|
|
void InterferometerGUI::makeUIConnections() const
|
2022-04-12 10:20:45 -04:00
|
|
|
{
|
|
|
|
QObject::connect(ui->decimationFactor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &InterferometerGUI::on_decimationFactor_currentIndexChanged);
|
|
|
|
QObject::connect(ui->position, &QSlider::valueChanged, this, &InterferometerGUI::on_position_valueChanged);
|
|
|
|
QObject::connect(ui->phaseCorrection, &QSlider::valueChanged, this, &InterferometerGUI::on_phaseCorrection_valueChanged);
|
2024-05-11 18:00:06 -04:00
|
|
|
QObject::connect(ui->gain, &QDial::valueChanged, this, &InterferometerGUI::on_gain_valueChanged);
|
|
|
|
QObject::connect(ui->phaseCorrectionLabel, &ClickableLabel::clicked, this, &InterferometerGUI::on_phaseCorrectionLabel_clicked);
|
|
|
|
QObject::connect(ui->gainLabel, &ClickableLabel::clicked, this, &InterferometerGUI::on_gainLabel_clicked);
|
2022-04-12 10:20:45 -04:00
|
|
|
QObject::connect(ui->correlationType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &InterferometerGUI::on_correlationType_currentIndexChanged);
|
2024-05-12 15:53:09 -04:00
|
|
|
QObject::connect(ui->localDevice, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &InterferometerGUI::on_localDevice_currentIndexChanged);
|
|
|
|
QObject::connect(ui->localDevicePlay, &ButtonSwitch::toggled, this, &InterferometerGUI::on_localDevicePlay_toggled);
|
2022-04-12 10:20:45 -04:00
|
|
|
}
|
2022-05-26 06:28:18 -04:00
|
|
|
|
|
|
|
void InterferometerGUI::updateAbsoluteCenterFrequency()
|
|
|
|
{
|
2024-08-25 17:36:46 -04:00
|
|
|
setStatusFrequency((qint64) ((double) m_centerFrequency + m_shiftFrequencyFactor * m_sampleRate));
|
2022-05-26 06:28:18 -04:00
|
|
|
}
|