mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-29 03:09:14 -05:00
Removed main LimeRFE support
This commit is contained in:
parent
c057c86ef9
commit
d0c2b24694
@ -31,19 +31,6 @@ else(FFTW3F_FOUND)
|
||||
add_definitions(-DUSE_KISSFFT)
|
||||
endif(FFTW3F_FOUND)
|
||||
|
||||
if (LIMESUITE_FOUND)
|
||||
set(sdrbase_SOURCES
|
||||
${sdrbase_SOURCES}
|
||||
limerfe/limerfecontroller.cpp
|
||||
)
|
||||
set(sdrbase_HEADERS
|
||||
${sdrbase_HEADERS}
|
||||
limerfe/limerfecontroller.h
|
||||
)
|
||||
include_directories(${LIMESUITE_INCLUDE_DIR})
|
||||
set(sdrbase_LIMERFE_LIB ${LIMESUITE_LIBRARY})
|
||||
endif (LIMESUITE_FOUND)
|
||||
|
||||
if (LIBSIGMF_FOUND AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(sdrbase_SOURCES
|
||||
${sdrbase_SOURCES}
|
||||
@ -165,8 +152,6 @@ set(sdrbase_SOURCES
|
||||
feature/featureutils.cpp
|
||||
feature/featurewebapiutils.cpp
|
||||
|
||||
limerfe/limerfeusbcalib.cpp
|
||||
|
||||
pipes/datafifostore.cpp
|
||||
pipes/datapipes.cpp
|
||||
pipes/datapipesgcworker.cpp
|
||||
@ -373,8 +358,6 @@ set(sdrbase_HEADERS
|
||||
feature/featureutils.h
|
||||
feature/featurewebapiutils.h
|
||||
|
||||
limerfe/limerfeusbcalib.h
|
||||
|
||||
pipes/datafifostore.h
|
||||
pipes/datapipes.h
|
||||
pipes/datapipesgcworker.h
|
||||
|
@ -1,567 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// 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 <QDebug>
|
||||
|
||||
#include "limerfecontroller.h"
|
||||
|
||||
const std::map<int, std::string> LimeRFEController::m_errorCodesMap = {
|
||||
{ 0, "OK"},
|
||||
{-4, "Error synchronizing communication"},
|
||||
{-3, "Non-configurable GPIO pin specified. Only pins 4 and 5 are configurable."},
|
||||
{-2, "Problem with .ini configuration file"},
|
||||
{-1, "Communication error"},
|
||||
{ 1, "Wrong TX connector - not possible to route TX of the selecrted channel to the specified port"},
|
||||
{ 2, "Wrong RX connector - not possible to route RX of the selecrted channel to the specified port"},
|
||||
{ 3, "Mode TXRX not allowed - when the same port is selected for RX and TX, it is not allowed to use mode RX & TX"},
|
||||
{ 4, "Wrong mode for cellular channel - Cellular FDD bands (1, 2, 3, and 7) are only allowed mode RX & TX, while TDD band 38 is allowed only RX or TX mode"},
|
||||
{ 5, "Cellular channels must be the same both for RX and TX"},
|
||||
{ 6, "Requested channel code is wrong"}
|
||||
};
|
||||
|
||||
LimeRFEController::LimeRFESettings::LimeRFESettings()
|
||||
{
|
||||
m_rxChannels = ChannelsWideband;
|
||||
m_rxWidebandChannel = WidebandLow;
|
||||
m_rxHAMChannel = HAM_144_146MHz;
|
||||
m_rxCellularChannel = CellularBand38;
|
||||
m_rxPort = RxPortJ3;
|
||||
m_amfmNotch = false;
|
||||
m_attenuationFactor = 0;
|
||||
m_txChannels = ChannelsWideband;
|
||||
m_txWidebandChannel = WidebandLow;
|
||||
m_txHAMChannel = HAM_144_146MHz;
|
||||
m_txCellularChannel = CellularBand38;
|
||||
m_txPort = TxPortJ3;
|
||||
m_swrEnable = false;
|
||||
m_swrSource = SWRExternal;
|
||||
m_txRxDriven = false;
|
||||
m_rxOn = false;
|
||||
m_txOn = false;
|
||||
}
|
||||
|
||||
LimeRFEController::LimeRFEController() :
|
||||
m_rfeDevice(nullptr)
|
||||
{}
|
||||
|
||||
LimeRFEController::~LimeRFEController()
|
||||
{
|
||||
closeDevice();
|
||||
}
|
||||
|
||||
int LimeRFEController::openDevice(const std::string& serialDeviceName)
|
||||
{
|
||||
closeDevice();
|
||||
|
||||
rfe_dev_t *rfeDevice = RFE_Open(serialDeviceName.c_str(), nullptr);
|
||||
|
||||
if (rfeDevice != (void *) -1) {
|
||||
m_rfeDevice = rfeDevice;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEController::closeDevice()
|
||||
{
|
||||
if (m_rfeDevice)
|
||||
{
|
||||
RFE_Close(m_rfeDevice);
|
||||
m_rfeDevice = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
int LimeRFEController::configure()
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
qDebug() << "LimeRFEController::configure: "
|
||||
<< "attValue: " << (int) m_rfeBoardState.attValue
|
||||
<< "channelIDRX: " << (int) m_rfeBoardState.channelIDRX
|
||||
<< "channelIDTX: " << (int) m_rfeBoardState.channelIDTX
|
||||
<< "mode: " << (int) m_rfeBoardState.mode
|
||||
<< "notchOnOff: " << (int) m_rfeBoardState.notchOnOff
|
||||
<< "selPortRX: " << (int) m_rfeBoardState.selPortRX
|
||||
<< "selPortTX: " << (int) m_rfeBoardState.selPortTX
|
||||
<< "enableSWR: " << (int) m_rfeBoardState.enableSWR
|
||||
<< "sourceSWR: " << (int) m_rfeBoardState.sourceSWR;
|
||||
|
||||
int rc = RFE_ConfigureState(m_rfeDevice, m_rfeBoardState);
|
||||
|
||||
if (rc != 0) {
|
||||
qInfo("LimeRFEController::configure: %s", getError(rc).c_str());
|
||||
} else {
|
||||
qDebug() << "LimeRFEController::configure: done";
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int LimeRFEController::getState()
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rc = RFE_GetState(m_rfeDevice, &m_rfeBoardState);
|
||||
|
||||
qDebug() << "LimeRFEController::getState: "
|
||||
<< "attValue: " << (int) m_rfeBoardState.attValue
|
||||
<< "channelIDRX: " << (int) m_rfeBoardState.channelIDRX
|
||||
<< "channelIDTX: " << (int) m_rfeBoardState.channelIDTX
|
||||
<< "mode: " << (int) m_rfeBoardState.mode
|
||||
<< "notchOnOff: " << (int) m_rfeBoardState.notchOnOff
|
||||
<< "selPortRX: " << (int) m_rfeBoardState.selPortRX
|
||||
<< "selPortTX: " << (int) m_rfeBoardState.selPortTX
|
||||
<< "enableSWR: " << (int) m_rfeBoardState.enableSWR
|
||||
<< "sourceSWR: " << (int) m_rfeBoardState.sourceSWR;
|
||||
|
||||
if (rc != 0) {
|
||||
qInfo("LimeRFEController::getState: %s", getError(rc).c_str());
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
std::string LimeRFEController::getError(int errorCode)
|
||||
{
|
||||
std::map<int, std::string>::const_iterator it = m_errorCodesMap.find(errorCode);
|
||||
|
||||
if (it == m_errorCodesMap.end()) {
|
||||
return "Unknown error";
|
||||
} else {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
int LimeRFEController::setRx(LimeRFESettings& settings, bool rxOn)
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int mode = rxOn && settings.m_txOn ?
|
||||
RFE_MODE_TXRX : rxOn ?
|
||||
RFE_MODE_RX : settings.m_txOn ?
|
||||
RFE_MODE_TX : RFE_MODE_NONE;
|
||||
|
||||
int rc = RFE_Mode(m_rfeDevice, mode);
|
||||
|
||||
if (rc == 0) {
|
||||
settings.m_rxOn = rxOn;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int LimeRFEController::setTx(LimeRFESettings& settings, bool txOn)
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int mode = txOn && settings.m_rxOn ?
|
||||
RFE_MODE_TXRX : txOn ?
|
||||
RFE_MODE_TX : settings.m_rxOn ?
|
||||
RFE_MODE_RX : RFE_MODE_NONE;
|
||||
|
||||
int rc = RFE_Mode(m_rfeDevice, mode);
|
||||
|
||||
if (rc == 0) {
|
||||
settings.m_txOn = txOn;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int LimeRFEController::getFwdPower(int& powerDB)
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int power;
|
||||
int rc = RFE_ReadADC(m_rfeDevice, RFE_ADC1, &power);
|
||||
|
||||
if (rc == 0) {
|
||||
powerDB = power;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int LimeRFEController::getRefPower(int& powerDB)
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int power;
|
||||
int rc = RFE_ReadADC(m_rfeDevice, RFE_ADC2, &power);
|
||||
|
||||
if (rc == 0) {
|
||||
powerDB = power;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void LimeRFEController::settingsToState(const LimeRFESettings& settings)
|
||||
{
|
||||
if (settings.m_rxChannels == ChannelsCellular)
|
||||
{
|
||||
if (settings.m_rxCellularChannel == CellularBand1)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND01;
|
||||
m_rfeBoardState.mode = RFE_MODE_TXRX;
|
||||
}
|
||||
else if (settings.m_rxCellularChannel == CellularBand2)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND02;
|
||||
m_rfeBoardState.mode = RFE_MODE_TXRX;
|
||||
}
|
||||
else if (settings.m_rxCellularChannel == CellularBand3)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND03;
|
||||
m_rfeBoardState.mode = RFE_MODE_TXRX;
|
||||
}
|
||||
else if (settings.m_rxCellularChannel == CellularBand38)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND38;
|
||||
}
|
||||
else if (settings.m_rxCellularChannel == CellularBand7)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND07;
|
||||
m_rfeBoardState.mode = RFE_MODE_TXRX;
|
||||
}
|
||||
|
||||
m_rfeBoardState.selPortRX = RFE_PORT_1;
|
||||
m_rfeBoardState.selPortTX = RFE_PORT_1;
|
||||
m_rfeBoardState.channelIDTX = m_rfeBoardState.channelIDRX;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rfeBoardState.mode = settings.m_rxOn && settings.m_txOn ?
|
||||
RFE_MODE_TXRX : settings.m_rxOn ?
|
||||
RFE_MODE_RX : settings.m_txOn ?
|
||||
RFE_MODE_TX : RFE_MODE_NONE;
|
||||
|
||||
if (settings.m_rxChannels == ChannelsWideband)
|
||||
{
|
||||
if (settings.m_rxWidebandChannel == WidebandLow) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_WB_1000;
|
||||
} else if (settings.m_rxWidebandChannel == WidebandHigh) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_WB_4000;
|
||||
}
|
||||
}
|
||||
else if (settings.m_rxChannels == ChannelsHAM)
|
||||
{
|
||||
if (settings.m_rxHAMChannel == HAM_30M) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0030;
|
||||
} else if (settings.m_rxHAMChannel == HAM_50_70MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0070;
|
||||
} else if (settings.m_rxHAMChannel == HAM_144_146MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0145;
|
||||
} else if (settings.m_rxHAMChannel == HAM_220_225MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0220;
|
||||
} else if (settings.m_rxHAMChannel == HAM_430_440MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0435;
|
||||
} else if (settings.m_rxHAMChannel == HAM_902_928MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0920;
|
||||
} else if (settings.m_rxHAMChannel == HAM_1240_1325MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_1280;
|
||||
} else if (settings.m_rxHAMChannel == HAM_2300_2450MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_2400;
|
||||
} else if (settings.m_rxHAMChannel == HAM_3300_3500MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_3500;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.m_rxPort == RxPortJ3) {
|
||||
m_rfeBoardState.selPortRX = RFE_PORT_1;
|
||||
} else if (settings.m_rxPort == RxPortJ5) {
|
||||
m_rfeBoardState.selPortRX = RFE_PORT_3;
|
||||
}
|
||||
|
||||
if (settings.m_txRxDriven)
|
||||
{
|
||||
m_rfeBoardState.channelIDTX = m_rfeBoardState.channelIDRX;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (settings.m_txChannels == ChannelsWideband)
|
||||
{
|
||||
if (settings.m_txWidebandChannel == WidebandLow) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_WB_1000;
|
||||
} else if (settings.m_txWidebandChannel == WidebandHigh) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_WB_4000;
|
||||
}
|
||||
}
|
||||
else if (settings.m_txChannels == ChannelsHAM)
|
||||
{
|
||||
if (settings.m_txHAMChannel == HAM_30M) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0030;
|
||||
} else if (settings.m_txHAMChannel == HAM_50_70MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0070;
|
||||
} else if (settings.m_txHAMChannel == HAM_144_146MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0145;
|
||||
} else if (settings.m_txHAMChannel == HAM_220_225MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0220;
|
||||
} else if (settings.m_txHAMChannel == HAM_430_440MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0435;
|
||||
} else if (settings.m_txHAMChannel == HAM_902_928MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0920;
|
||||
} else if (settings.m_txHAMChannel == HAM_1240_1325MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_1280;
|
||||
} else if (settings.m_txHAMChannel == HAM_2300_2450MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_2400;
|
||||
} else if (settings.m_txHAMChannel == HAM_3300_3500MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_3500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.m_txPort == TxPortJ3) {
|
||||
m_rfeBoardState.selPortTX = RFE_PORT_1;
|
||||
} else if (settings.m_txPort == TxPortJ4) {
|
||||
m_rfeBoardState.selPortTX = RFE_PORT_2;
|
||||
} else if (settings.m_txPort == TxPortJ5) {
|
||||
m_rfeBoardState.selPortTX = RFE_PORT_3;
|
||||
}
|
||||
}
|
||||
|
||||
m_rfeBoardState.attValue = settings.m_attenuationFactor > 7 ? 7 : settings.m_attenuationFactor;
|
||||
m_rfeBoardState.notchOnOff = settings.m_amfmNotch;
|
||||
m_rfeBoardState.enableSWR = settings.m_swrEnable ? RFE_SWR_ENABLE : RFE_SWR_DISABLE;
|
||||
|
||||
if (settings.m_swrSource == SWRExternal) {
|
||||
m_rfeBoardState.sourceSWR = RFE_SWR_SRC_EXT;
|
||||
} else if (settings.m_swrSource == SWRCellular) {
|
||||
m_rfeBoardState.sourceSWR = RFE_SWR_SRC_CELL;
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEController::stateToSettings(LimeRFESettings& settings)
|
||||
{
|
||||
if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND01)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsCellular;
|
||||
settings.m_rxCellularChannel = CellularBand1;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND02)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsCellular;
|
||||
settings.m_rxCellularChannel = CellularBand2;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND03)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsCellular;
|
||||
settings.m_rxCellularChannel = CellularBand3;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND07)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsCellular;
|
||||
settings.m_rxCellularChannel = CellularBand7;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND38)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsCellular;
|
||||
settings.m_rxCellularChannel = CellularBand38;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_WB_1000)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsWideband;
|
||||
settings.m_rxWidebandChannel = WidebandLow;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_WB_4000)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsWideband;
|
||||
settings.m_rxWidebandChannel = WidebandHigh;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0030)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsHAM;
|
||||
settings.m_rxHAMChannel = HAM_30M;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0070)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsHAM;
|
||||
settings.m_rxHAMChannel = HAM_50_70MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0145)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsHAM;
|
||||
settings.m_rxHAMChannel = HAM_144_146MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0220)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsHAM;
|
||||
settings.m_rxHAMChannel = HAM_220_225MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0435)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsHAM;
|
||||
settings.m_rxHAMChannel = HAM_430_440MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0920)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsHAM;
|
||||
settings.m_rxHAMChannel = HAM_902_928MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_1280)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsHAM;
|
||||
settings.m_rxHAMChannel = HAM_1240_1325MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_2400)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsHAM;
|
||||
settings.m_rxHAMChannel = HAM_2300_2450MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_3500)
|
||||
{
|
||||
settings.m_rxChannels = ChannelsHAM;
|
||||
settings.m_rxHAMChannel = HAM_3300_3500MHz;
|
||||
}
|
||||
|
||||
if (m_rfeBoardState.selPortRX == RFE_PORT_1) {
|
||||
settings.m_rxPort = RxPortJ3;
|
||||
} else if (m_rfeBoardState.selPortRX == RFE_PORT_3) {
|
||||
settings.m_rxPort = RxPortJ5;
|
||||
}
|
||||
|
||||
if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND01)
|
||||
{
|
||||
settings.m_txChannels = ChannelsCellular;
|
||||
settings.m_txCellularChannel = CellularBand1;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND02)
|
||||
{
|
||||
settings.m_txChannels = ChannelsCellular;
|
||||
settings.m_txCellularChannel = CellularBand2;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND03)
|
||||
{
|
||||
settings.m_txChannels = ChannelsCellular;
|
||||
settings.m_txCellularChannel = CellularBand3;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND07)
|
||||
{
|
||||
settings.m_txChannels = ChannelsCellular;
|
||||
settings.m_txCellularChannel = CellularBand7;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND38)
|
||||
{
|
||||
settings.m_txChannels = ChannelsCellular;
|
||||
settings.m_txCellularChannel = CellularBand38;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_WB_1000)
|
||||
{
|
||||
settings.m_txChannels = ChannelsWideband;
|
||||
settings.m_txWidebandChannel = WidebandLow;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_WB_4000)
|
||||
{
|
||||
settings.m_txChannels = ChannelsWideband;
|
||||
settings.m_txWidebandChannel = WidebandHigh;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0030)
|
||||
{
|
||||
settings.m_txChannels = ChannelsHAM;
|
||||
settings.m_txHAMChannel = HAM_30M;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0070)
|
||||
{
|
||||
settings.m_txChannels = ChannelsHAM;
|
||||
settings.m_txHAMChannel = HAM_50_70MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0145)
|
||||
{
|
||||
settings.m_txChannels = ChannelsHAM;
|
||||
settings.m_txHAMChannel = HAM_144_146MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0220)
|
||||
{
|
||||
settings.m_txChannels = ChannelsHAM;
|
||||
settings.m_txHAMChannel = HAM_220_225MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0435)
|
||||
{
|
||||
settings.m_txChannels = ChannelsHAM;
|
||||
settings.m_txHAMChannel = HAM_430_440MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0920)
|
||||
{
|
||||
settings.m_txChannels = ChannelsHAM;
|
||||
settings.m_txHAMChannel = HAM_902_928MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_1280)
|
||||
{
|
||||
settings.m_txChannels = ChannelsHAM;
|
||||
settings.m_txHAMChannel = HAM_1240_1325MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_2400)
|
||||
{
|
||||
settings.m_txChannels = ChannelsHAM;
|
||||
settings.m_txHAMChannel = HAM_2300_2450MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_3500)
|
||||
{
|
||||
settings.m_txChannels = ChannelsHAM;
|
||||
settings.m_txHAMChannel = HAM_3300_3500MHz;
|
||||
}
|
||||
|
||||
if (m_rfeBoardState.selPortTX == RFE_PORT_1) {
|
||||
settings.m_txPort = TxPortJ3;
|
||||
} else if (m_rfeBoardState.selPortTX == RFE_PORT_2) {
|
||||
settings.m_txPort = TxPortJ4;
|
||||
} else if (m_rfeBoardState.selPortTX == RFE_PORT_3) {
|
||||
settings.m_txPort = TxPortJ5;
|
||||
}
|
||||
|
||||
settings.m_attenuationFactor = m_rfeBoardState.attValue;
|
||||
settings.m_amfmNotch = m_rfeBoardState.notchOnOff == RFE_NOTCH_ON;
|
||||
|
||||
if (m_rfeBoardState.mode == RFE_MODE_RX)
|
||||
{
|
||||
settings.m_rxOn = true;
|
||||
settings.m_txOn = false;
|
||||
}
|
||||
else if (m_rfeBoardState.mode == RFE_MODE_TX)
|
||||
{
|
||||
settings.m_rxOn = false;
|
||||
settings.m_txOn = true;
|
||||
}
|
||||
else if (m_rfeBoardState.mode == RFE_MODE_NONE)
|
||||
{
|
||||
settings.m_rxOn = false;
|
||||
settings.m_txOn = false;
|
||||
}
|
||||
else if (m_rfeBoardState.mode == RFE_MODE_TXRX)
|
||||
{
|
||||
settings.m_rxOn = true;
|
||||
settings.m_txOn = true;
|
||||
}
|
||||
|
||||
settings.m_swrEnable = m_rfeBoardState.enableSWR == RFE_SWR_ENABLE;
|
||||
settings.m_swrSource = m_rfeBoardState.sourceSWR == RFE_SWR_SRC_CELL ? SWRCellular : SWRExternal;
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_LIMERFE_LIMERFECONTROLLER_H_
|
||||
#define SDRBASE_LIMERFE_LIMERFECONTROLLER_H_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "lime/limeRFE.h"
|
||||
#include "export.h"
|
||||
|
||||
class SDRBASE_API LimeRFEController
|
||||
{
|
||||
public:
|
||||
enum ChannelGroups
|
||||
{
|
||||
ChannelsWideband,
|
||||
ChannelsHAM,
|
||||
ChannelsCellular
|
||||
};
|
||||
|
||||
enum WidebandChannel
|
||||
{
|
||||
WidebandLow, //!< 1 - 1000 MHz
|
||||
WidebandHigh //!< 1000 - 4000 MHz
|
||||
};
|
||||
|
||||
enum HAMChannel
|
||||
{
|
||||
HAM_30M,
|
||||
HAM_50_70MHz,
|
||||
HAM_144_146MHz,
|
||||
HAM_220_225MHz,
|
||||
HAM_430_440MHz,
|
||||
HAM_902_928MHz,
|
||||
HAM_1240_1325MHz,
|
||||
HAM_2300_2450MHz,
|
||||
HAM_3300_3500MHz
|
||||
};
|
||||
|
||||
enum CellularChannel
|
||||
{
|
||||
CellularBand1,
|
||||
CellularBand2,
|
||||
CellularBand3,
|
||||
CellularBand7,
|
||||
CellularBand38
|
||||
};
|
||||
|
||||
enum RxPort
|
||||
{
|
||||
RxPortJ3, //!< Rx/Tx
|
||||
RxPortJ5 //!< Rx/Tx HF
|
||||
};
|
||||
|
||||
enum TxPort
|
||||
{
|
||||
TxPortJ3, //!< Rx/Tx
|
||||
TxPortJ4, //!< Tx
|
||||
TxPortJ5 //!< Rx/Tx HF
|
||||
};
|
||||
|
||||
enum SWRSource
|
||||
{
|
||||
SWRExternal,
|
||||
SWRCellular
|
||||
};
|
||||
|
||||
struct SDRBASE_API LimeRFESettings
|
||||
{
|
||||
LimeRFESettings();
|
||||
// Rx
|
||||
LimeRFEController::ChannelGroups m_rxChannels;
|
||||
LimeRFEController::WidebandChannel m_rxWidebandChannel;
|
||||
LimeRFEController::HAMChannel m_rxHAMChannel;
|
||||
LimeRFEController::CellularChannel m_rxCellularChannel;
|
||||
LimeRFEController::RxPort m_rxPort;
|
||||
unsigned int m_attenuationFactor; //!< Attenuation is 2 times this factor in dB (0..7 => 0..14dB)
|
||||
bool m_amfmNotch;
|
||||
// Tx
|
||||
LimeRFEController::ChannelGroups m_txChannels;
|
||||
LimeRFEController::WidebandChannel m_txWidebandChannel;
|
||||
LimeRFEController::HAMChannel m_txHAMChannel;
|
||||
LimeRFEController::CellularChannel m_txCellularChannel;
|
||||
LimeRFEController::TxPort m_txPort;
|
||||
bool m_swrEnable;
|
||||
LimeRFEController::SWRSource m_swrSource;
|
||||
// Rx/Tx
|
||||
bool m_txRxDriven; //!< Tx settings set according to Rx settings
|
||||
bool m_rxOn;
|
||||
bool m_txOn;
|
||||
};
|
||||
|
||||
LimeRFEController();
|
||||
~LimeRFEController();
|
||||
|
||||
int openDevice(const std::string& serialDeviceName);
|
||||
void closeDevice();
|
||||
int configure();
|
||||
int getState();
|
||||
static std::string getError(int errorCode);
|
||||
int setRx(LimeRFESettings& settings, bool rxOn);
|
||||
int setTx(LimeRFESettings& settings, bool txOn);
|
||||
int getFwdPower(int& powerDB);
|
||||
int getRefPower(int& powerDB);
|
||||
|
||||
void settingsToState(const LimeRFESettings& settings);
|
||||
void stateToSettings(LimeRFESettings& settings);
|
||||
|
||||
private:
|
||||
rfe_dev_t *m_rfeDevice;
|
||||
rfe_boardState m_rfeBoardState;
|
||||
static const std::map<int, std::string> m_errorCodesMap;
|
||||
};
|
||||
|
||||
#endif // SDRBASE_LIMERFE_LIMERFECONTROLLER_H_
|
@ -1,71 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// 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 <QByteArray>
|
||||
#include <QDataStream>
|
||||
#include <QIODevice>
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
#include "limerfeusbcalib.h"
|
||||
|
||||
QByteArray LimeRFEUSBCalib::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
QByteArray data;
|
||||
|
||||
serializeCalibMap(data);
|
||||
s.writeBlob(1, data);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool LimeRFEUSBCalib::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if (!d.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
QByteArray data;
|
||||
|
||||
d.readBlob(1, &data);
|
||||
deserializeCalibMap(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBCalib::serializeCalibMap(QByteArray& data) const
|
||||
{
|
||||
QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
|
||||
*stream << m_calibrations;
|
||||
delete stream;
|
||||
}
|
||||
|
||||
void LimeRFEUSBCalib::deserializeCalibMap(QByteArray& data)
|
||||
{
|
||||
QDataStream readStream(&data, QIODevice::ReadOnly);
|
||||
readStream >> m_calibrations;
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
|
||||
#define SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
|
||||
|
||||
#include <QMap>
|
||||
#include "export.h"
|
||||
|
||||
class QByteArray;
|
||||
|
||||
class SDRBASE_API LimeRFEUSBCalib
|
||||
{
|
||||
public:
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
|
||||
enum ChannelRange
|
||||
{
|
||||
WidebandLow, //!< 1 - 1000 MHz
|
||||
WidebandHigh, //!< 1000 - 4000 MHz
|
||||
HAM_30MHz, //!< Up to 30 MHz
|
||||
HAM_50_70MHz,
|
||||
HAM_144_146MHz,
|
||||
HAM_220_225MHz,
|
||||
HAM_430_440MHz,
|
||||
HAM_902_928MHz,
|
||||
HAM_1240_1325MHz,
|
||||
HAM_2300_2450MHz,
|
||||
HAM_3300_3500MHz,
|
||||
CellularBand1,
|
||||
CellularBand2,
|
||||
CellularBand3,
|
||||
CellularBand7,
|
||||
CellularBand38
|
||||
};
|
||||
|
||||
QMap<int, double> m_calibrations; //!< Channel range to calibration value in floating point decibels
|
||||
|
||||
private:
|
||||
void serializeCalibMap(QByteArray& data) const;
|
||||
void deserializeCalibMap(QByteArray& data);
|
||||
};
|
||||
|
||||
#endif // SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
|
@ -135,7 +135,6 @@ void MainSettings::load()
|
||||
}
|
||||
|
||||
m_hardwareDeviceUserArgs.deserialize(qUncompress(QByteArray::fromBase64(s.value("hwDeviceUserArgs").toByteArray())));
|
||||
m_limeRFEUSBCalib.deserialize(qUncompress(QByteArray::fromBase64(s.value("limeRFEUSBCalib").toByteArray())));
|
||||
}
|
||||
|
||||
void MainSettings::save() const
|
||||
@ -196,7 +195,6 @@ void MainSettings::save() const
|
||||
}
|
||||
|
||||
s.setValue("hwDeviceUserArgs", qCompress(m_hardwareDeviceUserArgs.serialize()).toBase64());
|
||||
s.setValue("limeRFEUSBCalib", qCompress(m_limeRFEUSBCalib.serialize()).toBase64());
|
||||
}
|
||||
|
||||
void MainSettings::initialize()
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include "device/deviceuserargs.h"
|
||||
#include "limerfe/limerfeusbcalib.h"
|
||||
#include "preferences.h"
|
||||
#include "preset.h"
|
||||
#include "featuresetpreset.h"
|
||||
@ -182,7 +181,6 @@ public:
|
||||
}
|
||||
|
||||
DeviceUserArgs& getDeviceUserArgs() { return m_hardwareDeviceUserArgs; }
|
||||
LimeRFEUSBCalib& getLimeRFEUSBCalib() { return m_limeRFEUSBCalib; }
|
||||
const AudioDeviceManager *getAudioDeviceManager() const { return m_audioDeviceManager; }
|
||||
void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager) { m_audioDeviceManager = audioDeviceManager; }
|
||||
void setAMBEEngine(AMBEEngine *ambeEngine) { m_ambeEngine = ambeEngine; }
|
||||
@ -205,7 +203,6 @@ protected:
|
||||
typedef QList<Configuration*> Configurations;
|
||||
Configurations m_configurations;
|
||||
DeviceUserArgs m_hardwareDeviceUserArgs;
|
||||
LimeRFEUSBCalib m_limeRFEUSBCalib;
|
||||
AMBEEngine *m_ambeEngine;
|
||||
};
|
||||
|
||||
|
@ -246,23 +246,6 @@ set(sdrgui_FORMS
|
||||
soapygui/arginfogui.ui
|
||||
)
|
||||
|
||||
if (LIMESUITE_FOUND)
|
||||
set(sdrgui_SOURCES
|
||||
${sdrgui_SOURCES}
|
||||
limerfegui/limerfeusbdialog.cpp
|
||||
)
|
||||
set(sdrgui_HEADERS
|
||||
${sdrgui_HEADERS}
|
||||
limerfegui/limerfeusbdialog.h
|
||||
)
|
||||
set(sdrgui_FORMS
|
||||
${sdrgui_FORMS}
|
||||
limerfegui/limerfeusbdialog.ui
|
||||
)
|
||||
include_directories(${LIMESUITE_INCLUDE_DIR})
|
||||
set(sdrgui_LIMERFE_LIB ${LIMESUITE_LIBRARY})
|
||||
endif (LIMESUITE_FOUND)
|
||||
|
||||
qt5_wrap_ui(sdrgui_FORMS_HEADERS ${sdrgui_FORMS})
|
||||
|
||||
include_directories(
|
||||
|
@ -1,881 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// 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 <vector>
|
||||
#include "util/serialutil.h"
|
||||
#include "util/db.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspdevicesourceengine.h"
|
||||
#include "dsp/dspdevicesinkengine.h"
|
||||
#include "mainwindow.h"
|
||||
#include "device/deviceuiset.h"
|
||||
#include "gui/doublevalidator.h"
|
||||
|
||||
#include "limerfeusbdialog.h"
|
||||
#include "ui_limerfeusbdialog.h"
|
||||
|
||||
LimeRFEUSBDialog::LimeRFEUSBDialog(LimeRFEUSBCalib& limeRFEUSBCalib, MainWindow* mainWindow) :
|
||||
QDialog(mainWindow),
|
||||
ui(new Ui::LimeRFEUSBDialog),
|
||||
m_limeRFEUSBCalib(limeRFEUSBCalib),
|
||||
m_rxTxToggle(false),
|
||||
m_currentPowerCorrection(0.0),
|
||||
m_avgPower(false),
|
||||
m_deviceSetSync(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_mainWindow = mainWindow;
|
||||
ui->powerCorrValue->setValidator(new DoubleValidator(-99.9, 99.9, 1, ui->powerCorrValue));
|
||||
std::vector<std::string> comPorts;
|
||||
SerialUtil::getComPorts(comPorts, "ttyUSB[0-9]+"); // regex is for Linux only
|
||||
|
||||
for (std::vector<std::string>::const_iterator it = comPorts.begin(); it != comPorts.end(); ++it) {
|
||||
ui->device->addItem(QString(it->c_str()));
|
||||
}
|
||||
|
||||
updateDeviceSetList();
|
||||
displaySettings(); // default values
|
||||
highlightApplyButton(false);
|
||||
m_timer.setInterval(500);
|
||||
}
|
||||
|
||||
LimeRFEUSBDialog::~LimeRFEUSBDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::displaySettings()
|
||||
{
|
||||
setRxChannels();
|
||||
ui->rxPort->setCurrentIndex(m_settings.m_rxPort);
|
||||
ui->attenuation->setCurrentIndex(m_settings.m_attenuationFactor);
|
||||
ui->amFmNotchFilter->setChecked(m_settings.m_amfmNotch);
|
||||
setTxChannels();
|
||||
ui->txPort->setCurrentIndex(m_settings.m_txPort);
|
||||
ui->txFollowsRx->setChecked(m_settings.m_txRxDriven);
|
||||
ui->rxTxToggle->setChecked(m_rxTxToggle);
|
||||
displayMode();
|
||||
displayPower();
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::displayMode()
|
||||
{
|
||||
QString s;
|
||||
|
||||
if (m_settings.m_rxOn)
|
||||
{
|
||||
if (m_settings.m_txOn) {
|
||||
s = "Rx/Tx";
|
||||
} else {
|
||||
s = "Rx";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_settings.m_txOn) {
|
||||
s = "Tx";
|
||||
} else {
|
||||
s = "None";
|
||||
}
|
||||
}
|
||||
|
||||
ui->modeText->setText(s);
|
||||
|
||||
ui->modeRx->blockSignals(true);
|
||||
ui->modeTx->blockSignals(true);
|
||||
|
||||
if (m_settings.m_rxOn) {
|
||||
ui->modeRx->setStyleSheet("QToolButton { background-color : green; }");
|
||||
} else {
|
||||
ui->modeRx->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
if (m_settings.m_txOn) {
|
||||
ui->modeTx->setStyleSheet("QToolButton { background-color : red; }");
|
||||
} else {
|
||||
ui->modeTx->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
ui->modeRx->setChecked(m_settings.m_rxOn);
|
||||
ui->modeTx->setChecked(m_settings.m_txOn);
|
||||
|
||||
ui->modeRx->blockSignals(false);
|
||||
ui->modeTx->blockSignals(false);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::displayPower()
|
||||
{
|
||||
ui->powerEnable->blockSignals(true);
|
||||
ui->powerSource->blockSignals(true);
|
||||
|
||||
ui->powerEnable->setChecked(m_settings.m_swrEnable);
|
||||
ui->powerSource->setCurrentIndex((int) m_settings.m_swrSource);
|
||||
|
||||
ui->powerEnable->blockSignals(false);
|
||||
ui->powerSource->blockSignals(false);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::refreshPower()
|
||||
{
|
||||
int fwdPower, refPower;
|
||||
int rc = m_controller.getFwdPower(fwdPower);
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
ui->statusText->setText(m_controller.getError(rc).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
rc = m_controller.getRefPower(refPower);
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
ui->statusText->setText(m_controller.getError(rc).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
double fwdPowerDB = fwdPower / 10.0;
|
||||
double refPowerDB = refPower / 10.0;
|
||||
double retLossDB = fwdPowerDB - refPowerDB;
|
||||
|
||||
ui->powerFwdText->setText(QString::number(fwdPowerDB, 'f', 1));
|
||||
ui->powerRefText->setText(QString::number(refPowerDB, 'f', 1));
|
||||
ui->returnLossText->setText(QString::number(retLossDB, 'f', 1));
|
||||
|
||||
double denom = CalcDb::powerFromdB(retLossDB/2.0) - 1.0;
|
||||
|
||||
if (denom == 0.0)
|
||||
{
|
||||
ui->swrText->setText("---");
|
||||
}
|
||||
else
|
||||
{
|
||||
double vswr = (CalcDb::powerFromdB(retLossDB/2.0) + 1.0) / denom;
|
||||
vswr = vswr < 0.0 ? 0.0 : vswr > 99.999 ? 99.999 : vswr;
|
||||
ui->swrText->setText(QString::number(vswr, 'f', 3));
|
||||
}
|
||||
|
||||
updateAbsPower(m_currentPowerCorrection);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::setRxChannels()
|
||||
{
|
||||
ui->rxChannel->blockSignals(true);
|
||||
ui->rxPort->blockSignals(true);
|
||||
ui->rxChannel->clear();
|
||||
ui->rxPort->clear();
|
||||
|
||||
if (m_settings.m_rxChannels == LimeRFEController::ChannelsWideband)
|
||||
{
|
||||
ui->rxChannel->addItem("1-1000MHz");
|
||||
ui->rxChannel->addItem("1-4GHz");
|
||||
ui->rxChannel->setCurrentIndex((int) m_settings.m_rxWidebandChannel);
|
||||
ui->rxPort->addItem("TX/RX (J3)");
|
||||
ui->rxPort->addItem("TX/RX 30M (J5)");
|
||||
ui->rxPort->setCurrentIndex((int) m_settings.m_rxPort);
|
||||
ui->txFollowsRx->setEnabled(true);
|
||||
ui->rxPort->setEnabled(true);
|
||||
}
|
||||
else if (m_settings.m_rxChannels == LimeRFEController::ChannelsHAM)
|
||||
{
|
||||
ui->rxChannel->addItem("<30MHz");
|
||||
ui->rxChannel->addItem("50-70MHz");
|
||||
ui->rxChannel->addItem("144-146MHz");
|
||||
ui->rxChannel->addItem("220-225MHz");
|
||||
ui->rxChannel->addItem("430-440MHz");
|
||||
ui->rxChannel->addItem("902-928MHz");
|
||||
ui->rxChannel->addItem("1240-1325MHz");
|
||||
ui->rxChannel->addItem("2300-2450MHz");
|
||||
ui->rxChannel->addItem("3300-3500MHz");
|
||||
ui->rxChannel->setCurrentIndex((int) m_settings.m_rxHAMChannel);
|
||||
ui->txFollowsRx->setEnabled(true);
|
||||
|
||||
switch(m_settings.m_rxHAMChannel)
|
||||
{
|
||||
case LimeRFEController::HAM_30M:
|
||||
case LimeRFEController::HAM_50_70MHz:
|
||||
case LimeRFEController::HAM_144_146MHz:
|
||||
case LimeRFEController::HAM_220_225MHz:
|
||||
case LimeRFEController::HAM_430_440MHz:
|
||||
ui->rxPort->addItem("TX/RX (J3)");
|
||||
ui->rxPort->addItem("TX/RX 30M (J5)");
|
||||
ui->rxPort->setEnabled(true);
|
||||
ui->rxPort->setCurrentIndex((int) m_settings.m_rxPort);
|
||||
break;
|
||||
case LimeRFEController::HAM_902_928MHz:
|
||||
case LimeRFEController::HAM_1240_1325MHz:
|
||||
case LimeRFEController::HAM_2300_2450MHz:
|
||||
case LimeRFEController::HAM_3300_3500MHz:
|
||||
ui->rxPort->addItem("TX/RX (J3)");
|
||||
ui->rxPort->setEnabled(false);
|
||||
m_settings.m_rxPort = LimeRFEController::RxPortJ3;
|
||||
ui->rxPort->setCurrentIndex((int) m_settings.m_rxPort);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_rxChannels == LimeRFEController::ChannelsCellular)
|
||||
{
|
||||
ui->rxChannel->addItem("Band1");
|
||||
ui->rxChannel->addItem("Band2");
|
||||
ui->rxChannel->addItem("Band3");
|
||||
ui->rxChannel->addItem("Band7");
|
||||
ui->rxChannel->addItem("Band38");
|
||||
ui->rxChannel->setCurrentIndex((int) m_settings.m_rxCellularChannel);
|
||||
ui->rxPort->addItem("TX/RX (J3)");
|
||||
ui->rxPort->setEnabled(false);
|
||||
m_settings.m_rxPort = LimeRFEController::RxPortJ3;
|
||||
ui->rxPort->setCurrentIndex((int) m_settings.m_rxPort);
|
||||
m_settings.m_txRxDriven = true;
|
||||
ui->txFollowsRx->setEnabled(false);
|
||||
ui->txFollowsRx->setChecked(m_settings.m_txRxDriven);
|
||||
}
|
||||
|
||||
ui->rxChannelGroup->setCurrentIndex((int) m_settings.m_rxChannels);
|
||||
ui->rxPort->blockSignals(false);
|
||||
ui->rxChannel->blockSignals(false);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::setTxChannels()
|
||||
{
|
||||
ui->txChannel->blockSignals(true);
|
||||
ui->txPort->blockSignals(true);
|
||||
ui->powerCorrValue->blockSignals(true);
|
||||
|
||||
ui->txChannel->clear();
|
||||
ui->txPort->clear();
|
||||
|
||||
if (m_settings.m_txChannels == LimeRFEController::ChannelsWideband)
|
||||
{
|
||||
ui->txChannel->addItem("1-1000MHz");
|
||||
ui->txChannel->addItem("1-4GHz");
|
||||
ui->txChannel->setCurrentIndex((int) m_settings.m_txWidebandChannel);
|
||||
ui->txPort->addItem("TX/RX (J3)");
|
||||
ui->txPort->addItem("TX (J4)");
|
||||
ui->txPort->setCurrentIndex((int) m_settings.m_txPort);
|
||||
ui->txPort->setEnabled(true);
|
||||
}
|
||||
else if (m_settings.m_txChannels == LimeRFEController::ChannelsHAM)
|
||||
{
|
||||
ui->txChannel->addItem("<30MHz");
|
||||
ui->txChannel->addItem("50-70MHz");
|
||||
ui->txChannel->addItem("144-146MHz");
|
||||
ui->txChannel->addItem("220-225MHz");
|
||||
ui->txChannel->addItem("430-440MHz");
|
||||
ui->txChannel->addItem("902-928MHz");
|
||||
ui->txChannel->addItem("1240-1325MHz");
|
||||
ui->txChannel->addItem("2300-2450MHz");
|
||||
ui->txChannel->addItem("3300-3500MHz");
|
||||
ui->txChannel->setCurrentIndex((int) m_settings.m_txHAMChannel);
|
||||
|
||||
switch(m_settings.m_txHAMChannel)
|
||||
{
|
||||
case LimeRFEController::HAM_30M:
|
||||
case LimeRFEController::HAM_50_70MHz:
|
||||
ui->txPort->addItem("TX/RX (J3)");
|
||||
ui->txPort->addItem("TX (J4)");
|
||||
ui->txPort->addItem("TX/RX 30M (J5)");
|
||||
ui->txPort->setEnabled(false);
|
||||
m_settings.m_txPort = LimeRFEController::TxPortJ5;
|
||||
ui->txPort->setCurrentIndex((int) m_settings.m_txPort);
|
||||
break;
|
||||
case LimeRFEController::HAM_144_146MHz:
|
||||
case LimeRFEController::HAM_220_225MHz:
|
||||
case LimeRFEController::HAM_430_440MHz:
|
||||
case LimeRFEController::HAM_902_928MHz:
|
||||
case LimeRFEController::HAM_1240_1325MHz:
|
||||
case LimeRFEController::HAM_2300_2450MHz:
|
||||
case LimeRFEController::HAM_3300_3500MHz:
|
||||
ui->txPort->addItem("TX/RX (J3)");
|
||||
ui->txPort->addItem("TX (J4)");
|
||||
ui->txPort->setCurrentIndex(m_settings.m_txPort < 2 ? m_settings.m_txPort : 1);
|
||||
ui->txPort->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_txChannels == LimeRFEController::ChannelsCellular)
|
||||
{
|
||||
ui->txChannel->addItem("Band1");
|
||||
ui->txChannel->addItem("Band2");
|
||||
ui->txChannel->addItem("Band3");
|
||||
ui->txChannel->addItem("Band7");
|
||||
ui->txChannel->addItem("Band38");
|
||||
ui->txChannel->setCurrentIndex((int) m_settings.m_txCellularChannel);
|
||||
ui->txPort->addItem("TX/RX (J3)");
|
||||
m_settings.m_txPort = LimeRFEController::TxPortJ3;
|
||||
ui->txPort->setEnabled(false);
|
||||
ui->txPort->setCurrentIndex((int) m_settings.m_txPort);
|
||||
}
|
||||
|
||||
ui->txChannelGroup->setCurrentIndex((int) m_settings.m_txChannels);
|
||||
m_currentPowerCorrection = getPowerCorrection();
|
||||
ui->powerCorrValue->setText(QString::number(m_currentPowerCorrection, 'f', 1));
|
||||
updateAbsPower(m_currentPowerCorrection);
|
||||
|
||||
ui->powerCorrValue->blockSignals(false);
|
||||
ui->txPort->blockSignals(false);
|
||||
ui->txChannel->blockSignals(false);
|
||||
}
|
||||
|
||||
int LimeRFEUSBDialog::getPowerCorectionIndex()
|
||||
{
|
||||
LimeRFEUSBCalib::ChannelRange range;
|
||||
|
||||
switch (m_settings.m_txChannels)
|
||||
{
|
||||
case LimeRFEController::ChannelsWideband:
|
||||
{
|
||||
switch (m_settings.m_txWidebandChannel)
|
||||
{
|
||||
case LimeRFEController::WidebandLow:
|
||||
range = LimeRFEUSBCalib::WidebandLow;
|
||||
break;
|
||||
case LimeRFEController::WidebandHigh:
|
||||
range = LimeRFEUSBCalib::WidebandHigh;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LimeRFEController::ChannelsHAM:
|
||||
{
|
||||
switch (m_settings.m_txHAMChannel)
|
||||
{
|
||||
case LimeRFEController::HAM_30M:
|
||||
range = LimeRFEUSBCalib::HAM_30MHz;
|
||||
break;
|
||||
case LimeRFEController::HAM_50_70MHz:
|
||||
range = LimeRFEUSBCalib::HAM_50_70MHz;
|
||||
break;
|
||||
case LimeRFEController::HAM_144_146MHz:
|
||||
range = LimeRFEUSBCalib::HAM_144_146MHz;
|
||||
break;
|
||||
case LimeRFEController::HAM_220_225MHz:
|
||||
range = LimeRFEUSBCalib::HAM_220_225MHz;
|
||||
break;
|
||||
case LimeRFEController::HAM_430_440MHz:
|
||||
range = LimeRFEUSBCalib::HAM_430_440MHz;
|
||||
break;
|
||||
case LimeRFEController::HAM_902_928MHz:
|
||||
range = LimeRFEUSBCalib::HAM_902_928MHz;
|
||||
break;
|
||||
case LimeRFEController::HAM_1240_1325MHz:
|
||||
range = LimeRFEUSBCalib::HAM_1240_1325MHz;
|
||||
break;
|
||||
case LimeRFEController::HAM_2300_2450MHz:
|
||||
range = LimeRFEUSBCalib::HAM_2300_2450MHz;
|
||||
break;
|
||||
case LimeRFEController::HAM_3300_3500MHz:
|
||||
range = LimeRFEUSBCalib::HAM_3300_3500MHz;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LimeRFEController::ChannelsCellular:
|
||||
{
|
||||
switch (m_settings.m_txCellularChannel)
|
||||
{
|
||||
case LimeRFEController::CellularBand1:
|
||||
range = LimeRFEUSBCalib::CellularBand1;
|
||||
break;
|
||||
case LimeRFEController::CellularBand2:
|
||||
range = LimeRFEUSBCalib::CellularBand2;
|
||||
break;
|
||||
case LimeRFEController::CellularBand3:
|
||||
range = LimeRFEUSBCalib::CellularBand3;
|
||||
break;
|
||||
case LimeRFEController::CellularBand7:
|
||||
range = LimeRFEUSBCalib::CellularBand7;
|
||||
break;
|
||||
case LimeRFEController::CellularBand38:
|
||||
range = LimeRFEUSBCalib::CellularBand38;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return (int) range;
|
||||
}
|
||||
|
||||
double LimeRFEUSBDialog::getPowerCorrection()
|
||||
{
|
||||
int index = getPowerCorectionIndex();
|
||||
|
||||
QMap<int, double>::const_iterator it = m_limeRFEUSBCalib.m_calibrations.find(index);
|
||||
|
||||
if (it != m_limeRFEUSBCalib.m_calibrations.end()) {
|
||||
return it.value();
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::setPowerCorrection(double dbValue)
|
||||
{
|
||||
int index = getPowerCorectionIndex();
|
||||
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_limeRFEUSBCalib.m_calibrations[index] = dbValue;
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_openDevice_clicked()
|
||||
{
|
||||
int rc = m_controller.openDevice(ui->device->currentText().toStdString());
|
||||
ui->statusText->append(QString("Open %1: %2").arg(ui->device->currentText()).arg(m_controller.getError(rc).c_str()));
|
||||
|
||||
if (rc != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
rc = m_controller.getState();
|
||||
ui->statusText->append(QString("Get state: %1").arg(m_controller.getError(rc).c_str()));
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_closeDevice_clicked()
|
||||
{
|
||||
ui->statusText->clear();
|
||||
m_controller.closeDevice();
|
||||
ui->statusText->setText("Closed");
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_deviceToGUI_clicked()
|
||||
{
|
||||
int rc = m_controller.getState();
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
ui->statusText->setText(m_controller.getError(rc).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
m_controller.stateToSettings(m_settings);
|
||||
displaySettings();
|
||||
highlightApplyButton(false);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_rxChannelGroup_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_rxChannels = (LimeRFEController::ChannelGroups) index;
|
||||
setRxChannels();
|
||||
|
||||
if (m_settings.m_txRxDriven)
|
||||
{
|
||||
m_settings.m_txChannels = m_settings.m_rxChannels;
|
||||
ui->txChannelGroup->setCurrentIndex((int) m_settings.m_txChannels);
|
||||
}
|
||||
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_rxChannel_currentIndexChanged(int index)
|
||||
{
|
||||
if (m_settings.m_rxChannels == LimeRFEController::ChannelsWideband) {
|
||||
m_settings.m_rxWidebandChannel = (LimeRFEController::WidebandChannel) index;
|
||||
} else if (m_settings.m_rxChannels == LimeRFEController::ChannelsHAM) {
|
||||
m_settings.m_rxHAMChannel = (LimeRFEController::HAMChannel) index;
|
||||
} else if (m_settings.m_rxChannels == LimeRFEController::ChannelsCellular) {
|
||||
m_settings.m_rxCellularChannel = (LimeRFEController::CellularChannel) index;
|
||||
}
|
||||
|
||||
setRxChannels();
|
||||
|
||||
if (m_settings.m_txRxDriven)
|
||||
{
|
||||
m_settings.m_txWidebandChannel = m_settings.m_rxWidebandChannel;
|
||||
m_settings.m_txHAMChannel = m_settings.m_rxHAMChannel;
|
||||
m_settings.m_txCellularChannel = m_settings.m_rxCellularChannel;
|
||||
setTxChannels();
|
||||
}
|
||||
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_rxPort_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_rxPort = (LimeRFEController::RxPort) index;
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_txFollowsRx_clicked()
|
||||
{
|
||||
bool checked = ui->txFollowsRx->isChecked();
|
||||
m_settings.m_txRxDriven = checked;
|
||||
ui->txChannelGroup->setEnabled(!checked);
|
||||
ui->txChannel->setEnabled(!checked);
|
||||
m_settings.m_txChannels = m_settings.m_rxChannels;
|
||||
m_settings.m_txWidebandChannel = m_settings.m_rxWidebandChannel;
|
||||
m_settings.m_txHAMChannel = m_settings.m_rxHAMChannel;
|
||||
m_settings.m_txCellularChannel = m_settings.m_rxCellularChannel;
|
||||
ui->txChannelGroup->setCurrentIndex((int) m_settings.m_txChannels);
|
||||
|
||||
if (checked) {
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_txChannelGroup_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_txChannels = (LimeRFEController::ChannelGroups) index;
|
||||
setTxChannels();
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_txChannel_currentIndexChanged(int index)
|
||||
{
|
||||
if (m_settings.m_txChannels == LimeRFEController::ChannelsWideband) {
|
||||
m_settings.m_txWidebandChannel = (LimeRFEController::WidebandChannel) index;
|
||||
} else if (m_settings.m_txChannels == LimeRFEController::ChannelsHAM) {
|
||||
m_settings.m_txHAMChannel = (LimeRFEController::HAMChannel) index;
|
||||
} else if (m_settings.m_txChannels == LimeRFEController::ChannelsCellular) {
|
||||
m_settings.m_txCellularChannel = (LimeRFEController::CellularChannel) index;
|
||||
}
|
||||
|
||||
setTxChannels();
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_txPort_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_txPort = (LimeRFEController::TxPort) index;
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_powerEnable_clicked()
|
||||
{
|
||||
m_settings.m_swrEnable = ui->powerEnable->isChecked();
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_powerSource_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_swrSource = (LimeRFEController::SWRSource) index;
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_powerRefresh_clicked()
|
||||
{
|
||||
refreshPower();
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_powerAutoRefresh_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
|
||||
m_timer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer.stop();
|
||||
disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_powerAbsAvg_clicked()
|
||||
{
|
||||
m_avgPower = ui->powerAbsAvg->isChecked();
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_powerCorrValue_textEdited(const QString &text)
|
||||
{
|
||||
bool ok;
|
||||
double powerCorrection = text.toDouble(&ok);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
setPowerCorrection(powerCorrection);
|
||||
m_currentPowerCorrection = powerCorrection;
|
||||
updateAbsPower(powerCorrection);
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_deviceSetRefresh_clicked()
|
||||
{
|
||||
updateDeviceSetList();
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_deviceSetSync_clicked()
|
||||
{
|
||||
m_deviceSetSync = ui->deviceSetSync->isChecked();
|
||||
|
||||
if (m_deviceSetSync) {
|
||||
syncRxTx();
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::syncRxTx()
|
||||
{
|
||||
if (!m_settings.m_txOn) {
|
||||
stopStartTx(m_settings.m_txOn);
|
||||
}
|
||||
|
||||
stopStartRx(m_settings.m_rxOn);
|
||||
|
||||
if (m_settings.m_txOn) {
|
||||
stopStartTx(m_settings.m_txOn);
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::stopStartRx(bool start)
|
||||
{
|
||||
unsigned int rxDeviceSetSequence = ui->deviceSetRx->currentIndex();
|
||||
|
||||
if (rxDeviceSetSequence >= m_sourceEngines.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DSPDeviceSourceEngine *deviceSourceEngine = m_sourceEngines[rxDeviceSetSequence];
|
||||
|
||||
if (start)
|
||||
{
|
||||
if (deviceSourceEngine->initAcquisition()) {
|
||||
deviceSourceEngine->startAcquisition();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceSourceEngine->stopAcquistion();
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::stopStartTx(bool start)
|
||||
{
|
||||
unsigned int txDeviceSetSequence = ui->deviceSetTx->currentIndex();
|
||||
|
||||
if (txDeviceSetSequence >= m_sinkEngines.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DSPDeviceSinkEngine *deviceSinkEngine = m_sinkEngines[txDeviceSetSequence];
|
||||
|
||||
if (start)
|
||||
{
|
||||
if (deviceSinkEngine->initGeneration()) {
|
||||
deviceSinkEngine->startGeneration();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceSinkEngine->stopGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::updateAbsPower(double powerCorrDB)
|
||||
{
|
||||
bool ok;
|
||||
double power = ui->powerFwdText->text().toDouble(&ok);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
double powerCorrected = power + powerCorrDB;
|
||||
double powerDisplayed = powerCorrected;
|
||||
|
||||
if (m_avgPower)
|
||||
{
|
||||
m_powerMovingAverage(powerCorrected);
|
||||
powerDisplayed = m_powerMovingAverage.asDouble();
|
||||
}
|
||||
|
||||
ui->powerAbsDbText->setText(tr("%1 dBm").arg(QString::number(powerDisplayed, 'f', 1)));
|
||||
double powerWatts = CalcDb::powerFromdB(powerDisplayed - 30.0);
|
||||
powerWatts = powerWatts > 8.0 ? 8.0 : powerWatts;
|
||||
ui->powerAbsWText->setText(tr("%1 W").arg(QString::number(powerWatts, 'f', 3)));
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::updateDeviceSetList()
|
||||
{
|
||||
std::vector<DeviceUISet*>& deviceUISets = m_mainWindow->getDeviceUISets();
|
||||
std::vector<DeviceUISet*>::const_iterator it = deviceUISets.begin();
|
||||
m_sourceEngines.clear();
|
||||
m_rxDeviceSetIndex.clear();
|
||||
m_sinkEngines.clear();
|
||||
m_txDeviceSetIndex.clear();
|
||||
ui->deviceSetRx->clear();
|
||||
ui->deviceSetTx->clear();
|
||||
unsigned int deviceIndex = 0;
|
||||
unsigned int rxIndex = 0;
|
||||
unsigned int txIndex = 0;
|
||||
|
||||
for (; it != deviceUISets.end(); ++it, deviceIndex++)
|
||||
{
|
||||
DSPDeviceSourceEngine *deviceSourceEngine = (*it)->m_deviceSourceEngine;
|
||||
DSPDeviceSinkEngine *deviceSinkEngine = (*it)->m_deviceSinkEngine;
|
||||
|
||||
if (deviceSourceEngine)
|
||||
{
|
||||
m_sourceEngines.push_back(deviceSourceEngine);
|
||||
m_rxDeviceSetIndex.push_back(deviceIndex);
|
||||
ui->deviceSetRx->addItem(QString("%1").arg(deviceIndex));
|
||||
rxIndex++;
|
||||
}
|
||||
else if (deviceSinkEngine)
|
||||
{
|
||||
m_sinkEngines.push_back(deviceSinkEngine);
|
||||
m_txDeviceSetIndex.push_back(deviceIndex);
|
||||
ui->deviceSetTx->addItem(QString("%1").arg(deviceIndex));
|
||||
txIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::highlightApplyButton(bool highlight)
|
||||
{
|
||||
if (highlight) {
|
||||
ui->apply->setStyleSheet("QPushButton { background-color : green; }");
|
||||
} else {
|
||||
ui->apply->setStyleSheet("QPushButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_modeRx_toggled(bool checked)
|
||||
{
|
||||
int rc;
|
||||
ui->statusText->clear();
|
||||
m_settings.m_rxOn = checked;
|
||||
|
||||
if (m_rxTxToggle)
|
||||
{
|
||||
m_settings.m_txOn = !checked;
|
||||
|
||||
if (checked) // Rx on
|
||||
{
|
||||
rc = m_controller.setTx(m_settings, false); // stop Tx first
|
||||
ui->statusText->append(QString("Stop TX: %1").arg(m_controller.getError(rc).c_str()));
|
||||
}
|
||||
|
||||
rc = m_controller.setRx(m_settings, m_settings.m_rxOn); // Rx on or off
|
||||
ui->statusText->append(QString("RX: %1").arg(m_controller.getError(rc).c_str()));
|
||||
|
||||
if (!checked) // Rx off
|
||||
{
|
||||
rc = m_controller.setTx(m_settings, true); // start Tx next
|
||||
ui->statusText->append(QString("Start TX: %1").arg(m_controller.getError(rc).c_str()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = m_controller.setRx(m_settings, m_settings.m_rxOn);
|
||||
ui->statusText->setText(m_controller.getError(rc).c_str());
|
||||
}
|
||||
|
||||
if (m_deviceSetSync) {
|
||||
syncRxTx();
|
||||
}
|
||||
|
||||
displayMode();
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_modeTx_toggled(bool checked)
|
||||
{
|
||||
int rc;
|
||||
ui->statusText->clear();
|
||||
m_settings.m_txOn = checked;
|
||||
|
||||
if (m_rxTxToggle)
|
||||
{
|
||||
m_settings.m_rxOn = !checked;
|
||||
|
||||
if (checked) // Tx on
|
||||
{
|
||||
rc = m_controller.setRx(m_settings, false); // stop Rx first
|
||||
ui->statusText->append(QString("Stop RX: %1").arg(m_controller.getError(rc).c_str()));
|
||||
}
|
||||
|
||||
rc = m_controller.setTx(m_settings, m_settings.m_txOn); // Tx on or off
|
||||
ui->statusText->append(QString("TX: %1").arg(m_controller.getError(rc).c_str()));
|
||||
|
||||
if (!checked) // Tx off
|
||||
{
|
||||
rc = m_controller.setRx(m_settings, true); // start Rx next
|
||||
ui->statusText->append(QString("Start RX: %1").arg(m_controller.getError(rc).c_str()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = m_controller.setTx(m_settings, m_settings.m_txOn);
|
||||
ui->statusText->setText(m_controller.getError(rc).c_str());
|
||||
}
|
||||
|
||||
if (m_deviceSetSync) {
|
||||
syncRxTx();
|
||||
}
|
||||
|
||||
displayMode();
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_rxTxToggle_clicked()
|
||||
{
|
||||
m_rxTxToggle = ui->rxTxToggle->isChecked();
|
||||
|
||||
if (m_rxTxToggle && m_settings.m_rxOn && m_settings.m_txOn)
|
||||
{
|
||||
m_settings.m_txOn = false;
|
||||
int rc = m_controller.setTx(m_settings, m_settings.m_txOn);
|
||||
ui->statusText->setText(m_controller.getError(rc).c_str());
|
||||
displayMode();
|
||||
|
||||
if (m_deviceSetSync) {
|
||||
syncRxTx();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_attenuation_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_attenuationFactor = index;
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_amFmNotchFilter_clicked()
|
||||
{
|
||||
m_settings.m_amfmNotch = ui->amFmNotchFilter->isChecked();
|
||||
highlightApplyButton(true);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::on_apply_clicked()
|
||||
{
|
||||
ui->statusText->clear();
|
||||
m_controller.settingsToState(m_settings);
|
||||
int rc = m_controller.configure();
|
||||
ui->statusText->setText(m_controller.getError(rc).c_str());
|
||||
highlightApplyButton(false);
|
||||
}
|
||||
|
||||
void LimeRFEUSBDialog::tick()
|
||||
{
|
||||
refreshPower();
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRGUI_LIMERFEGUI_LIMERFEUSBDIALOG_H_
|
||||
#define SDRGUI_LIMERFEGUI_LIMERFEUSBDIALOG_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTimer>
|
||||
|
||||
#include "util/movingaverage.h"
|
||||
#include "limerfe/limerfecontroller.h"
|
||||
#include "limerfe/limerfeusbcalib.h"
|
||||
#include "export.h"
|
||||
|
||||
class DSPDeviceSourceEngine;
|
||||
class DSPDeviceSinkEngine;
|
||||
class MainWindow;
|
||||
|
||||
namespace Ui {
|
||||
class LimeRFEUSBDialog;
|
||||
}
|
||||
|
||||
class SDRGUI_API LimeRFEUSBDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LimeRFEUSBDialog(LimeRFEUSBCalib& limeRFEUSBCalib, MainWindow* mainWindow);
|
||||
~LimeRFEUSBDialog();
|
||||
|
||||
private:
|
||||
void displaySettings();
|
||||
void displayMode();
|
||||
void displayPower();
|
||||
void refreshPower();
|
||||
void setRxChannels();
|
||||
void setTxChannels();
|
||||
int getPowerCorectionIndex();
|
||||
double getPowerCorrection();
|
||||
void setPowerCorrection(double dbValue);
|
||||
void updateAbsPower(double powerCorrDB);
|
||||
void updateDeviceSetList();
|
||||
void stopStartRx(bool start);
|
||||
void stopStartTx(bool start);
|
||||
void syncRxTx();
|
||||
void highlightApplyButton(bool highlight);
|
||||
|
||||
Ui::LimeRFEUSBDialog* ui;
|
||||
MainWindow *m_mainWindow;
|
||||
LimeRFEController m_controller;
|
||||
LimeRFEController::LimeRFESettings m_settings;
|
||||
LimeRFEUSBCalib& m_limeRFEUSBCalib;
|
||||
bool m_rxTxToggle;
|
||||
QTimer m_timer;
|
||||
double m_currentPowerCorrection;
|
||||
bool m_avgPower;
|
||||
MovingAverageUtil<double, double, 10> m_powerMovingAverage;
|
||||
bool m_deviceSetSync;
|
||||
int m_rxDeviceSetSequence;
|
||||
int m_txDeviceSetSequence;
|
||||
std::vector<DSPDeviceSourceEngine*> m_sourceEngines;
|
||||
std::vector<int> m_rxDeviceSetIndex;
|
||||
std::vector<DSPDeviceSinkEngine*> m_sinkEngines;
|
||||
std::vector<int> m_txDeviceSetIndex;
|
||||
|
||||
private slots:
|
||||
void on_openDevice_clicked();
|
||||
void on_closeDevice_clicked();
|
||||
void on_deviceToGUI_clicked();
|
||||
void on_rxChannelGroup_currentIndexChanged(int index);
|
||||
void on_rxChannel_currentIndexChanged(int index);
|
||||
void on_rxPort_currentIndexChanged(int index);
|
||||
void on_attenuation_currentIndexChanged(int index);
|
||||
void on_amFmNotchFilter_clicked();
|
||||
void on_txFollowsRx_clicked();
|
||||
void on_txChannelGroup_currentIndexChanged(int index);
|
||||
void on_txChannel_currentIndexChanged(int index);
|
||||
void on_txPort_currentIndexChanged(int index);
|
||||
void on_powerEnable_clicked();
|
||||
void on_powerSource_currentIndexChanged(int index);
|
||||
void on_powerRefresh_clicked();
|
||||
void on_powerAutoRefresh_toggled(bool checked);
|
||||
void on_powerAbsAvg_clicked();
|
||||
void on_powerCorrValue_textEdited(const QString &text);
|
||||
void on_modeRx_toggled(bool checked);
|
||||
void on_modeTx_toggled(bool checked);
|
||||
void on_rxTxToggle_clicked();
|
||||
void on_deviceSetRefresh_clicked();
|
||||
void on_deviceSetSync_clicked();
|
||||
void on_apply_clicked();
|
||||
void tick();
|
||||
};
|
||||
|
||||
#endif // SDRGUI_LIMERFEGUI_LIMERFEUSBDIALOG_H_
|
File diff suppressed because it is too large
Load Diff
@ -97,10 +97,6 @@
|
||||
#include <QSplashScreen>
|
||||
#include <QProgressDialog>
|
||||
|
||||
#if defined(HAS_LIMERFEUSB)
|
||||
#include "limerfegui/limerfeusbdialog.h"
|
||||
#endif
|
||||
|
||||
MainWindow *MainWindow::m_instance = 0;
|
||||
|
||||
MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QWidget* parent) :
|
||||
@ -1474,11 +1470,6 @@ void MainWindow::createMenuBar()
|
||||
QAction *ambeAction = preferencesMenu->addAction("A&MBE...");
|
||||
ambeAction->setToolTip("AMBE options");
|
||||
QObject::connect(ambeAction, &QAction::triggered, this, &MainWindow::on_action_AMBE_triggered);
|
||||
#endif
|
||||
#if defined(HAS_LIMERFEUSB)
|
||||
QAction *limeRFEAction = preferencesMenu->addAction("Lime &RFE...");
|
||||
limeRFEAction->setToolTip("Lime RFE options");
|
||||
QObject::connect(limeRFEAction, &QAction::triggered, this, &MainWindow::on_action_LimeRFE_triggered);
|
||||
#endif
|
||||
QMenu *devicesMenu = preferencesMenu->addMenu("&Devices");
|
||||
QAction *userArgumentsAction = devicesMenu->addAction("&User arguments...");
|
||||
@ -2136,17 +2127,6 @@ void MainWindow::on_action_AMBE_triggered()
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::on_action_LimeRFE_triggered()
|
||||
{
|
||||
qDebug("MainWindow::on_action_LimeRFE_triggered");
|
||||
#if defined(HAS_LIMERFEUSB)
|
||||
qDebug("MainWindow::on_action_LimeRFE_triggered: activated");
|
||||
LimeRFEUSBDialog *limeRFEUSBDialog = new LimeRFEUSBDialog(m_mainCore->m_settings.getLimeRFEUSBCalib(), this);
|
||||
limeRFEUSBDialog->setModal(false);
|
||||
limeRFEUSBDialog->show();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::samplingDeviceChangeHandler(DeviceGUI *deviceGUI, int newDeviceIndex)
|
||||
{
|
||||
int deviceType = (int) deviceGUI->getDeviceType();
|
||||
|
@ -182,7 +182,6 @@ private slots:
|
||||
void on_action_Logging_triggered();
|
||||
void on_action_FFT_triggered();
|
||||
void on_action_AMBE_triggered();
|
||||
void on_action_LimeRFE_triggered();
|
||||
void on_action_My_Position_triggered();
|
||||
void on_action_DeviceUserArguments_triggered();
|
||||
void on_action_commands_triggered();
|
||||
|
Loading…
Reference in New Issue
Block a user