mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-13 03:37:10 +01:00
finish implementing support for RSP1B and RSPdx R2 + Improve samplerate and bandwidth code
This commit is contained in:
parent
304d5c42cc
commit
d62426364a
@ -22,51 +22,6 @@ SDRPP_MOD_INFO{
|
|||||||
|
|
||||||
ConfigManager config;
|
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_MHzT preferedBandwidth[] = {
|
||||||
sdrplay_api_BW_5_000,
|
sdrplay_api_BW_5_000,
|
||||||
sdrplay_api_BW_5_000,
|
sdrplay_api_BW_5_000,
|
||||||
@ -314,7 +269,7 @@ public:
|
|||||||
samplerates.define(10e6, "10MHz", 10e6);
|
samplerates.define(10e6, "10MHz", 10e6);
|
||||||
|
|
||||||
// Define the valid bandwidths
|
// Define the valid bandwidths
|
||||||
bandwidths.define(0, "Auto", sdrplay_api_BW_Undefined);
|
bandwidths.clear();
|
||||||
bandwidths.define(200e3, "200KHz", sdrplay_api_BW_0_200);
|
bandwidths.define(200e3, "200KHz", sdrplay_api_BW_0_200);
|
||||||
bandwidths.define(300e3, "300KHz", sdrplay_api_BW_0_300);
|
bandwidths.define(300e3, "300KHz", sdrplay_api_BW_0_300);
|
||||||
bandwidths.define(600e3, "600KHz", sdrplay_api_BW_0_600);
|
bandwidths.define(600e3, "600KHz", sdrplay_api_BW_0_600);
|
||||||
@ -323,6 +278,7 @@ public:
|
|||||||
bandwidths.define(6e6, "6MHz", sdrplay_api_BW_6_000);
|
bandwidths.define(6e6, "6MHz", sdrplay_api_BW_6_000);
|
||||||
bandwidths.define(7e6, "7MHz", sdrplay_api_BW_7_000);
|
bandwidths.define(7e6, "7MHz", sdrplay_api_BW_7_000);
|
||||||
bandwidths.define(8e6, "8MHz", sdrplay_api_BW_8_000);
|
bandwidths.define(8e6, "8MHz", sdrplay_api_BW_8_000);
|
||||||
|
bandwidths.define(0, "Auto", sdrplay_api_BW_Undefined);
|
||||||
|
|
||||||
channelParams = openDevParams->rxChannelA;
|
channelParams = openDevParams->rxChannelA;
|
||||||
|
|
||||||
@ -344,74 +300,22 @@ public:
|
|||||||
lnaSteps = 28;
|
lnaSteps = 28;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool created = false;
|
|
||||||
config.acquire();
|
config.acquire();
|
||||||
if (!config.conf["devices"].contains(selectedName)) {
|
|
||||||
created = true;
|
|
||||||
config.conf["devices"][selectedName]["sampleRate"] = sampleRates[0];
|
|
||||||
config.conf["devices"][selectedName]["bwMode"] = 8; // Auto
|
|
||||||
config.conf["devices"][selectedName]["lnaGain"] = lnaSteps - 1;
|
|
||||||
config.conf["devices"][selectedName]["ifGain"] = 59;
|
|
||||||
config.conf["devices"][selectedName]["agc"] = false;
|
|
||||||
|
|
||||||
config.conf["devices"][selectedName]["agcAttack"] = 500;
|
|
||||||
config.conf["devices"][selectedName]["agcDecay"] = 500;
|
|
||||||
config.conf["devices"][selectedName]["agcDecayDelay"] = 200;
|
|
||||||
config.conf["devices"][selectedName]["agcDecayThreshold"] = 5;
|
|
||||||
config.conf["devices"][selectedName]["agcSetPoint"] = -30;
|
|
||||||
|
|
||||||
config.conf["devices"][selectedName]["ifModeId"] = 0;
|
|
||||||
|
|
||||||
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
|
|
||||||
// No config to load
|
|
||||||
}
|
|
||||||
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSP1B_ID) {
|
|
||||||
config.conf["devices"][selectedName]["fmmwNotch"] = false;
|
|
||||||
config.conf["devices"][selectedName]["dabNotch"] = false;
|
|
||||||
config.conf["devices"][selectedName]["biast"] = false;
|
|
||||||
}
|
|
||||||
else if (openDev.hwVer == SDRPLAY_RSP2_ID) {
|
|
||||||
config.conf["devices"][selectedName]["antenna"] = 0;
|
|
||||||
config.conf["devices"][selectedName]["fmmwNotch"] = false;
|
|
||||||
config.conf["devices"][selectedName]["biast"] = false;
|
|
||||||
}
|
|
||||||
else if (openDev.hwVer == SDRPLAY_RSPduo_ID) {
|
|
||||||
config.conf["devices"][selectedName]["antenna"] = 0;
|
|
||||||
config.conf["devices"][selectedName]["fmmwNotch"] = false;
|
|
||||||
config.conf["devices"][selectedName]["dabNotch"] = false;
|
|
||||||
config.conf["devices"][selectedName]["biast"] = false;
|
|
||||||
}
|
|
||||||
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
|
|
||||||
config.conf["devices"][selectedName]["antenna"] = 0;
|
|
||||||
config.conf["devices"][selectedName]["fmmwNotch"] = false;
|
|
||||||
config.conf["devices"][selectedName]["dabNotch"] = false;
|
|
||||||
config.conf["devices"][selectedName]["biast"] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// General options
|
// General options
|
||||||
if (config.conf["devices"][selectedName].contains("sampleRate")) {
|
if (config.conf["devices"][selectedName].contains("samplerate")) {
|
||||||
sampleRate = config.conf["devices"][selectedName]["sampleRate"];
|
int sr = config.conf["devices"][selectedName]["samplerate"];
|
||||||
bool found = false;
|
if (samplerates.keyExists(sr)) {
|
||||||
for (int i = 0; i < 9; i++) {
|
srId = samplerates.keyId(sr);
|
||||||
if (sampleRates[i] == sampleRate) {
|
sampleRate = samplerates[srId];
|
||||||
srId = i;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
sampleRate = sampleRates[0];
|
|
||||||
srId = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.conf["devices"][selectedName].contains("ifModeId")) {
|
if (config.conf["devices"][selectedName].contains("ifModeId")) {
|
||||||
ifModeId = config.conf["devices"][selectedName]["ifModeId"];
|
ifModeId = config.conf["devices"][selectedName]["ifModeId"];
|
||||||
if (ifModeId != 0) {
|
if (ifModeId != 0) {
|
||||||
sampleRate = ifModes[ifModeId].effectiveSamplerate;
|
sampleRate = ifModes[ifModeId].effectiveSamplerate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.conf["devices"][selectedName].contains("bwMode")) {
|
if (config.conf["devices"][selectedName].contains("bwMode")) {
|
||||||
bandwidthId = config.conf["devices"][selectedName]["bwMode"];
|
bandwidthId = config.conf["devices"][selectedName]["bwMode"];
|
||||||
}
|
}
|
||||||
@ -422,11 +326,6 @@ public:
|
|||||||
gain = config.conf["devices"][selectedName]["ifGain"];
|
gain = config.conf["devices"][selectedName]["ifGain"];
|
||||||
}
|
}
|
||||||
if (config.conf["devices"][selectedName].contains("agc")) {
|
if (config.conf["devices"][selectedName].contains("agc")) {
|
||||||
if (!config.conf["devices"][selectedName]["agc"].is_boolean()) {
|
|
||||||
int oldMode = config.conf["devices"][selectedName]["agc"];
|
|
||||||
config.conf["devices"][selectedName]["agc"] = (bool)(oldMode != 0);
|
|
||||||
created = true;
|
|
||||||
}
|
|
||||||
agc = config.conf["devices"][selectedName]["agc"];
|
agc = config.conf["devices"][selectedName]["agc"];
|
||||||
}
|
}
|
||||||
if (config.conf["devices"][selectedName].contains("agcAttack")) {
|
if (config.conf["devices"][selectedName].contains("agcAttack")) {
|
||||||
@ -500,7 +399,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.release(created);
|
config.release();
|
||||||
|
|
||||||
if (lnaGain >= lnaSteps) { lnaGain = lnaSteps - 1; }
|
if (lnaGain >= lnaSteps) { lnaGain = lnaSteps - 1; }
|
||||||
|
|
||||||
@ -648,7 +547,7 @@ private:
|
|||||||
|
|
||||||
// General options
|
// General options
|
||||||
if (_this->ifModeId == 0) {
|
if (_this->ifModeId == 0) {
|
||||||
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : bandwidths[_this->bandwidthId];
|
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : _this->bandwidths[_this->bandwidthId];
|
||||||
_this->openDevParams->devParams->fsFreq.fsHz = _this->sampleRate;
|
_this->openDevParams->devParams->fsFreq.fsHz = _this->sampleRate;
|
||||||
_this->channelParams->tunerParams.bwType = _this->bandwidth;
|
_this->channelParams->tunerParams.bwType = _this->bandwidth;
|
||||||
}
|
}
|
||||||
@ -727,14 +626,14 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_this->ifModeId == 0) {
|
if (_this->ifModeId == 0) {
|
||||||
if (SmGui::Combo(CONCAT("##sdrplay_sr", _this->name), &_this->srId, sampleRatesTxt)) {
|
if (SmGui::Combo(CONCAT("##sdrplay_sr", _this->name), &_this->srId, _this->samplerates.txt)) {
|
||||||
_this->sampleRate = sampleRates[_this->srId];
|
_this->sampleRate = _this->samplerates[_this->srId];
|
||||||
if (_this->bandwidthId == 8) {
|
if (_this->bandwidthId == 8) {
|
||||||
_this->bandwidth = preferedBandwidth[_this->srId];
|
_this->bandwidth = preferedBandwidth[_this->srId];
|
||||||
}
|
}
|
||||||
core::setInputSampleRate(_this->sampleRate);
|
core::setInputSampleRate(_this->sampleRate);
|
||||||
config.acquire();
|
config.acquire();
|
||||||
config.conf["devices"][_this->selectedName]["sampleRate"] = _this->sampleRate;
|
config.conf["devices"][_this->selectedName]["samplerate"] = _this->samplerates.key(_this->srId);
|
||||||
config.release(true);
|
config.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,8 +648,8 @@ private:
|
|||||||
|
|
||||||
SmGui::LeftLabel("Bandwidth");
|
SmGui::LeftLabel("Bandwidth");
|
||||||
SmGui::FillWidth();
|
SmGui::FillWidth();
|
||||||
if (SmGui::Combo(CONCAT("##sdrplay_bw", _this->name), &_this->bandwidthId, bandwidthsTxt)) {
|
if (SmGui::Combo(CONCAT("##sdrplay_bw", _this->name), &_this->bandwidthId, _this->bandwidths.txt)) {
|
||||||
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : bandwidths[_this->bandwidthId];
|
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : _this->bandwidths[_this->bandwidthId];
|
||||||
if (_this->running) {
|
if (_this->running) {
|
||||||
_this->channelParams->tunerParams.bwType = _this->bandwidth;
|
_this->channelParams->tunerParams.bwType = _this->bandwidth;
|
||||||
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_BwType, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_BwType, sdrplay_api_Update_Ext1_None);
|
||||||
@ -779,10 +678,14 @@ private:
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
config.acquire();
|
config.acquire();
|
||||||
_this->sampleRate = config.conf["devices"][_this->selectedName]["sampleRate"];
|
int sr = config.conf["devices"][_this->selectedName]["samplerate"];
|
||||||
|
if (_this->samplerates.keyExists(sr)) {
|
||||||
|
_this->srId = _this->samplerates.keyId(sr);
|
||||||
|
_this->sampleRate = _this->samplerates[_this->srId];
|
||||||
|
}
|
||||||
_this->bandwidthId = config.conf["devices"][_this->selectedName]["bwMode"];
|
_this->bandwidthId = config.conf["devices"][_this->selectedName]["bwMode"];
|
||||||
config.release(false);
|
config.release();
|
||||||
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : bandwidths[_this->bandwidthId];
|
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : _this->bandwidths[_this->bandwidthId];
|
||||||
}
|
}
|
||||||
core::setInputSampleRate(_this->sampleRate);
|
core::setInputSampleRate(_this->sampleRate);
|
||||||
config.acquire();
|
config.acquire();
|
||||||
|
Loading…
Reference in New Issue
Block a user