Revert "add support for new models (in a bad way) and start the rewrite process"
Some checks failed
Build Binaries / build_debian_buster (push) Failing after 17s
Build Binaries / build_debian_bullseye (push) Failing after 4s
Build Binaries / build_debian_bookworm (push) Failing after 4s
Build Binaries / build_debian_sid (push) Failing after 4s
Build Binaries / build_ubuntu_focal (push) Failing after 4s
Build Binaries / build_ubuntu_jammy (push) Failing after 4s
Build Binaries / build_ubuntu_mantic (push) Failing after 4s
Build Binaries / build_ubuntu_noble (push) Failing after 4s
Build Binaries / build_android (push) Failing after 5s
Build Binaries / check_spelling (push) Failing after 4s
Build Binaries / check_formatting (push) Successful in 3s
Build Binaries / build_windows (push) Has been cancelled
Build Binaries / build_macos_intel (push) Has been cancelled
Build Binaries / build_macos_arm (push) Has been cancelled
Build Binaries / build_raspios_bullseye_armhf (push) Has been cancelled
Build Binaries / create_full_archive (push) Has been cancelled
Build Binaries / update_nightly_release (push) Has been cancelled

This reverts commit 3c1d0c742234ae633e00ce9910cf81c56dd104da.
This commit is contained in:
AlexandreRouma 2024-11-27 21:42:59 +01:00
parent 3c1d0c7422
commit b914587228

View File

