1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-02 13:17:48 -04:00

PlutoSDR output: interim state (2)

This commit is contained in:
f4exb 2017-09-19 08:33:26 +02:00
parent 35717477d6
commit c2b7092026
4 changed files with 33 additions and 34 deletions

View File

@ -596,7 +596,7 @@ void DevicePlutoSDRBox::getXO()
} }
} }
bool DevicePlutoSDRBox::getRSSI(std::string& rssiStr, unsigned int chan) bool DevicePlutoSDRBox::getRxRSSI(std::string& rssiStr, unsigned int chan)
{ {
chan = chan % 2; chan = chan % 2;
char buff[20]; char buff[20];
@ -604,6 +604,14 @@ bool DevicePlutoSDRBox::getRSSI(std::string& rssiStr, unsigned int chan)
return get_param(DEVICE_PHY, buff, rssiStr); return get_param(DEVICE_PHY, buff, rssiStr);
} }
bool DevicePlutoSDRBox::getTxRSSI(std::string& rssiStr, unsigned int chan)
{
chan = chan % 2;
char buff[20];
snprintf(buff, sizeof(buff), "out_voltage%d_rssi", chan);
return get_param(DEVICE_PHY, buff, rssiStr);
}
bool DevicePlutoSDRBox::fetchTemp() bool DevicePlutoSDRBox::fetchTemp()
{ {
std::string temp_mC_str; std::string temp_mC_str;

View File

@ -92,7 +92,8 @@ public:
void setFIR(uint32_t sampleRate, uint32_t intdec, DeviceUse use, uint32_t bw, int gain); void setFIR(uint32_t sampleRate, uint32_t intdec, DeviceUse use, uint32_t bw, int gain);
void setFIREnable(bool enable); void setFIREnable(bool enable);
void setLOPPMTenths(int ppmTenths); void setLOPPMTenths(int ppmTenths);
bool getRSSI(std::string& rssiStr, unsigned int chan); bool getRxRSSI(std::string& rssiStr, unsigned int chan);
bool getTxRSSI(std::string& rssiStr, unsigned int chan);
bool fetchTemp(); bool fetchTemp();
float getTemp() const { return m_temp; } float getTemp() const { return m_temp; }
bool getRateGovernors(std::string& rateGovernors); bool getRateGovernors(std::string& rateGovernors);

View File

@ -321,46 +321,37 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
{ {
plutoBox->setLOPPMTenths(settings.m_LOppmTenths); plutoBox->setLOPPMTenths(settings.m_LOppmTenths);
// TODO: forward change to Rx forwardChangeOtherDSP = true;
} }
// TODO: continue from here
std::vector<std::string> params; std::vector<std::string> params;
bool paramsToSet = false; bool paramsToSet = false;
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force)
{ {
params.push_back(QString(tr("out_altvoltage0_RX_LO_frequency=%1").arg(settings.m_centerFrequency)).toStdString()); params.push_back(QString(tr("out_altvoltage1_TX_LO_frequency=%1").arg(settings.m_centerFrequency)).toStdString());
paramsToSet = true; paramsToSet = true;
forwardChangeOwnDSP = true; forwardChangeOwnDSP = true;
} }
if ((m_settings.m_lpfBW != settings.m_lpfBW) || force) if ((m_settings.m_lpfBW != settings.m_lpfBW) || force)
{ {
params.push_back(QString(tr("in_voltage_rf_bandwidth=%1").arg(settings.m_lpfBW)).toStdString()); params.push_back(QString(tr("out_voltage_rf_bandwidth=%1").arg(settings.m_lpfBW)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_antennaPath != settings.m_antennaPath) || force) if ((m_settings.m_antennaPath != settings.m_antennaPath) || force)
{ {
QString rfPortStr; QString rfPortStr;
PlutoSDRInputSettings::translateRFPath(settings.m_antennaPath, rfPortStr); PlutoSDROutputSettings::translateRFPath(settings.m_antennaPath, rfPortStr);
params.push_back(QString(tr("in_voltage0_rf_port_select=%1").arg(rfPortStr)).toStdString()); params.push_back(QString(tr("out_voltage0_rf_port_select=%1").arg(rfPortStr)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_gainMode != settings.m_gainMode) || force) if ((m_settings.m_att != settings.m_att) || force)
{ {
QString gainModeStr; float attF = settings.m_att * 0.25f;
PlutoSDRInputSettings::translateGainMode(settings.m_gainMode, gainModeStr); params.push_back(QString(tr("out_voltage0_hardwaregain=%1").arg(attF)).toStdString());
params.push_back(QString(tr("in_voltage0_gain_control_mode=%1").arg(gainModeStr)).toStdString());
paramsToSet = true;
}
if ((m_settings.m_gain != settings.m_gain) || force)
{
params.push_back(QString(tr("in_voltage0_hardwaregain=%1").arg(settings.m_gain)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
@ -373,12 +364,12 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
if (suspendAllOtherThreads) if (suspendAllOtherThreads)
{ {
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies(); const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin(); std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
for (; itSink != sinkBuddies.end(); ++itSink) for (; itSource != sourceBuddies.end(); ++itSource)
{ {
DevicePlutoSDRShared *buddySharedPtr = (DevicePlutoSDRShared *) (*itSink)->getBuddySharedPtr(); DevicePlutoSDRShared *buddySharedPtr = (DevicePlutoSDRShared *) (*itSource)->getBuddySharedPtr();
if (buddySharedPtr->m_threadWasRunning) { if (buddySharedPtr->m_threadWasRunning) {
buddySharedPtr->m_thread->startWork(); buddySharedPtr->m_thread->startWork();
@ -389,45 +380,44 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
if (suspendOwnThread) if (suspendOwnThread)
{ {
if (ownThreadWasRunning) { if (ownThreadWasRunning) {
m_plutoSDRInputThread->startWork(); m_plutoSDROutputThread->startWork();
} }
} }
// TODO: forward changes to other (Tx) DSP // TODO: forward changes to other (Rx) DSP
if (forwardChangeOtherDSP) if (forwardChangeOtherDSP)
{ {
qDebug("PlutoSDRInput::applySettings: forwardChangeOtherDSP"); qDebug("PlutoSDROutput::applySettings: forwardChangeOtherDSP");
} }
if (forwardChangeOwnDSP) if (forwardChangeOwnDSP)
{ {
qDebug("PlutoSDRInput::applySettings: forward change to self"); qDebug("PlutoSDROutput::applySettings: forward change to self");
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim); int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Interp);
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency); DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
m_fileSink->handleMessage(*notif); // forward to file sink
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif); m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
} }
return true; return true;
} }
void PlutoSDRInput::getRSSI(std::string& rssiStr) void PlutoSDROutput::getRSSI(std::string& rssiStr)
{ {
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox(); DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
if (!plutoBox->getRSSI(rssiStr, 0)) { if (!plutoBox->getTxRSSI(rssiStr, 0)) {
rssiStr = "xxx dB"; rssiStr = "xxx dB";
} }
} }
bool PlutoSDRInput::fetchTemperature() bool PlutoSDROutput::fetchTemperature()
{ {
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox(); DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
return plutoBox->fetchTemp(); return plutoBox->fetchTemp();
} }
float PlutoSDRInput::getTemperature() float PlutoSDROutput::getTemperature()
{ {
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox(); DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
return plutoBox->getTemp(); return plutoBox->getTemp();

View File

@ -458,7 +458,7 @@ void PlutoSDRInput::getRSSI(std::string& rssiStr)
{ {
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox(); DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
if (!plutoBox->getRSSI(rssiStr, 0)) { if (!plutoBox->getRxRSSI(rssiStr, 0)) {
rssiStr = "xxx dB"; rssiStr = "xxx dB";
} }
} }