1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-05 16:31:15 -05:00

Deep redesign: Fixed FCD interface so that it (only) basically works

This commit is contained in:
f4exb 2015-08-27 06:27:40 +02:00
parent bb35ad6925
commit c348cc62e0
5 changed files with 23 additions and 10 deletions

View File

@ -1,6 +1,7 @@
#include "fcdgui.h" #include "fcdgui.h"
#include "ui_fcdgui.h" #include "ui_fcdgui.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "gui/colormapper.h"
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
FCDGui::FCDGui(PluginAPI* pluginAPI, QWidget* parent) : FCDGui::FCDGui(PluginAPI* pluginAPI, QWidget* parent) :
@ -11,7 +12,8 @@ FCDGui::FCDGui(PluginAPI* pluginAPI, QWidget* parent) :
m_sampleSource(NULL) m_sampleSource(NULL)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setValueRange(7, 420000U, 1900000U); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, 64000U, 1700000U);
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
displaySettings(); displaySettings();
@ -100,7 +102,7 @@ void FCDGui::updateHardware()
void FCDGui::on_checkBoxR_stateChanged(int state) void FCDGui::on_checkBoxR_stateChanged(int state)
{ {
if (state == Qt::Checked) if (state == Qt::Checked) // FIXME: this is for the Pro+ version only!
{ {
ui->centerFrequency->setValueRange(7, 150U, 240000U); ui->centerFrequency->setValueRange(7, 150U, 240000U);
ui->centerFrequency->setValue(7000); ui->centerFrequency->setValue(7000);
@ -109,7 +111,7 @@ void FCDGui::on_checkBoxR_stateChanged(int state)
} }
else else
{ {
ui->centerFrequency->setValueRange(7, 420000U, 1900000U); ui->centerFrequency->setValueRange(7, 64000U, 1900000U);
ui->centerFrequency->setValue(435000); ui->centerFrequency->setValue(435000);
m_settings.centerFrequency = 435000 * 1000; m_settings.centerFrequency = 435000 * 1000;
m_settings.range = 0; m_settings.range = 0;

View File

@ -15,6 +15,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// FIXME: FCD is handled very badly!
#include <QDebug>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "fcdinput.h" #include "fcdinput.h"
@ -154,6 +157,7 @@ bool FCDInput::handleMessage(const Message& message)
{ {
if(MsgConfigureFCD::match(message)) if(MsgConfigureFCD::match(message))
{ {
qDebug() << "FCDInput::handleMessage: MsgConfigureFCD";
MsgConfigureFCD& conf = (MsgConfigureFCD&) message; MsgConfigureFCD& conf = (MsgConfigureFCD&) message;
applySettings(conf.getSettings(), false); applySettings(conf.getSettings(), false);
return true; return true;
@ -166,22 +170,29 @@ bool FCDInput::handleMessage(const Message& message)
void FCDInput::applySettings(const Settings& settings, bool force) void FCDInput::applySettings(const Settings& settings, bool force)
{ {
bool sampleSourcChange = false; bool signalChange = false;
if ((m_settings.centerFrequency != settings.centerFrequency)) if ((m_settings.centerFrequency != settings.centerFrequency))
{ {
qDebug() << "FCDInput::applySettings: fc: " << settings.centerFrequency;
m_settings.centerFrequency = settings.centerFrequency; m_settings.centerFrequency = settings.centerFrequency;
set_center_freq((double) m_settings.centerFrequency); set_center_freq((double) m_settings.centerFrequency);
sampleSourcChange = true; signalChange = true;
} }
if (!sampleSourcChange || force) if ((m_settings.gain != settings.gain) || force)
{ {
set_lna_gain(settings.gain > 0); set_lna_gain(settings.gain > 0);
set_bias_t(settings.bias > 0); m_settings.gain = settings.gain;
} }
if (sampleSourcChange) if ((m_settings.bias != settings.bias) || force)
{
set_bias_t(settings.bias > 0);
m_settings.bias = settings.bias;
}
if (signalChange)
{ {
DSPSignalNotification *notif = new DSPSignalNotification(960000, m_settings.centerFrequency); DSPSignalNotification *notif = new DSPSignalNotification(960000, m_settings.centerFrequency);
getOutputMessageQueue()->push(notif); getOutputMessageQueue()->push(notif);

View File

@ -42,7 +42,7 @@ void FCDThread::stopWork()
void FCDThread::run() void FCDThread::run()
{ {
if ( !OpenSource("hw:CARD=V20") ) if ( !OpenSource("hw:CARD=V10") ) // FIXME: original is V10 pro is V20. Make it an option
return; return;
// TODO: fallback to original fcd // TODO: fallback to original fcd

View File

@ -25,7 +25,7 @@
#include "dsp/inthalfbandfilter.h" #include "dsp/inthalfbandfilter.h"
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#define FCDPP_RATE 192000 #define FCDPP_RATE 192000 // FIXME: The Pro / Pro+ switch should be handled better than this!
#define BLOCKSIZE 8192 #define BLOCKSIZE 8192
class FCDThread : public QThread { class FCDThread : public QThread {

View File

@ -34,7 +34,7 @@
typedef bool BOOL; typedef bool BOOL;
#define FCDPP //#define FCDPP // FIXME: the Pro / Pro+ switch should be handled better than this!
const unsigned short _usVID=0x04D8; /*!< USB vendor ID. */ const unsigned short _usVID=0x04D8; /*!< USB vendor ID. */
#ifdef FCDPP #ifdef FCDPP
const unsigned short _usPID=0xFB31; /*!< USB product ID. */ const unsigned short _usPID=0xFB31; /*!< USB product ID. */