@ -8,7 +8,6 @@
#include <config.h>
#include <sdrplay_api.h>
#include <gui/smgui.h>
#include <utils/optionlist.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -16,12 +15,69 @@ SDRPP_MOD_INFO{
/* Name: */ "sdrplay_source",
/* Description: */ "SDRplay source module for SDR++",
/* Author: */ "Ryzerth",
/* Version: */ 0, 2, 0,
/* Version: */ 0, 1, 0,
/* Max instances */ 1
};
ConfigManager config;
unsigned int sampleRates[] = {
2000000,
3000000,
4000000,
5000000,
6000000,
7000000,
8000000,
9000000,
10000000
};
const char* sampleRatesTxt =
"2MHz\0"
"3MHz\0"
"4MHz\0"
"5MHz\0"
"6MHz\0"
"7MHz\0"
"8MHz\0"
"9MHz\0"
"10MHz\0";
sdrplay_api_Bw_MHzT bandwidths[] = {
sdrplay_api_BW_0_200,
sdrplay_api_BW_0_300,
sdrplay_api_BW_0_600,
sdrplay_api_BW_1_536,
sdrplay_api_BW_5_000,
sdrplay_api_BW_6_000,
sdrplay_api_BW_7_000,
sdrplay_api_BW_8_000,
};
const char* bandwidthsTxt =
"200KHz\0"
"300KHz\0"
"600KHz\0"
"1.536MHz\0"
"5MHz\0"
"6MHz\0"
"7MHz\0"
"8MHz\0"
"Auto\0";
sdrplay_api_Bw_MHzT preferedBandwidth[] = {
sdrplay_api_BW_5_000,
sdrplay_api_BW_5_000,
sdrplay_api_BW_5_000,
sdrplay_api_BW_5_000,
sdrplay_api_BW_6_000,
sdrplay_api_BW_7_000,
sdrplay_api_BW_8_000,
sdrplay_api_BW_8_000,
sdrplay_api_BW_8_000
};
const sdrplay_api_Rsp2_AntennaSelectT rsp2_antennaPorts[] = {
sdrplay_api_Rsp2_ANTENNA_A,
sdrplay_api_Rsp2_ANTENNA_B,
@ -152,11 +208,6 @@ public:
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSP1B_ID:
name = "RSP1B (";
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSP2_ID:
name = "RSP2 (";
name += devArr[i].SerNo;
@ -172,11 +223,6 @@ public:
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSPdxR2_ID:
name = "RSPdx-R2 (";
name += devArr[i].SerNo;
name += ')';
break;
default:
name = "Unknown (";
name += devArr[i].SerNo;
@ -244,29 +290,6 @@ public:
return;
}
// Define the valid samplerates
samplerates.clear();
samplerates.define(2e6, "2MHz", 2e6);
samplerates.define(3e6, "3MHz", 3e6);
samplerates.define(4e6, "4MHz", 4e6);
samplerates.define(5e6, "5MHz", 5e6);
samplerates.define(6e6, "6MHz", 6e6);
samplerates.define(7e6, "7MHz", 7e6);
samplerates.define(8e6, "8MHz", 8e6);
samplerates.define(9e6, "9MHz", 9e6);
samplerates.define(10e6, "10MHz", 10e6);
// Define the valid bandwidths
bandwidths.define(0, "Auto", sdrplay_api_BW_Undefined);
bandwidths.define(200e3, "200KHz", sdrplay_api_BW_0_200);
bandwidths.define(300e3, "300KHz", sdrplay_api_BW_0_300);
bandwidths.define(600e3, "600KHz", sdrplay_api_BW_0_600);
bandwidths.define(1.536e6, "1.536MHz", sdrplay_api_BW_1_536);
bandwidths.define(5e6, "5MHz", sdrplay_api_BW_5_000);
bandwidths.define(6e6, "6MHz", sdrplay_api_BW_6_000);
bandwidths.define(7e6, "7MHz", sdrplay_api_BW_7_000);
bandwidths.define(8e6, "8MHz", sdrplay_api_BW_8_000);
channelParams = openDevParams->rxChannelA;
selectedName = devNameList[id];
@ -274,7 +297,7 @@ public:
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
lnaSteps = 4;
}
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSP1B_ID) {
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
lnaSteps = 10;
}
else if (openDev.hwVer == SDRPLAY_RSP2_ID) {
@ -283,7 +306,7 @@ public:
else if (openDev.hwVer == SDRPLAY_RSPduo_ID) {
lnaSteps = 10;
}
else if (openDev.hwVer == SDRPLAY_RSPdx_ID || openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
lnaSteps = 28;
}
@ -308,7 +331,7 @@ public:
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
// No config to load
}
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSP1B_ID) {
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
config.conf["devices"][selectedName]["fmmwNotch"] = false;
config.conf["devices"][selectedName]["dabNotch"] = false;
config.conf["devices"][selectedName]["biast"] = false;
@ -324,7 +347,7 @@ public:
config.conf["devices"][selectedName]["dabNotch"] = false;
config.conf["devices"][selectedName]["biast"] = false;
}
else if (openDev.hwVer == SDRPLAY_RSPdx_ID || openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
config.conf["devices"][selectedName]["antenna"] = 0;
config.conf["devices"][selectedName]["fmmwNotch"] = false;
config.conf["devices"][selectedName]["dabNotch"] = false;
@ -392,7 +415,7 @@ public:
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
// No config to load
}
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSP1B_ID) {
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
if (config.conf["devices"][selectedName].contains("fmmwNotch")) {
rsp1a_fmmwNotch = config.conf["devices"][selectedName]["fmmwNotch"];
}
@ -428,7 +451,7 @@ public:
rspduo_biasT = config.conf["devices"][selectedName]["biast"];
}
}
else if (openDev.hwVer == SDRPLAY_RSPdx_ID || openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
if (config.conf["devices"][selectedName].contains("antenna")) {
rspdx_antennaPort = config.conf["devices"][selectedName]["antenna"];
}
@ -548,7 +571,7 @@ private:
_this->bufferSize = (float)_this->sampleRate / 200.0f;
// RSP1A Options
if (_this->openDev.hwVer == SDRPLAY_RSP1A_ID || _this->openDev.hwVer == SDRPLAY_RSP1B_ID) {
if (_this->openDev.hwVer == SDRPLAY_RSP1A_ID) {
_this->openDevParams->devParams->rsp1aParams.rfNotchEnable = _this->rsp1a_fmmwNotch;
_this->openDevParams->devParams->rsp1aParams.rfDabNotchEnable = _this->rsp1a_dabNotch;
_this->channelParams->rsp1aTunerParams.biasTEnable = _this->rsp1a_biasT;
@ -578,7 +601,7 @@ private:
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_RspDuo_RfDabNotchControl, sdrplay_api_Update_Ext1_None);
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_RspDuo_Tuner1AmNotchControl, sdrplay_api_Update_Ext1_None);
}
else if (_this->openDev.hwVer == SDRPLAY_RSPdx_ID || _this->openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
else if (_this->openDev.hwVer == SDRPLAY_RSPdx_ID) {
_this->openDevParams->devParams->rspDxParams.rfNotchEnable = _this->rspdx_fmmwNotch;
_this->openDevParams->devParams->rspDxParams.rfDabNotchEnable = _this->rspdx_dabNotch;
_this->openDevParams->devParams->rspDxParams.biasTEnable = _this->rspdx_biasT;
@ -670,8 +693,8 @@ private:
}
if (_this->ifModeId == 0) {
if (SmGui::Combo(CONCAT("##sdrplay_sr", _this->name), &_this->srId, _this->samplerates.txt)) {
_this->sampleRate = _this->samplerates[_this->srId];
if (SmGui::Combo(CONCAT("##sdrplay_sr", _this->name), &_this->srId, sampleRatesTxt)) {
_this->sampleRate = sampleRates[_this->srId];
if (_this->bandwidthId == 8) {
_this->bandwidth = preferedBandwidth[_this->srId];
}
@ -831,7 +854,6 @@ private:
_this->RSP1Menu();
break;
case SDRPLAY_RSP1A_ID:
case SDRPLAY_RSP1B_ID:
_this->RSP1AMenu();
break;
case SDRPLAY_RSP2_ID:
@ -841,7 +863,6 @@ private:
_this->RSPduoMenu();
break;
case SDRPLAY_RSPdx_ID:
case SDRPLAY_RSPdxR2_ID:
_this->RSPdxMenu();
break;
default:
@ -1180,9 +1201,6 @@ private:
std::string devListTxt;
std::vector<std::string> devNameList;
std::string selectedName;
OptionList<int, int> samplerates;
OptionList<int, sdrplay_api_Bw_MHzT> bandwidths;
};
MOD_EXPORT void _INIT_() {