Skip to content

Commit 304d5c4

Browse files
some fucking changes too lazy to name this shit
1 parent 11f87e0 commit 304d5c4

File tree

1 file changed

+46
-7
lines changed
  • source_modules/sdrplay_source/src

1 file changed

+46
-7
lines changed

source_modules/sdrplay_source/src/main.cpp

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
#include <config.h>
99
#include <sdrplay_api.h>
1010
#include <gui/smgui.h>
11+
#include <utils/optionlist.h>
1112

1213
#define CONCAT(a, b) ((std::string(a) + b).c_str())
1314

1415
SDRPP_MOD_INFO{
1516
/* Name: */ "sdrplay_source",
1617
/* Description: */ "SDRplay source module for SDR++",
1718
/* Author: */ "Ryzerth",
18-
/* Version: */ 0, 1, 0,
19+
/* Version: */ 0, 2, 0,
1920
/* Max instances */ 1
2021
};
2122

@@ -208,6 +209,11 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
208209
name += devArr[i].SerNo;
209210
name += ')';
210211
break;
212+
case SDRPLAY_RSP1B_ID:
213+
name = "RSP1B (";
214+
name += devArr[i].SerNo;
215+
name += ')';
216+
break;
211217
case SDRPLAY_RSP2_ID:
212218
name = "RSP2 (";
213219
name += devArr[i].SerNo;
@@ -223,6 +229,11 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
223229
name += devArr[i].SerNo;
224230
name += ')';
225231
break;
232+
case SDRPLAY_RSPdxR2_ID:
233+
name = "RSPdx-R2 (";
234+
name += devArr[i].SerNo;
235+
name += ')';
236+
break;
226237
default:
227238
name = "Unknown (";
228239
name += devArr[i].SerNo;
@@ -290,14 +301,37 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
290301
return;
291302
}
292303

304+
// Define the valid samplerates
305+
samplerates.clear();
306+
samplerates.define(2e6, "2MHz", 2e6);
307+
samplerates.define(3e6, "3MHz", 3e6);
308+
samplerates.define(4e6, "4MHz", 4e6);
309+
samplerates.define(5e6, "5MHz", 5e6);
310+
samplerates.define(6e6, "6MHz", 6e6);
311+
samplerates.define(7e6, "7MHz", 7e6);
312+
samplerates.define(8e6, "8MHz", 8e6);
313+
samplerates.define(9e6, "9MHz", 9e6);
314+
samplerates.define(10e6, "10MHz", 10e6);
315+
316+
// Define the valid bandwidths
317+
bandwidths.define(0, "Auto", sdrplay_api_BW_Undefined);
318+
bandwidths.define(200e3, "200KHz", sdrplay_api_BW_0_200);
319+
bandwidths.define(300e3, "300KHz", sdrplay_api_BW_0_300);
320+
bandwidths.define(600e3, "600KHz", sdrplay_api_BW_0_600);
321+
bandwidths.define(1.536e6, "1.536MHz", sdrplay_api_BW_1_536);
322+
bandwidths.define(5e6, "5MHz", sdrplay_api_BW_5_000);
323+
bandwidths.define(6e6, "6MHz", sdrplay_api_BW_6_000);
324+
bandwidths.define(7e6, "7MHz", sdrplay_api_BW_7_000);
325+
bandwidths.define(8e6, "8MHz", sdrplay_api_BW_8_000);
326+
293327
channelParams = openDevParams->rxChannelA;
294328

295329
selectedName = devNameList[id];
296330

297331
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
298332
lnaSteps = 4;
299333
}
300-
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
334+
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSP1B_ID) {
301335
lnaSteps = 10;
302336
}
303337
else if (openDev.hwVer == SDRPLAY_RSP2_ID) {
@@ -306,7 +340,7 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
306340
else if (openDev.hwVer == SDRPLAY_RSPduo_ID) {
307341
lnaSteps = 10;
308342
}
309-
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
343+
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
310344
lnaSteps = 28;
311345
}
312346

@@ -331,7 +365,7 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
331365
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
332366
// No config to load
333367
}
334-
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
368+
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSP1B_ID) {
335369
config.conf["devices"][selectedName]["fmmwNotch"] = false;
336370
config.conf["devices"][selectedName]["dabNotch"] = false;
337371
config.conf["devices"][selectedName]["biast"] = false;
@@ -347,7 +381,7 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
347381
config.conf["devices"][selectedName]["dabNotch"] = false;
348382
config.conf["devices"][selectedName]["biast"] = false;
349383
}
350-
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
384+
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
351385
config.conf["devices"][selectedName]["antenna"] = 0;
352386
config.conf["devices"][selectedName]["fmmwNotch"] = false;
353387
config.conf["devices"][selectedName]["dabNotch"] = false;
@@ -415,7 +449,7 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
415449
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
416450
// No config to load
417451
}
418-
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
452+
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSP1B_ID) {
419453
if (config.conf["devices"][selectedName].contains("fmmwNotch")) {
420454
rsp1a_fmmwNotch = config.conf["devices"][selectedName]["fmmwNotch"];
421455
}
@@ -451,7 +485,7 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
451485
rspduo_biasT = config.conf["devices"][selectedName]["biast"];
452486
}
453487
}
454-
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
488+
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
455489
if (config.conf["devices"][selectedName].contains("antenna")) {
456490
rspdx_antennaPort = config.conf["devices"][selectedName]["antenna"];
457491
}
@@ -854,6 +888,7 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
854888
_this->RSP1Menu();
855889
break;
856890
case SDRPLAY_RSP1A_ID:
891+
case SDRPLAY_RSP1B_ID:
857892
_this->RSP1AMenu();
858893
break;
859894
case SDRPLAY_RSP2_ID:
@@ -863,6 +898,7 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
863898
_this->RSPduoMenu();
864899
break;
865900
case SDRPLAY_RSPdx_ID:
901+
case SDRPLAY_RSPdxR2_ID:
866902
_this->RSPdxMenu();
867903
break;
868904
default:
@@ -1201,6 +1237,9 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
12011237
std::string devListTxt;
12021238
std::vector<std::string> devNameList;
12031239
std::string selectedName;
1240+
1241+
OptionList<int, int> samplerates;
1242+
OptionList<int, sdrplay_api_Bw_MHzT> bandwidths;
12041243
};
12051244

12061245
MOD_EXPORT void _INIT_() {

0 commit comments

Comments
 (0)