kopia lustrzana https://github.com/f4exb/sdrangel
BladeRF2 output: Make settings assignments atomic. Part of #1329
rodzic
1489dddd0c
commit
565d0dd1a0
|
@ -186,7 +186,7 @@ void BladeRF2Output::closeDevice()
|
|||
|
||||
void BladeRF2Output::init()
|
||||
{
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
}
|
||||
|
||||
BladeRF2OutputThread *BladeRF2Output::findThread()
|
||||
|
@ -344,7 +344,7 @@ bool BladeRF2Output::start()
|
|||
bladeRF2OutputThread->setFifo(requestedChannel, &m_sampleSourceFifo);
|
||||
bladeRF2OutputThread->setLog2Interpolation(requestedChannel, m_settings.m_log2Interp);
|
||||
|
||||
applySettings(m_settings, true); // re-apply forcibly to set sample rate with the new number of channels
|
||||
applySettings(m_settings, QList<QString>(), true); // re-apply forcibly to set sample rate with the new number of channels
|
||||
|
||||
if (needsStart)
|
||||
{
|
||||
|
@ -484,7 +484,7 @@ void BladeRF2Output::stop()
|
|||
bladeRF2OutputThread->setFifo(requestedChannel, 0); // remove FIFO
|
||||
}
|
||||
|
||||
applySettings(m_settings, true); // re-apply forcibly to set sample rate with the new number of channels
|
||||
applySettings(m_settings, QList<QString>(), true); // re-apply forcibly to set sample rate with the new number of channels
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
|
@ -504,12 +504,12 @@ bool BladeRF2Output::deserialize(const QByteArray& data)
|
|||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureBladeRF2* message = MsgConfigureBladeRF2::create(m_settings, true);
|
||||
MsgConfigureBladeRF2* message = MsgConfigureBladeRF2::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureBladeRF2* messageToGUI = MsgConfigureBladeRF2::create(m_settings, true);
|
||||
MsgConfigureBladeRF2* messageToGUI = MsgConfigureBladeRF2::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
|
@ -537,12 +537,12 @@ void BladeRF2Output::setCenterFrequency(qint64 centerFrequency)
|
|||
BladeRF2OutputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureBladeRF2* message = MsgConfigureBladeRF2::create(settings, false);
|
||||
MsgConfigureBladeRF2* message = MsgConfigureBladeRF2::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureBladeRF2* messageToGUI = MsgConfigureBladeRF2::create(settings, false);
|
||||
MsgConfigureBladeRF2* messageToGUI = MsgConfigureBladeRF2::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ bool BladeRF2Output::handleMessage(const Message& message)
|
|||
MsgConfigureBladeRF2& conf = (MsgConfigureBladeRF2&) message;
|
||||
qDebug() << "BladeRF2Output::handleMessage: MsgConfigureBladeRF2";
|
||||
|
||||
if (!applySettings(conf.getSettings(), conf.getForce()))
|
||||
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce()))
|
||||
{
|
||||
qDebug("BladeRF2Output::handleMessage: MsgConfigureBladeRF2 config error");
|
||||
}
|
||||
|
@ -622,10 +622,12 @@ bool BladeRF2Output::handleMessage(const Message& message)
|
|||
if (dev) // The BladeRF device must have been open to do so
|
||||
{
|
||||
int requestedChannel = m_deviceAPI->getDeviceItemIndex();
|
||||
QList<QString> settingsKeys;
|
||||
|
||||
if (report.getRxElseTx()) // Rx buddy change: check for sample rate change only
|
||||
{
|
||||
settings.m_devSampleRate = report.getDevSampleRate();
|
||||
settingsKeys.append("devSampleRate");
|
||||
// status = bladerf_get_sample_rate(dev, BLADERF_CHANNEL_TX(requestedChannel), &tmp_uint);
|
||||
//
|
||||
// if (status < 0) {
|
||||
|
@ -639,6 +641,9 @@ bool BladeRF2Output::handleMessage(const Message& message)
|
|||
settings.m_devSampleRate = report.getDevSampleRate();
|
||||
settings.m_LOppmTenths = report.getLOppmTenths();
|
||||
settings.m_centerFrequency = report.getCenterFrequency();
|
||||
settingsKeys.append("devSampleRate");
|
||||
settingsKeys.append("LOppmTenths");
|
||||
settingsKeys.append("centerFrequency");
|
||||
|
||||
status = bladerf_get_bandwidth(dev, BLADERF_CHANNEL_TX(requestedChannel), &tmp_uint);
|
||||
|
||||
|
@ -646,6 +651,7 @@ bool BladeRF2Output::handleMessage(const Message& message)
|
|||
qCritical("BladeRF2Output::handleMessage: MsgReportBuddyChange: bladerf_get_bandwidth error: %s", bladerf_strerror(status));
|
||||
} else {
|
||||
settings.m_bandwidth = tmp_uint;
|
||||
settingsKeys.append("bandwidth");
|
||||
}
|
||||
|
||||
status = bladerf_get_bias_tee(dev, BLADERF_CHANNEL_TX(requestedChannel), &tmp_bool);
|
||||
|
@ -654,23 +660,24 @@ bool BladeRF2Output::handleMessage(const Message& message)
|
|||
qCritical("BladeRF2Output::handleMessage: MsgReportBuddyChange: bladerf_get_bias_tee error: %s", bladerf_strerror(status));
|
||||
} else {
|
||||
settings.m_biasTee = tmp_bool;
|
||||
settingsKeys.append("biasTee");
|
||||
}
|
||||
}
|
||||
|
||||
// change DSP settings if buddy change introduced a change in center frequency or base rate
|
||||
if ((settings.m_centerFrequency != m_settings.m_centerFrequency) || (settings.m_devSampleRate != m_settings.m_devSampleRate))
|
||||
if (settingsKeys.contains("centerFrequency") || settingsKeys.contains("devSampleRate"))
|
||||
{
|
||||
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Interp);
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_centerFrequency);
|
||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||
}
|
||||
|
||||
m_settings = settings; // acknowledge the new settings
|
||||
m_settings.applySettings(settingsKeys, settings); // acknowledge the new settings
|
||||
|
||||
// propagate settings to GUI if any
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
MsgConfigureBladeRF2 *reportToGUI = MsgConfigureBladeRF2::create(m_settings, false);
|
||||
MsgConfigureBladeRF2 *reportToGUI = MsgConfigureBladeRF2::create(m_settings, settingsKeys, false);
|
||||
getMessageQueueToGUI()->push(reportToGUI);
|
||||
}
|
||||
}
|
||||
|
@ -684,8 +691,7 @@ bool BladeRF2Output::handleMessage(const Message& message)
|
|||
|
||||
if (cmd.getStartStop())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine()) {
|
||||
m_deviceAPI->startDeviceEngine();
|
||||
}
|
||||
}
|
||||
|
@ -706,23 +712,24 @@ bool BladeRF2Output::handleMessage(const Message& message)
|
|||
}
|
||||
}
|
||||
|
||||
bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool force)
|
||||
bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
qDebug() << "BladeRF2Output::applySettings: force:" << force << settings.getDebugString(settingsKeys, force);
|
||||
bool forwardChangeOwnDSP = false;
|
||||
bool forwardChangeRxBuddies = false;
|
||||
bool forwardChangeTxBuddies = false;
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
struct bladerf *dev = m_deviceShared.m_dev->getDev();
|
||||
int requestedChannel = m_deviceAPI->getDeviceItemIndex();
|
||||
int nbChannels = getNbChannels();
|
||||
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
||||
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || (m_settings.m_log2Interp != settings.m_log2Interp) || force)
|
||||
// if ((m_settings.m_devSampleRate != settings.m_devSampleRate) ||
|
||||
// (m_settings.m_log2Interp != settings.m_log2Interp) || force)
|
||||
if (settingsKeys.contains("devSampleRate") ||
|
||||
settingsKeys.contains("log2Interp") || force)
|
||||
{
|
||||
reverseAPIKeys.append("devSampleRate");
|
||||
BladeRF2OutputThread *bladeRF2OutputThread = findThread();
|
||||
SampleSourceFifo *fifo = nullptr;
|
||||
|
||||
|
@ -747,7 +754,7 @@ bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force)
|
||||
if (settingsKeys.contains("devSampleRate") || force)
|
||||
{
|
||||
forwardChangeOwnDSP = true;
|
||||
forwardChangeRxBuddies = true;
|
||||
|
@ -773,9 +780,8 @@ bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_bandwidth != settings.m_bandwidth) || force)
|
||||
if (settingsKeys.contains("bandwidth") || force)
|
||||
{
|
||||
reverseAPIKeys.append("bandwidth");
|
||||
forwardChangeTxBuddies = true;
|
||||
|
||||
if (dev != 0)
|
||||
|
@ -795,9 +801,8 @@ bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2Interp != settings.m_log2Interp) || force)
|
||||
if (settingsKeys.contains("log2Interp") || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2Interp");
|
||||
forwardChangeOwnDSP = true;
|
||||
BladeRF2OutputThread *outputThread = findThread();
|
||||
|
||||
|
@ -808,24 +813,11 @@ bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
if ((m_settings.m_transverterMode != settings.m_transverterMode) || force) {
|
||||
reverseAPIKeys.append("transverterMode");
|
||||
}
|
||||
if ((m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force) {
|
||||
reverseAPIKeys.append("transverterDeltaFrequency");
|
||||
}
|
||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) {
|
||||
reverseAPIKeys.append("LOppmTenths");
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)
|
||||
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|
||||
|| (m_settings.m_devSampleRate != settings.m_devSampleRate) || force)
|
||||
if (settingsKeys.contains("centerFrequency")
|
||||
|| settingsKeys.contains("transverterMode")
|
||||
|| settingsKeys.contains("transverterDeltaFrequency")
|
||||
|| settingsKeys.contains("LOppmTenths")
|
||||
|| settingsKeys.contains("devSampleRate") || force)
|
||||
{
|
||||
forwardChangeOwnDSP = true;
|
||||
forwardChangeTxBuddies = true;
|
||||
|
@ -846,16 +838,14 @@ bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_biasTee != settings.m_biasTee) || force)
|
||||
if (settingsKeys.contains("biasTee") || force)
|
||||
{
|
||||
reverseAPIKeys.append("biasTee");
|
||||
forwardChangeTxBuddies = true;
|
||||
m_deviceShared.m_dev->setBiasTeeTx(settings.m_biasTee);
|
||||
}
|
||||
|
||||
if ((m_settings.m_globalGain != settings.m_globalGain) || force)
|
||||
if (settingsKeys.contains("globalGain") || force)
|
||||
{
|
||||
reverseAPIKeys.append("globalGain");
|
||||
forwardChangeTxBuddies = true;
|
||||
|
||||
if (dev)
|
||||
|
@ -915,29 +905,20 @@ bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool
|
|||
}
|
||||
}
|
||||
|
||||
if (settings.m_useReverseAPI)
|
||||
if (settingsKeys.contains("useReverseAPI"))
|
||||
{
|
||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex);
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||
settingsKeys.contains("reverseAPIAddress") ||
|
||||
settingsKeys.contains("reverseAPIPort") ||
|
||||
settingsKeys.contains("reverseAPIDeviceIndex");
|
||||
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
|
||||
qDebug() << "BladeRF2Output::applySettings: "
|
||||
<< " m_transverterMode: " << m_settings.m_transverterMode
|
||||
<< " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
|
||||
<< " deviceCenterFrequency: " << deviceCenterFrequency
|
||||
<< " m_centerFrequency: " << m_settings.m_centerFrequency << " Hz"
|
||||
<< " m_LOppmTenths: " << m_settings.m_LOppmTenths
|
||||
<< " m_bandwidth: " << m_settings.m_bandwidth
|
||||
<< " m_log2Interp: " << m_settings.m_log2Interp
|
||||
<< " m_devSampleRate: " << m_settings.m_devSampleRate
|
||||
<< " nbChannels: " << nbChannels
|
||||
<< " m_globalGain: " << m_settings.m_globalGain
|
||||
<< " m_biasTee: " << m_settings.m_biasTee;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -974,12 +955,12 @@ int BladeRF2Output::webapiSettingsPutPatch(
|
|||
BladeRF2OutputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureBladeRF2 *msg = MsgConfigureBladeRF2::create(settings, force);
|
||||
MsgConfigureBladeRF2 *msg = MsgConfigureBladeRF2::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureBladeRF2 *msgToGUI = MsgConfigureBladeRF2::create(settings, force);
|
||||
MsgConfigureBladeRF2 *msgToGUI = MsgConfigureBladeRF2::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
|
@ -1138,7 +1119,7 @@ int BladeRF2Output::webapiRun(
|
|||
return 200;
|
||||
}
|
||||
|
||||
void BladeRF2Output::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF2OutputSettings& settings, bool force)
|
||||
void BladeRF2Output::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF2OutputSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setDirection(1); // single Tx
|
||||
|
|
|
@ -41,20 +41,22 @@ public:
|
|||
|
||||
public:
|
||||
const BladeRF2OutputSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureBladeRF2* create(const BladeRF2OutputSettings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigureBladeRF2(settings, force);
|
||||
static MsgConfigureBladeRF2* create(const BladeRF2OutputSettings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigureBladeRF2(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
BladeRF2OutputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureBladeRF2(const BladeRF2OutputSettings& settings, bool force) :
|
||||
MsgConfigureBladeRF2(const BladeRF2OutputSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
|
@ -181,11 +183,11 @@ private:
|
|||
void closeDevice();
|
||||
BladeRF2OutputThread *findThread();
|
||||
void moveThreadToBuddy();
|
||||
bool applySettings(const BladeRF2OutputSettings& settings, bool force);
|
||||
bool applySettings(const BladeRF2OutputSettings& settings, const QList<QString>& settingsKeys, bool force);
|
||||
int getNbChannels();
|
||||
bool setDeviceCenterFrequency(struct bladerf *dev, int requestedChannel, quint64 freq_hz, int loPpmTenths);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF2OutputSettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF2OutputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -105,6 +105,7 @@ void BladeRF2OutputGui::resetToDefaults()
|
|||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -171,7 +172,13 @@ bool BladeRF2OutputGui::handleMessage(const Message& message)
|
|||
if (BladeRF2Output::MsgConfigureBladeRF2::match(message))
|
||||
{
|
||||
const BladeRF2Output::MsgConfigureBladeRF2& cfg = (BladeRF2Output::MsgConfigureBladeRF2&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
|
||||
blockApplySettings(true);
|
||||
m_sampleSink->getGlobalGainRange(m_gainMin, m_gainMax, m_gainStep, m_gainScale);
|
||||
ui->gain->setMinimum(m_gainMin/m_gainStep);
|
||||
|
@ -306,13 +313,15 @@ void BladeRF2OutputGui::displaySettings()
|
|||
|
||||
void BladeRF2OutputGui::sendSettings()
|
||||
{
|
||||
if(!m_updateTimer.isActive())
|
||||
if (!m_updateTimer.isActive()) {
|
||||
m_updateTimer.start(100);
|
||||
}
|
||||
}
|
||||
|
||||
void BladeRF2OutputGui::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_centerFrequency = value * 1000;
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -320,6 +329,7 @@ void BladeRF2OutputGui::on_LOppm_valueChanged(int value)
|
|||
{
|
||||
ui->LOppmText->setText(QString("%1").arg(QString::number(value/10.0, 'f', 1)));
|
||||
m_settings.m_LOppmTenths = value;
|
||||
m_settingsKeys.append("LOppmTenths");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -331,18 +341,21 @@ void BladeRF2OutputGui::on_sampleRate_changed(quint64 value)
|
|||
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2Interp);
|
||||
}
|
||||
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void BladeRF2OutputGui::on_biasTee_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_biasTee = checked;
|
||||
m_settingsKeys.append("biasTee");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void BladeRF2OutputGui::on_bandwidth_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_bandwidth = value * 1000;
|
||||
m_settingsKeys.append("bandwidth");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -353,6 +366,7 @@ void BladeRF2OutputGui::on_interp_currentIndexChanged(int index)
|
|||
}
|
||||
|
||||
m_settings.m_log2Interp = index;
|
||||
m_settingsKeys.append("log2Interp");
|
||||
displaySampleRate();
|
||||
|
||||
if (m_sampleRateMode) {
|
||||
|
@ -361,6 +375,7 @@ void BladeRF2OutputGui::on_interp_currentIndexChanged(int index)
|
|||
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Interp);
|
||||
}
|
||||
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -369,6 +384,7 @@ void BladeRF2OutputGui::on_gain_valueChanged(int value)
|
|||
float displayableGain = getGainDB(value);
|
||||
ui->gainText->setText(tr("%1 dB").arg(QString::number(displayableGain, 'f', 2)));
|
||||
m_settings.m_globalGain = (int) displayableGain;
|
||||
m_settingsKeys.append("globalGain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -379,6 +395,9 @@ void BladeRF2OutputGui::on_transverter_clicked()
|
|||
qDebug("LimeSDRInputGUI::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
||||
updateFrequencyLimits();
|
||||
setCenterFrequencySetting(ui->centerFrequency->getValueNew());
|
||||
m_settingsKeys.append("transverterMode");
|
||||
m_settingsKeys.append("transverterDeltaFrequency");
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -402,9 +421,10 @@ void BladeRF2OutputGui::updateHardware()
|
|||
if (m_doApplySettings)
|
||||
{
|
||||
qDebug() << "BladeRF2OutputGui::updateHardware";
|
||||
BladeRF2Output::MsgConfigureBladeRF2* message = BladeRF2Output::MsgConfigureBladeRF2::create(m_settings, m_forceSettings);
|
||||
BladeRF2Output::MsgConfigureBladeRF2* message = BladeRF2Output::MsgConfigureBladeRF2::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_sampleSink->getInputMessageQueue()->push(message);
|
||||
m_forceSettings = false;
|
||||
m_settingsKeys.clear();
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
}
|
||||
|
@ -455,6 +475,10 @@ void BladeRF2OutputGui::openDeviceSettingsDialog(const QPoint& p)
|
|||
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
||||
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
||||
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
||||
m_settingsKeys.append("useReverseAPI");
|
||||
m_settingsKeys.append("reverseAPIAddress");
|
||||
m_settingsKeys.append("reverseAPIPort");
|
||||
m_settingsKeys.append("reverseAPIDeviceIndex");
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ private:
|
|||
bool m_doApplySettings;
|
||||
bool m_forceSettings;
|
||||
BladeRF2OutputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
|
|
|
@ -107,6 +107,92 @@ bool BladeRF2OutputSettings::deserialize(const QByteArray& data)
|
|||
}
|
||||
}
|
||||
|
||||
void BladeRF2OutputSettings::applySettings(const QStringList& settingsKeys, const BladeRF2OutputSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("centerFrequency")) {
|
||||
m_centerFrequency = settings.m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("LOppmTenths")) {
|
||||
m_LOppmTenths = settings.m_LOppmTenths;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate")) {
|
||||
m_devSampleRate = settings.m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("bandwidth")) {
|
||||
m_bandwidth = settings.m_bandwidth;
|
||||
}
|
||||
if (settingsKeys.contains("globalGain")) {
|
||||
m_globalGain = settings.m_globalGain;
|
||||
}
|
||||
if (settingsKeys.contains("biasTee")) {
|
||||
m_biasTee = settings.m_biasTee;
|
||||
}
|
||||
if (settingsKeys.contains("log2Interp")) {
|
||||
m_log2Interp = settings.m_log2Interp;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode")) {
|
||||
m_transverterMode = settings.m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency")) {
|
||||
m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI")) {
|
||||
m_useReverseAPI = settings.m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress")) {
|
||||
m_reverseAPIAddress = settings.m_reverseAPIAddress;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort")) {
|
||||
m_reverseAPIPort = settings.m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
QString BladeRF2OutputSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("centerFrequency") || force) {
|
||||
ostr << " m_centerFrequency: " << m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("LOppmTenths") || force) {
|
||||
ostr << " m_LOppmTenths: " << m_LOppmTenths;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate") || force) {
|
||||
ostr << " m_devSampleRate: " << m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("bandwidth") || force) {
|
||||
ostr << " m_bandwidth: " << m_bandwidth;
|
||||
}
|
||||
if (settingsKeys.contains("globalGain") || force) {
|
||||
ostr << " m_globalGain: " << m_globalGain;
|
||||
}
|
||||
if (settingsKeys.contains("biasTee") || force) {
|
||||
ostr << " m_biasTee: " << m_biasTee;
|
||||
}
|
||||
if (settingsKeys.contains("log2Interp") || force) {
|
||||
ostr << " m_log2Interp: " << m_log2Interp;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode") || force) {
|
||||
ostr << " m_transverterMode: " << m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency") || force) {
|
||||
ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI") || force) {
|
||||
ostr << " m_useReverseAPI: " << m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress") || force) {
|
||||
ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort") || force) {
|
||||
ostr << " m_reverseAPIPort: " << m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) {
|
||||
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
|
||||
}
|
||||
|
||||
return QString(ostr.str().c_str());
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ struct BladeRF2OutputSettings {
|
|||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const BladeRF2OutputSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue