mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-29 05:22:25 -04:00
Improved GNU Radio plugin usability. Removed osmosdr completely from the build as it is superceded by GNU Radio
This commit is contained in:
parent
695a1ca526
commit
26b9c324e7
@ -17,7 +17,7 @@ Funcube Dongle Pro+ USB drivers are broken on some hardware with recent kernels.
|
|||||||
BladeRF
|
BladeRF
|
||||||
=======
|
=======
|
||||||
|
|
||||||
No support. Ends up with: `Hierarchical blocks do not yet support arbitrary or variable numbers of inputs or outputs`
|
You need a very recent (May 2015) version of gr-osmosdr. 0.1.1 does not work but 0.1.5 does. Check to which library points the symbolic link `libgnuradio-osmosdr.so`. It should be something like: `libgnuradio-osmosdr-0.1.5git.so.0.0.`
|
||||||
|
|
||||||
==========
|
==========
|
||||||
For Ubuntu
|
For Ubuntu
|
||||||
@ -67,6 +67,10 @@ Known Issues
|
|||||||
- Does not work properly for RTL-SDR sampling rates not multiple of AF sampling rate (48000 Hz). This is because the interpolator/decimator is not a rational resampler actually (just does one or the other). For now please use 288, 1152 or 1536 kHz sampling rates,
|
- Does not work properly for RTL-SDR sampling rates not multiple of AF sampling rate (48000 Hz). This is because the interpolator/decimator is not a rational resampler actually (just does one or the other). For now please use 288, 1152 or 1536 kHz sampling rates,
|
||||||
- RTL frontend will have bad aliasing in noisy environments. Considering the size of the hardware there is no place for proper filters. With good filtering and a good antenna up front these devices work remarkably well for the price!
|
- RTL frontend will have bad aliasing in noisy environments. Considering the size of the hardware there is no place for proper filters. With good filtering and a good antenna up front these devices work remarkably well for the price!
|
||||||
- Aliasing can be annoying for broadcast FM. In this case try to shift the signal until you find a clear background for your station. This is a limitation of the RTL hardware so just use this workaround.
|
- Aliasing can be annoying for broadcast FM. In this case try to shift the signal until you find a clear background for your station. This is a limitation of the RTL hardware so just use this workaround.
|
||||||
|
- GNU Radio plugin is still not fully functional:
|
||||||
|
- Current settings are not saved and retrieved on the next session
|
||||||
|
- DC offset and I/Q policy is not working properly and has been disabled (effectively enforces the
|
||||||
|
"keep" mode always)
|
||||||
|
|
||||||
===================
|
===================
|
||||||
Done since the fork
|
Done since the fork
|
||||||
@ -87,12 +91,12 @@ Done since the fork
|
|||||||
- Make the low cutoff frequency of the SSB filter variable so it can be used for CW also.
|
- Make the low cutoff frequency of the SSB filter variable so it can be used for CW also.
|
||||||
- NFM demodulation without using atan and smooth squelch with AGC suppressing most clicks on low level signals and hiss on carrier tails. Only useful modulation comes through.
|
- NFM demodulation without using atan and smooth squelch with AGC suppressing most clicks on low level signals and hiss on carrier tails. Only useful modulation comes through.
|
||||||
- Added working WFM demodulation. Optimized for no atan2.
|
- Added working WFM demodulation. Optimized for no atan2.
|
||||||
|
- Improved GNU Radio plugin usability with most settings saved on a preset
|
||||||
|
|
||||||
=====
|
=====
|
||||||
To Do
|
To Do
|
||||||
=====
|
=====
|
||||||
|
|
||||||
- Missing de-emphasis on WFM
|
|
||||||
- Enhance WFM (stereo, RDS?)
|
- Enhance WFM (stereo, RDS?)
|
||||||
- Make the the SSB filter frequency bounds tunable so that it can be used for CW. Change marker overlay accordingly.
|
- Make the the SSB filter frequency bounds tunable so that it can be used for CW. Change marker overlay accordingly.
|
||||||
- Possibility to completely undock the receiver in a separate window. Useful when there are many receivers
|
- Possibility to completely undock the receiver in a separate window. Useful when there are many receivers
|
||||||
|
@ -122,6 +122,7 @@ private slots:
|
|||||||
void on_action_View_Fullscreen_toggled(bool checked);
|
void on_action_View_Fullscreen_toggled(bool checked);
|
||||||
void on_presetSave_clicked();
|
void on_presetSave_clicked();
|
||||||
void on_presetUpdate_clicked();
|
void on_presetUpdate_clicked();
|
||||||
|
void on_presetLastLoad_clicked();
|
||||||
void on_presetLoad_clicked();
|
void on_presetLoad_clicked();
|
||||||
void on_presetDelete_clicked();
|
void on_presetDelete_clicked();
|
||||||
void on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
void on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||||
|
93
include/util/stacktrace.h
Normal file
93
include/util/stacktrace.h
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
// stacktrace.h (c) 2008, Timo Bingmann from http://idlebox.net/
|
||||||
|
// published under the WTFPL v2.0
|
||||||
|
|
||||||
|
#ifndef _STACKTRACE_H_
|
||||||
|
#define _STACKTRACE_H_
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <execinfo.h>
|
||||||
|
#include <cxxabi.h>
|
||||||
|
|
||||||
|
/** Print a demangled stack backtrace of the caller function to FILE* out. */
|
||||||
|
static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames = 63)
|
||||||
|
{
|
||||||
|
fprintf(out, "stack trace:\n");
|
||||||
|
|
||||||
|
// storage array for stack trace address data
|
||||||
|
void* addrlist[max_frames+1];
|
||||||
|
|
||||||
|
// retrieve current stack addresses
|
||||||
|
int addrlen = backtrace(addrlist, sizeof(addrlist) / sizeof(void*));
|
||||||
|
|
||||||
|
if (addrlen == 0) {
|
||||||
|
fprintf(out, " <empty, possibly corrupt>\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// resolve addresses into strings containing "filename(function+address)",
|
||||||
|
// this array must be free()-ed
|
||||||
|
char** symbollist = backtrace_symbols(addrlist, addrlen);
|
||||||
|
|
||||||
|
// allocate string which will be filled with the demangled function name
|
||||||
|
size_t funcnamesize = 256;
|
||||||
|
char* funcname = (char*)malloc(funcnamesize);
|
||||||
|
|
||||||
|
// iterate over the returned symbol lines. skip the first, it is the
|
||||||
|
// address of this function.
|
||||||
|
for (int i = 1; i < addrlen; i++)
|
||||||
|
{
|
||||||
|
char *begin_name = 0, *begin_offset = 0, *end_offset = 0;
|
||||||
|
|
||||||
|
// find parentheses and +address offset surrounding the mangled name:
|
||||||
|
// ./module(function+0x15c) [0x8048a6d]
|
||||||
|
for (char *p = symbollist[i]; *p; ++p)
|
||||||
|
{
|
||||||
|
if (*p == '(')
|
||||||
|
begin_name = p;
|
||||||
|
else if (*p == '+')
|
||||||
|
begin_offset = p;
|
||||||
|
else if (*p == ')' && begin_offset) {
|
||||||
|
end_offset = p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (begin_name && begin_offset && end_offset
|
||||||
|
&& begin_name < begin_offset)
|
||||||
|
{
|
||||||
|
*begin_name++ = '\0';
|
||||||
|
*begin_offset++ = '\0';
|
||||||
|
*end_offset = '\0';
|
||||||
|
|
||||||
|
// mangled name is now in [begin_name, begin_offset) and caller
|
||||||
|
// offset in [begin_offset, end_offset). now apply
|
||||||
|
// __cxa_demangle():
|
||||||
|
|
||||||
|
int status;
|
||||||
|
char* ret = abi::__cxa_demangle(begin_name,
|
||||||
|
funcname, &funcnamesize, &status);
|
||||||
|
if (status == 0) {
|
||||||
|
funcname = ret; // use possibly realloc()-ed string
|
||||||
|
fprintf(out, " %s : %s+%s\n",
|
||||||
|
symbollist[i], funcname, begin_offset);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// demangling failed. Output function name as a C function with
|
||||||
|
// no arguments.
|
||||||
|
fprintf(out, " %s : %s()+%s\n",
|
||||||
|
symbollist[i], begin_name, begin_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// couldn't parse the line? print the whole line.
|
||||||
|
fprintf(out, " %s\n", symbollist[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(funcname);
|
||||||
|
free(symbollist);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _STACKTRACE_H_
|
@ -6,9 +6,9 @@ find_package(LibUSB)
|
|||||||
add_subdirectory(gnuradio)
|
add_subdirectory(gnuradio)
|
||||||
#add_subdirectory(remote)
|
#add_subdirectory(remote)
|
||||||
|
|
||||||
if(LIBUSB_FOUND AND LIBOSMOSDR_FOUND)
|
#if(LIBUSB_FOUND AND LIBOSMOSDR_FOUND)
|
||||||
add_subdirectory(osmosdr)
|
# add_subdirectory(osmosdr)
|
||||||
endif(LIBUSB_FOUND AND LIBOSMOSDR_FOUND)
|
#endif(LIBUSB_FOUND AND LIBOSMOSDR_FOUND)
|
||||||
|
|
||||||
if(V4L-RTL)
|
if(V4L-RTL)
|
||||||
FIND_LIBRARY (LIBV4L2 v4l2)
|
FIND_LIBRARY (LIBV4L2 v4l2)
|
||||||
|
@ -36,7 +36,8 @@ GNURadioGui::GNURadioGui(PluginAPI* pluginAPI, QWidget* parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||||||
displaySettings();
|
//displaySettings();
|
||||||
|
updateDisplayDevices();
|
||||||
|
|
||||||
m_sampleSource = new GNURadioInput(m_pluginAPI->getMainWindowMessageQueue());
|
m_sampleSource = new GNURadioInput(m_pluginAPI->getMainWindowMessageQueue());
|
||||||
m_pluginAPI->setSampleSource(m_sampleSource);
|
m_pluginAPI->setSampleSource(m_sampleSource);
|
||||||
@ -119,32 +120,24 @@ bool GNURadioGui::handleMessage(Message* message)
|
|||||||
m_bandwidths = rep->getBandwidths();
|
m_bandwidths = rep->getBandwidths();
|
||||||
/* insert 0 which will become "Auto" in the combo box */
|
/* insert 0 which will become "Auto" in the combo box */
|
||||||
m_bandwidths.insert(m_bandwidths.begin(), 0);
|
m_bandwidths.insert(m_bandwidths.begin(), 0);
|
||||||
displaySettings();
|
//displaySettings();
|
||||||
|
updateDisplayConstants();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GNURadioGui::displaySettings()
|
void GNURadioGui::updateDisplayDevices()
|
||||||
{
|
{
|
||||||
int oldIndex = 0;
|
// Device list
|
||||||
|
|
||||||
oldIndex = ui->cboDevices->currentIndex();
|
|
||||||
ui->cboDevices->clear();
|
|
||||||
|
|
||||||
QString oldArgs = ui->txtDeviceArgs->text();
|
|
||||||
|
|
||||||
osmosdr::devices_t devices = osmosdr::device::find();
|
osmosdr::devices_t devices = osmosdr::device::find();
|
||||||
|
|
||||||
for ( uint i = 0; i < devices.size(); i++ )
|
for ( uint i = 0; i < devices.size(); i++ ) {
|
||||||
{
|
|
||||||
osmosdr::device_t dev = devices[i];
|
osmosdr::device_t dev = devices[i];
|
||||||
|
|
||||||
QString label;
|
QString label;
|
||||||
|
|
||||||
if ( dev.count( "label" ) )
|
if ( dev.count( "label" ) ) {
|
||||||
{
|
|
||||||
label = QString(dev[ "label" ].c_str());
|
label = QString(dev[ "label" ].c_str());
|
||||||
dev.erase("label");
|
dev.erase("label");
|
||||||
}
|
}
|
||||||
@ -155,29 +148,16 @@ void GNURadioGui::displaySettings()
|
|||||||
ui->cboDevices->addItem(label);
|
ui->cboDevices->addItem(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ui->cboDevices->count() && oldIndex >= 0 )
|
if ( ui->cboDevices->count() ) {
|
||||||
{
|
ui->cboDevices->setEnabled(true);
|
||||||
if ( oldIndex > ui->cboDevices->count() - 1 )
|
} else {
|
||||||
oldIndex = 0;
|
ui->cboDevices->setEnabled(false);
|
||||||
|
|
||||||
ui->cboDevices->setCurrentIndex(oldIndex);
|
|
||||||
|
|
||||||
if ( oldArgs.length() == 0 )
|
|
||||||
ui->txtDeviceArgs->setText( m_devs[oldIndex].second );
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( oldArgs.length() )
|
void GNURadioGui::updateDisplayConstants()
|
||||||
ui->txtDeviceArgs->setText( oldArgs );
|
{
|
||||||
|
// Device specific gain controls
|
||||||
ui->centerFrequency->setValueRange(7,
|
|
||||||
unsigned(m_freqMin / 1000.0),
|
|
||||||
unsigned(m_freqMax / 1000.0));
|
|
||||||
|
|
||||||
ui->centerFrequency->setValue(m_generalSettings.m_centerFrequency / 1000);
|
|
||||||
|
|
||||||
ui->sldFreqCorr->setRange(-100, +100);
|
|
||||||
ui->sldFreqCorr->setValue( m_freqCorr );
|
|
||||||
ui->lblFreqCorr->setText(tr("%1").arg(ui->sldFreqCorr->value()));
|
|
||||||
|
|
||||||
m_gainControls.clear();
|
m_gainControls.clear();
|
||||||
QVBoxLayout *layoutGains = ui->verticalLayoutGains;
|
QVBoxLayout *layoutGains = ui->verticalLayoutGains;
|
||||||
@ -213,17 +193,20 @@ void GNURadioGui::displaySettings()
|
|||||||
QPair< QSlider*, QLabel* > pair2( gainSlider, gainLabel );
|
QPair< QSlider*, QLabel* > pair2( gainSlider, gainLabel );
|
||||||
m_gainControls.push_back( pair2 );
|
m_gainControls.push_back( pair2 );
|
||||||
|
|
||||||
connect(gainSlider, SIGNAL(valueChanged(int)),
|
|
||||||
this, SLOT(on_sldGain_valueChanged(int)));
|
|
||||||
|
|
||||||
layout->addWidget(gainName);
|
layout->addWidget(gainName);
|
||||||
layout->addWidget(gainSlider);
|
layout->addWidget(gainSlider);
|
||||||
layout->addWidget(gainLabel);
|
layout->addWidget(gainLabel);
|
||||||
|
|
||||||
|
m_gainSliders.push_back(gainSlider);
|
||||||
|
m_gainLabels.push_back(gainLabel);
|
||||||
|
|
||||||
layoutGains->addLayout(layout);
|
layoutGains->addLayout(layout);
|
||||||
|
|
||||||
std::vector<double> gain_values = pair.second;
|
std::vector<double> gain_values = pair.second;
|
||||||
|
|
||||||
|
connect(gainSlider, SIGNAL(valueChanged(int)),
|
||||||
|
this, SLOT(on_sldGain_valueChanged(int)));
|
||||||
|
|
||||||
if ( gain_values.size() ) {
|
if ( gain_values.size() ) {
|
||||||
gainSlider->setRange(0, gain_values.size() - 1);
|
gainSlider->setRange(0, gain_values.size() - 1);
|
||||||
gainSlider->setValue(gain_values.size() / 4);
|
gainSlider->setValue(gain_values.size() / 4);
|
||||||
@ -233,17 +216,12 @@ void GNURadioGui::displaySettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oldIndex = ui->cboSampleRate->currentIndex();
|
// Sample rate
|
||||||
ui->cboSampleRate->clear();
|
|
||||||
|
|
||||||
for ( uint i = 0; i < m_sampRates.size(); i++ )
|
if (m_sampRates.size()) {
|
||||||
ui->cboSampleRate->addItem( QString::number(m_sampRates[i] / 1e6) );
|
for ( uint i = 0; i < m_sampRates.size(); i++ )
|
||||||
|
ui->cboSampleRate->addItem( QString::number(m_sampRates[i] / 1e6) );
|
||||||
if ( oldIndex > ui->cboSampleRate->count() - 1 )
|
}
|
||||||
oldIndex = 0;
|
|
||||||
|
|
||||||
if ( ui->cboSampleRate->count() && oldIndex >= 0 )
|
|
||||||
ui->cboSampleRate->setCurrentIndex(oldIndex);
|
|
||||||
|
|
||||||
if ( ui->cboSampleRate->count() ) {
|
if ( ui->cboSampleRate->count() ) {
|
||||||
ui->cboSampleRate->setEnabled(true);
|
ui->cboSampleRate->setEnabled(true);
|
||||||
@ -251,68 +229,53 @@ void GNURadioGui::displaySettings()
|
|||||||
ui->cboSampleRate->setEnabled(false);
|
ui->cboSampleRate->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldIndex = ui->cboAntennas->currentIndex();
|
// Antenna
|
||||||
ui->cboAntennas->clear();
|
|
||||||
|
|
||||||
if ( m_antennas.size() ) {
|
if ( m_antennas.size() ) {
|
||||||
for ( uint i = 0; i < m_antennas.size(); i++ )
|
for ( uint i = 0; i < m_antennas.size(); i++ )
|
||||||
ui->cboAntennas->addItem( m_antennas[i] );
|
ui->cboAntennas->addItem( m_antennas[i] );
|
||||||
|
}
|
||||||
|
|
||||||
if ( oldIndex > ui->cboAntennas->count() - 1 )
|
if (ui->cboAntennas->count()) {
|
||||||
oldIndex = 0;
|
|
||||||
|
|
||||||
if ( ui->cboAntennas->count() && oldIndex >= 0 )
|
|
||||||
ui->cboAntennas->setCurrentIndex(oldIndex);
|
|
||||||
|
|
||||||
ui->cboAntennas->setEnabled(true);
|
ui->cboAntennas->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
ui->cboAntennas->setEnabled(false);
|
ui->cboAntennas->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldIndex = ui->cboDCOffset->currentIndex();
|
// DC offset policy
|
||||||
ui->cboDCOffset->clear();
|
|
||||||
|
|
||||||
if ( m_dcoffs.size() ) {
|
if ( m_dcoffs.size() ) {
|
||||||
for ( uint i = 0; i < m_dcoffs.size(); i++ )
|
for ( uint i = 0; i < m_dcoffs.size(); i++ )
|
||||||
ui->cboDCOffset->addItem( m_dcoffs[i] );
|
ui->cboDCOffset->addItem( m_dcoffs[i] );
|
||||||
|
}
|
||||||
|
|
||||||
if ( ui->cboDCOffset->count() && oldIndex >= 0 )
|
if (ui->cboDCOffset->count()) {
|
||||||
ui->cboDCOffset->setCurrentIndex(oldIndex);
|
|
||||||
|
|
||||||
ui->cboDCOffset->setEnabled(true);
|
ui->cboDCOffset->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
ui->cboDCOffset->setEnabled(false);
|
ui->cboDCOffset->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldIndex = ui->cboIQBalance->currentIndex();
|
// I/Q balance policy
|
||||||
ui->cboIQBalance->clear();
|
|
||||||
|
|
||||||
if ( m_iqbals.size() ) {
|
if ( m_iqbals.size() ) {
|
||||||
for ( uint i = 0; i < m_iqbals.size(); i++ )
|
for ( uint i = 0; i < m_iqbals.size(); i++ )
|
||||||
ui->cboIQBalance->addItem( m_iqbals[i] );
|
ui->cboIQBalance->addItem( m_iqbals[i] );
|
||||||
|
}
|
||||||
|
|
||||||
if ( ui->cboIQBalance->count() && oldIndex >= 0 )
|
if (ui->cboIQBalance->count()) {
|
||||||
ui->cboIQBalance->setCurrentIndex(oldIndex);
|
|
||||||
|
|
||||||
ui->cboIQBalance->setEnabled(true);
|
ui->cboIQBalance->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
ui->cboIQBalance->setEnabled(false);
|
ui->cboIQBalance->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldIndex = ui->cboBandwidth->currentIndex();
|
// Bandwidths
|
||||||
ui->cboBandwidth->clear();
|
|
||||||
|
|
||||||
for ( uint i = 0; i < m_bandwidths.size(); i++ )
|
for ( uint i = 0; i < m_bandwidths.size(); i++ ) {
|
||||||
if ( 0.0 == m_bandwidths[i] )
|
if ( 0.0 == m_bandwidths[i] )
|
||||||
ui->cboBandwidth->addItem( "Auto" );
|
ui->cboBandwidth->addItem( "Auto" );
|
||||||
else
|
else
|
||||||
ui->cboBandwidth->addItem( QString::number(m_bandwidths[i] / 1e6) );
|
ui->cboBandwidth->addItem( QString::number(m_bandwidths[i] / 1e6) );
|
||||||
|
}
|
||||||
if ( oldIndex > ui->cboBandwidth->count() - 1 )
|
|
||||||
oldIndex = 0;
|
|
||||||
|
|
||||||
if ( ui->cboBandwidth->count() && oldIndex >= 0 )
|
|
||||||
ui->cboBandwidth->setCurrentIndex(oldIndex);
|
|
||||||
|
|
||||||
if ( ui->cboBandwidth->count() ) {
|
if ( ui->cboBandwidth->count() ) {
|
||||||
ui->cboBandwidth->setEnabled(true);
|
ui->cboBandwidth->setEnabled(true);
|
||||||
@ -321,6 +284,141 @@ void GNURadioGui::displaySettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GNURadioGui::displaySettings()
|
||||||
|
{
|
||||||
|
int oldIndex = 0;
|
||||||
|
|
||||||
|
// Device list
|
||||||
|
|
||||||
|
oldIndex = ui->cboDevices->currentIndex();
|
||||||
|
QString oldArgs = ui->txtDeviceArgs->text();
|
||||||
|
|
||||||
|
if ( ui->cboDevices->count() && oldIndex >= 0 )
|
||||||
|
{
|
||||||
|
if ( oldIndex > ui->cboDevices->count() - 1 )
|
||||||
|
oldIndex = 0;
|
||||||
|
|
||||||
|
ui->cboDevices->setCurrentIndex(oldIndex);
|
||||||
|
|
||||||
|
if ( oldArgs.length() == 0 )
|
||||||
|
ui->txtDeviceArgs->setText( m_devs[oldIndex].second );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( oldArgs.length() )
|
||||||
|
ui->txtDeviceArgs->setText( oldArgs );
|
||||||
|
|
||||||
|
// Center frequency
|
||||||
|
|
||||||
|
ui->centerFrequency->setValueRange(7,
|
||||||
|
unsigned(m_freqMin / 1000.0),
|
||||||
|
unsigned(m_freqMax / 1000.0));
|
||||||
|
|
||||||
|
ui->centerFrequency->setValue(m_generalSettings.m_centerFrequency / 1000);
|
||||||
|
|
||||||
|
// Device specific gain controls
|
||||||
|
|
||||||
|
for ( uint i = 0; i < m_namedGains.size(); i++ )
|
||||||
|
{
|
||||||
|
double gain = m_settings.m_namedGains[i].second;
|
||||||
|
int sliderIndex = getGainIndex(m_namedGains[i].second, gain);
|
||||||
|
m_gainSliders[i]->setValue(sliderIndex);
|
||||||
|
m_gainLabels[i]->setText(tr("%1").arg(gain));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Frequency correction
|
||||||
|
|
||||||
|
ui->sldFreqCorr->setRange(-100, +100);
|
||||||
|
ui->sldFreqCorr->setValue( m_freqCorr );
|
||||||
|
ui->lblFreqCorr->setText(tr("%1").arg(ui->sldFreqCorr->value()));
|
||||||
|
|
||||||
|
// Sample rate
|
||||||
|
ui->cboSampleRate->setCurrentIndex(getSampleRateIndex(m_settings.m_sampRate));
|
||||||
|
|
||||||
|
// Antenna
|
||||||
|
ui->cboAntennas->setCurrentIndex(getAntennaIndex(m_settings.m_antenna));
|
||||||
|
|
||||||
|
// DC offset policy
|
||||||
|
ui->cboDCOffset->setCurrentIndex(getDCOffsetIndex(m_settings.m_dcoff));
|
||||||
|
|
||||||
|
// I/Q balance policy
|
||||||
|
ui->cboIQBalance->setCurrentIndex(getIQBalanceIndex(m_settings.m_iqbal));
|
||||||
|
|
||||||
|
// Bandwidth
|
||||||
|
ui->cboBandwidth->setCurrentIndex(getBandwidthIndex(m_settings.m_bandwidth));
|
||||||
|
}
|
||||||
|
|
||||||
|
int GNURadioGui::getSampleRateIndex(double sampleRate)
|
||||||
|
{
|
||||||
|
int index = m_sampRates.size() - 1;
|
||||||
|
|
||||||
|
for ( uint i = 0; i < m_sampRates.size(); i++ ) {
|
||||||
|
if (sampleRate >= m_sampRates[i]) {
|
||||||
|
index = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GNURadioGui::getGainIndex(std::vector<double> steps, double gain)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for (std::vector<double>::const_iterator it = steps.begin(); it != steps.end(); ++it, index++) {
|
||||||
|
if (gain <= *it) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GNURadioGui::getBandwidthIndex(double bandwidth)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for ( uint i = 0; i < m_bandwidths.size(); index++ ) {
|
||||||
|
if (bandwidth <= m_bandwidths[i]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GNURadioGui::getDCOffsetIndex(QString offsetStr)
|
||||||
|
{
|
||||||
|
for ( uint i = 0; i < m_dcoffs.size(); i++ ) {
|
||||||
|
if (offsetStr == m_dcoffs[i]) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GNURadioGui::getIQBalanceIndex(QString iqBalanceStr)
|
||||||
|
{
|
||||||
|
for ( uint i = 0; i < m_iqbals.size(); i++ ) {
|
||||||
|
if (iqBalanceStr == m_iqbals[i]) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GNURadioGui::getAntennaIndex(QString antennaStr)
|
||||||
|
{
|
||||||
|
for ( uint i = 0; i < m_antennas.size(); i++ ) {
|
||||||
|
if (antennaStr == m_antennas[i]) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void GNURadioGui::sendSettings()
|
void GNURadioGui::sendSettings()
|
||||||
{
|
{
|
||||||
if(!m_updateTimer.isActive())
|
if(!m_updateTimer.isActive())
|
||||||
|
@ -76,11 +76,19 @@ private:
|
|||||||
SampleSource::GeneralSettings m_generalSettings;
|
SampleSource::GeneralSettings m_generalSettings;
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
|
|
||||||
|
void updateDisplayDevices();
|
||||||
|
void updateDisplayConstants();
|
||||||
void displaySettings();
|
void displaySettings();
|
||||||
void sendSettings();
|
void sendSettings();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateHardware();
|
void updateHardware();
|
||||||
|
int getSampleRateIndex(double sampleRate);
|
||||||
|
int getDCOffsetIndex(QString offsetStr);
|
||||||
|
int getIQBalanceIndex(QString iqBalanceStr);
|
||||||
|
int getAntennaIndex(QString antennaStr);
|
||||||
|
int getBandwidthIndex(double bandwidth);
|
||||||
|
int getGainIndex(std::vector<double> steps, double gain);
|
||||||
|
|
||||||
void on_cboDevices_currentIndexChanged(int index);
|
void on_cboDevices_currentIndexChanged(int index);
|
||||||
void on_txtDeviceArgs_textChanged(const QString &arg1);
|
void on_txtDeviceArgs_textChanged(const QString &arg1);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>186</width>
|
<width>201</width>
|
||||||
<height>261</height>
|
<height>276</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -156,10 +156,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QSlider" name="sldGain">
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="sldFreqCorr">
|
<widget class="QSlider" name="sldFreqCorr">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
|
@ -31,8 +31,8 @@ GNURadioInput::Settings::Settings() :
|
|||||||
m_freqCorr(0),
|
m_freqCorr(0),
|
||||||
m_sampRate(0),
|
m_sampRate(0),
|
||||||
m_antenna(""),
|
m_antenna(""),
|
||||||
m_dcoff(""),
|
m_dcoff("Keep"),
|
||||||
m_iqbal(""),
|
m_iqbal("Keep"),
|
||||||
m_bandwidth(0)
|
m_bandwidth(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -43,20 +43,27 @@ void GNURadioInput::Settings::resetToDefaults()
|
|||||||
m_sampRate = 0;
|
m_sampRate = 0;
|
||||||
m_freqCorr = 0;
|
m_freqCorr = 0;
|
||||||
m_antenna = "";
|
m_antenna = "";
|
||||||
m_dcoff = "";
|
m_dcoff = "Keep";
|
||||||
m_iqbal = "";
|
m_iqbal = "Keep";
|
||||||
m_bandwidth = 0;
|
m_bandwidth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray GNURadioInput::Settings::serialize() const
|
QByteArray GNURadioInput::Settings::serialize() const
|
||||||
{
|
{
|
||||||
SimpleSerializer s(1);
|
SimpleSerializer s(1);
|
||||||
// s.writeString(1, m_args);
|
s.writeString(1, m_args);
|
||||||
// s.writeDouble(2, m_freqCorr);
|
s.writeDouble(2, m_freqCorr);
|
||||||
// s.writeDouble(3, m_sampRate);
|
s.writeDouble(3, m_sampRate);
|
||||||
// s.writeString(4, m_antenna);
|
s.writeString(4, m_antenna);
|
||||||
// s.writeString(5, m_dcoff);
|
s.writeString(5, m_dcoff);
|
||||||
// s.writeString(5, m_iqbal);
|
s.writeString(6, m_iqbal);
|
||||||
|
s.writeDouble(7, m_bandwidth);
|
||||||
|
|
||||||
|
for (int i=0; i < m_namedGains.size(); i++)
|
||||||
|
{
|
||||||
|
s.writeDouble(100+i, m_namedGains[i].second);
|
||||||
|
}
|
||||||
|
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,12 +77,21 @@ bool GNURadioInput::Settings::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(d.getVersion() == 1) {
|
if(d.getVersion() == 1) {
|
||||||
// d.readString(1, &m_args, "");
|
d.readString(1, &m_args, "");
|
||||||
// d.readDouble(2, &m_freqCorr, 0);
|
d.readDouble(2, &m_freqCorr, 0);
|
||||||
// d.readDouble(3, &m_sampRate, 0);
|
d.readDouble(3, &m_sampRate, 0);
|
||||||
// d.readString(4, &m_antenna, "");
|
d.readString(4, &m_antenna, "");
|
||||||
// d.readString(5, &m_dcoff, "");
|
d.readString(5, &m_dcoff, "Keep");
|
||||||
// d.readString(5, &m_iqbal, "");
|
d.readString(6, &m_iqbal, "Keep");
|
||||||
|
d.readDouble(7, &m_bandwidth, 0);
|
||||||
|
|
||||||
|
for (int i = 0; i < m_namedGains.size(); i++)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
d.readDouble(100+i, &value, 0);
|
||||||
|
m_namedGains[i].second = value;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
resetToDefaults();
|
resetToDefaults();
|
||||||
@ -125,7 +141,7 @@ bool GNURadioInput::startInput(int device)
|
|||||||
m_GnuradioThread->startWork();
|
m_GnuradioThread->startWork();
|
||||||
|
|
||||||
mutexLocker.unlock();
|
mutexLocker.unlock();
|
||||||
applySettings(m_generalSettings, m_settings, true);
|
//applySettings(m_generalSettings, m_settings, true);
|
||||||
|
|
||||||
if(m_GnuradioThread != NULL) {
|
if(m_GnuradioThread != NULL) {
|
||||||
osmosdr::source::sptr radio = m_GnuradioThread->radio();
|
osmosdr::source::sptr radio = m_GnuradioThread->radio();
|
||||||
@ -289,6 +305,8 @@ bool GNURadioInput::applySettings(const GeneralSettings& generalSettings,
|
|||||||
radio->set_antenna( m_settings.m_antenna.toStdString() );
|
radio->set_antenna( m_settings.m_antenna.toStdString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Removed as it is incapable of handling it correctly (initialize at "Keep").
|
||||||
|
* For BladeRF it must be done via bladerRF-cli */
|
||||||
if((m_settings.m_dcoff != settings.m_dcoff) || force) {
|
if((m_settings.m_dcoff != settings.m_dcoff) || force) {
|
||||||
m_settings.m_dcoff = settings.m_dcoff;
|
m_settings.m_dcoff = settings.m_dcoff;
|
||||||
|
|
||||||
@ -297,7 +315,7 @@ bool GNURadioInput::applySettings(const GeneralSettings& generalSettings,
|
|||||||
if ( m_dcoffs[i] != m_settings.m_dcoff )
|
if ( m_dcoffs[i] != m_settings.m_dcoff )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
radio->set_dc_offset_mode( i );
|
//radio->set_dc_offset_mode( i );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -310,7 +328,7 @@ bool GNURadioInput::applySettings(const GeneralSettings& generalSettings,
|
|||||||
if ( m_iqbals[i] != m_settings.m_iqbal )
|
if ( m_iqbals[i] != m_settings.m_iqbal )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
radio->set_iq_balance_mode( i );
|
//radio->set_iq_balance_mode( i );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
const PluginDescriptor GNURadioPlugin::m_pluginDescriptor = {
|
const PluginDescriptor GNURadioPlugin::m_pluginDescriptor = {
|
||||||
QString("GR-OsmoSDR Input"),
|
QString("GR-OsmoSDR Input"),
|
||||||
QString("1.0"),
|
QString("1.0"),
|
||||||
QString("(c) Dimitri Stolnikov <horiz0n@gmx.net>"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("http://sdr.osmocom.org/trac/wiki/GrOsmoSDR"),
|
QString("https://github.com/f4exb/rtl-sdrangelove/tree/f4exb"),
|
||||||
true,
|
true,
|
||||||
QString("http://cgit.osmocom.org/cgit/gr-osmosdr")
|
QString("https://github.com/f4exb/rtl-sdrangelove/tree/f4exb")
|
||||||
};
|
};
|
||||||
|
|
||||||
GNURadioPlugin::GNURadioPlugin(QObject* parent) :
|
GNURadioPlugin::GNURadioPlugin(QObject* parent) :
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#include <gnuradio/sync_block.h>
|
#include <gnuradio/sync_block.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
class gr_adaptor;
|
class gr_adaptor;
|
||||||
|
|
||||||
@ -130,7 +128,6 @@ void GnuradioThread::stopWork()
|
|||||||
void GnuradioThread::run()
|
void GnuradioThread::run()
|
||||||
{
|
{
|
||||||
m_top = gr::make_top_block( "flowgraph" );
|
m_top = gr::make_top_block( "flowgraph" );
|
||||||
std::cerr << "GnuradioThread::run: " << m_args.toStdString() << std::endl;
|
|
||||||
m_src = osmosdr::source::make( m_args.toStdString() );
|
m_src = osmosdr::source::make( m_args.toStdString() );
|
||||||
|
|
||||||
/* now since we've constructed our shared objects, we allow the calling
|
/* now since we've constructed our shared objects, we allow the calling
|
||||||
|
@ -442,6 +442,12 @@ void MainWindow::on_presetUpdate_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_presetLastLoad_clicked()
|
||||||
|
{
|
||||||
|
m_settings.load();
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_presetLoad_clicked()
|
void MainWindow::on_presetLoad_clicked()
|
||||||
{
|
{
|
||||||
QTreeWidgetItem* item = ui->presetTree->currentItem();
|
QTreeWidgetItem* item = ui->presetTree->currentItem();
|
||||||
|
@ -156,7 +156,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="6">
|
<item row="5" column="8">
|
||||||
<widget class="QToolButton" name="presetLoad">
|
<widget class="QToolButton" name="presetLoad">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Load selected preset</string>
|
<string>Load selected preset</string>
|
||||||
@ -176,7 +176,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="4" colspan="2">
|
<item row="5" column="5" colspan="2">
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -209,7 +209,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" rowspan="4" colspan="6">
|
<item row="1" column="1" rowspan="4" colspan="8">
|
||||||
<widget class="QTreeWidget" name="presetTree">
|
<widget class="QTreeWidget" name="presetTree">
|
||||||
<property name="allColumnsShowFocus">
|
<property name="allColumnsShowFocus">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -246,6 +246,26 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="7">
|
||||||
|
<widget class="QToolButton" name="presetLoadLast">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Load settings saved at last exit</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources/res.qrc">
|
||||||
|
<normaloff>:/preset-last.png</normaloff>:/preset-last.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
BIN
sdrbase/resources/preset-last.png
Normal file
BIN
sdrbase/resources/preset-last.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -13,5 +13,6 @@
|
|||||||
<file>maxhold.png</file>
|
<file>maxhold.png</file>
|
||||||
<file>grid.png</file>
|
<file>grid.png</file>
|
||||||
<file>invertspectrum.png</file>
|
<file>invertspectrum.png</file>
|
||||||
|
<file>preset-last.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user