mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-26 10:58:29 +01:00
Added persistent config for sdrplay + bugfix
This commit is contained in:
parent
c21db4b6d1
commit
20ee982e3d
@ -95,7 +95,14 @@ const sdrplay_api_RspDx_AntennaSelectT rspdx_antennaPorts[] = {
|
|||||||
|
|
||||||
const char* rspdx_antennaPortsTxt = "Port A\0Port B\0Port C\0";
|
const char* rspdx_antennaPortsTxt = "Port A\0Port B\0Port C\0";
|
||||||
|
|
||||||
|
const sdrplay_api_AgcControlT agcModes[] = {
|
||||||
|
sdrplay_api_AGC_DISABLE,
|
||||||
|
sdrplay_api_AGC_5HZ,
|
||||||
|
sdrplay_api_AGC_50HZ,
|
||||||
|
sdrplay_api_AGC_100HZ
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* agcModesTxt = "Off\0005Hz\00050Hz\000100Hz";
|
||||||
|
|
||||||
class SDRPlaySourceModule : public ModuleManager::Instance {
|
class SDRPlaySourceModule : public ModuleManager::Instance {
|
||||||
public:
|
public:
|
||||||
@ -125,7 +132,11 @@ public:
|
|||||||
handler.stream = &stream;
|
handler.stream = &stream;
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
selectFirst();
|
|
||||||
|
config.aquire();
|
||||||
|
std::string confSelectDev = config.conf["device"];
|
||||||
|
config.release();
|
||||||
|
selectByName(confSelectDev);
|
||||||
|
|
||||||
// if (sampleRateList.size() > 0) {
|
// if (sampleRateList.size() > 0) {
|
||||||
// sampleRate = sampleRateList[0];
|
// sampleRate = sampleRateList[0];
|
||||||
@ -159,6 +170,7 @@ public:
|
|||||||
|
|
||||||
void refresh() {
|
void refresh() {
|
||||||
devList.clear();
|
devList.clear();
|
||||||
|
devNameList.clear();
|
||||||
devListTxt = "";
|
devListTxt = "";
|
||||||
|
|
||||||
sdrplay_api_DeviceT devArr[128];
|
sdrplay_api_DeviceT devArr[128];
|
||||||
@ -167,44 +179,58 @@ public:
|
|||||||
|
|
||||||
for (unsigned int i = 0; i < numDev; i++) {
|
for (unsigned int i = 0; i < numDev; i++) {
|
||||||
devList.push_back(devArr[i]);
|
devList.push_back(devArr[i]);
|
||||||
|
std::string name = "";
|
||||||
switch (devArr[i].hwVer) {
|
switch (devArr[i].hwVer) {
|
||||||
case SDRPLAY_RSP1_ID:
|
case SDRPLAY_RSP1_ID:
|
||||||
devListTxt += "RSP1 "; devListTxt += devArr[i].SerNo;
|
name = "RSP1 ("; name += devArr[i].SerNo; name += ')';
|
||||||
break;
|
break;
|
||||||
case SDRPLAY_RSP1A_ID:
|
case SDRPLAY_RSP1A_ID:
|
||||||
devListTxt += "RSP1A "; devListTxt += devArr[i].SerNo;
|
name = "RSP1A ("; name += devArr[i].SerNo; name += ')';
|
||||||
break;
|
break;
|
||||||
case SDRPLAY_RSP2_ID:
|
case SDRPLAY_RSP2_ID:
|
||||||
devListTxt += "RSP2 "; devListTxt += devArr[i].SerNo;
|
name = "RSP2 ("; name += devArr[i].SerNo; name += ')';
|
||||||
break;
|
break;
|
||||||
case SDRPLAY_RSPduo_ID:
|
case SDRPLAY_RSPduo_ID:
|
||||||
devListTxt += "RSPduo "; devListTxt += devArr[i].SerNo;
|
name = "RSPduo ("; name += devArr[i].SerNo; name += ')';
|
||||||
break;
|
break;
|
||||||
case SDRPLAY_RSPdx_ID:
|
case SDRPLAY_RSPdx_ID:
|
||||||
devListTxt += "RSPdx "; devListTxt += devArr[i].SerNo;
|
name = "RSPdx ("; name += devArr[i].SerNo; name += ')';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
devListTxt += "Unknown "; devListTxt += devArr[i].SerNo;
|
name = "Unknown ("; name += devArr[i].SerNo; name += ')';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
devNameList.push_back(name);
|
||||||
|
devListTxt += name;
|
||||||
devListTxt += '\0';
|
devListTxt += '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectFirst() {
|
void selectFirst() {
|
||||||
if (devList.size() == 0) { return; }
|
if (devList.size() == 0) { return; }
|
||||||
selectDev(devList[0]);
|
selectDev(devList[0], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectByName(std::string name) {
|
||||||
|
for (int i = 0; i < devNameList.size(); i++) {
|
||||||
|
if (devNameList[i] == name) {
|
||||||
|
selectDev(devList[i], i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selectFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectById(int id) {
|
void selectById(int id) {
|
||||||
selectDev(devList[id]);
|
selectDev(devList[id], id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectDev(sdrplay_api_DeviceT dev) {
|
void selectDev(sdrplay_api_DeviceT dev, int id) {
|
||||||
openDev = dev;
|
openDev = dev;
|
||||||
sdrplay_api_ErrT err;
|
sdrplay_api_ErrT err;
|
||||||
|
|
||||||
if (deviceOpen) {
|
if (deviceOpen) {
|
||||||
|
// TODO: Fix crash here
|
||||||
sdrplay_api_Uninit(openDev.dev);
|
sdrplay_api_Uninit(openDev.dev);
|
||||||
sdrplay_api_ReleaseDevice(&openDev);
|
sdrplay_api_ReleaseDevice(&openDev);
|
||||||
}
|
}
|
||||||
@ -214,6 +240,7 @@ public:
|
|||||||
const char* errStr = sdrplay_api_GetErrorString(err);
|
const char* errStr = sdrplay_api_GetErrorString(err);
|
||||||
spdlog::error("Could not select RSP device: {0}", errStr);
|
spdlog::error("Could not select RSP device: {0}", errStr);
|
||||||
deviceOpen = false;
|
deviceOpen = false;
|
||||||
|
selectedName = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,6 +249,7 @@ public:
|
|||||||
const char* errStr = sdrplay_api_GetErrorString(err);
|
const char* errStr = sdrplay_api_GetErrorString(err);
|
||||||
spdlog::error("Could not get device params for RSP device: {0}", errStr);
|
spdlog::error("Could not get device params for RSP device: {0}", errStr);
|
||||||
deviceOpen = false;
|
deviceOpen = false;
|
||||||
|
selectedName = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,9 +258,12 @@ public:
|
|||||||
const char* errStr = sdrplay_api_GetErrorString(err);
|
const char* errStr = sdrplay_api_GetErrorString(err);
|
||||||
spdlog::error("Could not init RSP device: {0}", errStr);
|
spdlog::error("Could not init RSP device: {0}", errStr);
|
||||||
deviceOpen = false;
|
deviceOpen = false;
|
||||||
|
selectedName = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectedName = devNameList[id];
|
||||||
|
|
||||||
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
|
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
|
||||||
lnaSteps = 4;
|
lnaSteps = 4;
|
||||||
}
|
}
|
||||||
@ -249,6 +280,114 @@ public:
|
|||||||
lnaSteps = 28;
|
lnaSteps = 28;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool created = false;
|
||||||
|
config.aquire();
|
||||||
|
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"] = 0; // Disabled
|
||||||
|
|
||||||
|
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
|
||||||
|
// No config to load
|
||||||
|
}
|
||||||
|
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
|
||||||
|
config.conf["devices"][selectedName]["fmNotch"] = 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]["notch"] = false;
|
||||||
|
config.conf["devices"][selectedName]["biast"] = false;
|
||||||
|
}
|
||||||
|
else if (openDev.hwVer == SDRPLAY_RSPduo_ID) {
|
||||||
|
// TODO: Implement
|
||||||
|
}
|
||||||
|
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
|
||||||
|
config.conf["devices"][selectedName]["antenna"] = 0;
|
||||||
|
config.conf["devices"][selectedName]["fmNotch"] = false;
|
||||||
|
config.conf["devices"][selectedName]["dabNotch"] = false;
|
||||||
|
config.conf["devices"][selectedName]["biast"] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// General options
|
||||||
|
if (config.conf["devices"][selectedName].contains("sampleRate")) {
|
||||||
|
sampleRate = config.conf["devices"][selectedName]["sampleRate"];
|
||||||
|
bool found = false;
|
||||||
|
for (int i = 0; i < 9; i++) {
|
||||||
|
if (sampleRates[i] == sampleRate) {
|
||||||
|
srId = i;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
sampleRate = sampleRates[0];
|
||||||
|
srId = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("bwMode")) {
|
||||||
|
bandwidthId = config.conf["devices"][selectedName]["bwMode"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("lnaGain")) {
|
||||||
|
lnaGain = config.conf["devices"][selectedName]["lnaGain"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("ifGain")) {
|
||||||
|
gain = config.conf["devices"][selectedName]["ifGain"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("agc")) {
|
||||||
|
agc = config.conf["devices"][selectedName]["agc"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Per device options
|
||||||
|
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
|
||||||
|
// No config to load
|
||||||
|
}
|
||||||
|
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
|
||||||
|
if (config.conf["devices"][selectedName].contains("fmNotch")) {
|
||||||
|
rsp1a_fmNotch = config.conf["devices"][selectedName]["fmNotch"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("dabNotch")) {
|
||||||
|
rsp1a_dabNotch = config.conf["devices"][selectedName]["dabNotch"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("biast")) {
|
||||||
|
rsp1a_biasT = config.conf["devices"][selectedName]["biast"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (openDev.hwVer == SDRPLAY_RSP2_ID) {
|
||||||
|
if (config.conf["devices"][selectedName].contains("antenna")) {
|
||||||
|
rsp2_antennaPort = config.conf["devices"][selectedName]["antenna"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("notch")) {
|
||||||
|
rsp2_notch = config.conf["devices"][selectedName]["notch"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("biast")) {
|
||||||
|
rsp2_biasT = config.conf["devices"][selectedName]["biast"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (openDev.hwVer == SDRPLAY_RSPduo_ID) {
|
||||||
|
// TODO: Implement
|
||||||
|
}
|
||||||
|
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
|
||||||
|
if (config.conf["devices"][selectedName].contains("antenna")) {
|
||||||
|
rspdx_antennaPort = config.conf["devices"][selectedName]["antenna"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("fmNotch")) {
|
||||||
|
rspdx_fmNotch = config.conf["devices"][selectedName]["fmNotch"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("dabNotch")) {
|
||||||
|
rspdx_dabNotch = config.conf["devices"][selectedName]["dabNotch"];
|
||||||
|
}
|
||||||
|
if (config.conf["devices"][selectedName].contains("biast")) {
|
||||||
|
rspdx_biasT = config.conf["devices"][selectedName]["biast"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.release(created);
|
||||||
|
|
||||||
if (lnaGain >= lnaSteps) { lnaGain = lnaSteps - 1; }
|
if (lnaGain >= lnaSteps) { lnaGain = lnaSteps - 1; }
|
||||||
|
|
||||||
deviceOpen = true;
|
deviceOpen = true;
|
||||||
@ -303,7 +442,7 @@ private:
|
|||||||
_this->openDevParams->rxChannelA->tunerParams.rfFreq.rfHz = _this->freq;
|
_this->openDevParams->rxChannelA->tunerParams.rfFreq.rfHz = _this->freq;
|
||||||
_this->openDevParams->rxChannelA->tunerParams.gain.gRdB = _this->gain;
|
_this->openDevParams->rxChannelA->tunerParams.gain.gRdB = _this->gain;
|
||||||
_this->openDevParams->rxChannelA->tunerParams.gain.LNAstate = _this->lnaGain;
|
_this->openDevParams->rxChannelA->tunerParams.gain.LNAstate = _this->lnaGain;
|
||||||
_this->openDevParams->rxChannelA->ctrlParams.agc.enable = sdrplay_api_AGC_DISABLE;
|
_this->openDevParams->rxChannelA->ctrlParams.agc.enable = agcModes[_this->agc];
|
||||||
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Dev_Fs, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Dev_Fs, sdrplay_api_Update_Ext1_None);
|
||||||
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);
|
||||||
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Frf, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Frf, sdrplay_api_Update_Ext1_None);
|
||||||
@ -379,7 +518,9 @@ private:
|
|||||||
|
|
||||||
if (ImGui::Combo(CONCAT("##sdrplay_dev", _this->name), &_this->devId, _this->devListTxt.c_str())) {
|
if (ImGui::Combo(CONCAT("##sdrplay_dev", _this->name), &_this->devId, _this->devListTxt.c_str())) {
|
||||||
_this->selectById(_this->devId);
|
_this->selectById(_this->devId);
|
||||||
// Save config
|
config.aquire();
|
||||||
|
config.conf["device"] = _this->devNameList[_this->devId];
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -390,7 +531,9 @@ private:
|
|||||||
_this->bandwidth = preferedBandwidth[_this->srId];
|
_this->bandwidth = preferedBandwidth[_this->srId];
|
||||||
}
|
}
|
||||||
core::setInputSampleRate(_this->sampleRate);
|
core::setInputSampleRate(_this->sampleRate);
|
||||||
// Save config
|
config.aquire();
|
||||||
|
config.conf["devices"][_this->selectedName]["sampleRate"] = _this->sampleRate;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->running) { style::endDisabled(); }
|
if (_this->running) { style::endDisabled(); }
|
||||||
@ -402,7 +545,9 @@ private:
|
|||||||
_this->openDevParams->rxChannelA->tunerParams.bwType = _this->bandwidth;
|
_this->openDevParams->rxChannelA->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);
|
||||||
}
|
}
|
||||||
// Save config
|
config.aquire();
|
||||||
|
config.conf["devices"][_this->selectedName]["bwMode"] = _this->bandwidthId;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->deviceOpen) {
|
if (_this->deviceOpen) {
|
||||||
@ -410,19 +555,43 @@ private:
|
|||||||
ImGui::Text("LNA Gain");
|
ImGui::Text("LNA Gain");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
float pos = ImGui::GetCursorPosX();
|
float pos = ImGui::GetCursorPosX();
|
||||||
if (ImGui::SliderInt(CONCAT("##sdrplay_lna_gain", _this->name), &_this->lnaGain, _this->lnaSteps, 0, "")) {
|
if (ImGui::SliderInt(CONCAT("##sdrplay_lna_gain", _this->name), &_this->lnaGain, _this->lnaSteps - 1, 0, "")) {
|
||||||
_this->openDevParams->rxChannelA->tunerParams.gain.LNAstate = _this->lnaGain;
|
_this->openDevParams->rxChannelA->tunerParams.gain.LNAstate = _this->lnaGain;
|
||||||
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][_this->selectedName]["lnaGain"] = _this->lnaGain;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_this->agc > 0) { style::beginDisabled(); }
|
||||||
ImGui::Text("IF Gain");
|
ImGui::Text("IF Gain");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetCursorPosX(pos);
|
ImGui::SetCursorPosX(pos);
|
||||||
if (ImGui::SliderInt(CONCAT("##sdrplay_gain", _this->name), &_this->gain, 59, 20, "")) {
|
if (ImGui::SliderInt(CONCAT("##sdrplay_gain", _this->name), &_this->gain, 59, 20, "")) {
|
||||||
_this->openDevParams->rxChannelA->tunerParams.gain.gRdB = _this->gain;
|
_this->openDevParams->rxChannelA->tunerParams.gain.gRdB = _this->gain;
|
||||||
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][_this->selectedName]["ifGain"] = _this->gain;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
if (_this->agc > 0) { style::endDisabled(); }
|
||||||
|
|
||||||
|
ImGui::Text("AGC");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
|
if (ImGui::Combo(CONCAT("##sdrplay_agc", _this->name), &_this->agc, agcModesTxt)) {
|
||||||
|
_this->openDevParams->rxChannelA->ctrlParams.agc.enable = agcModes[_this->agc];
|
||||||
|
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Ctrl_Agc, sdrplay_api_Update_Ext1_None);
|
||||||
|
if (_this->agc == 0) {
|
||||||
|
_this->openDevParams->rxChannelA->tunerParams.gain.gRdB = _this->gain;
|
||||||
|
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
|
||||||
|
}
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][_this->selectedName]["agc"] = _this->agc;
|
||||||
|
config.release(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (_this->openDev.hwVer) {
|
switch (_this->openDev.hwVer) {
|
||||||
case SDRPLAY_RSP1_ID:
|
case SDRPLAY_RSP1_ID:
|
||||||
@ -458,31 +627,53 @@ private:
|
|||||||
if (ImGui::Checkbox(CONCAT("FM Notch##sdrplay_rsp1a_fmnotch", name), &rsp1a_fmNotch)) {
|
if (ImGui::Checkbox(CONCAT("FM Notch##sdrplay_rsp1a_fmnotch", name), &rsp1a_fmNotch)) {
|
||||||
openDevParams->devParams->rsp1aParams.rfNotchEnable = rsp1a_fmNotch;
|
openDevParams->devParams->rsp1aParams.rfNotchEnable = rsp1a_fmNotch;
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp1a_RfNotchControl, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp1a_RfNotchControl, sdrplay_api_Update_Ext1_None);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][selectedName]["fmNotch"] = rsp1a_fmNotch;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
if (ImGui::Checkbox(CONCAT("DAB Notch##sdrplay_rsp1a_dabnotch", name), &rsp1a_dabNotch)) {
|
if (ImGui::Checkbox(CONCAT("DAB Notch##sdrplay_rsp1a_dabnotch", name), &rsp1a_dabNotch)) {
|
||||||
openDevParams->devParams->rsp1aParams.rfNotchEnable = rsp1a_dabNotch;
|
openDevParams->devParams->rsp1aParams.rfNotchEnable = rsp1a_dabNotch;
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp1a_RfDabNotchControl, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp1a_RfDabNotchControl, sdrplay_api_Update_Ext1_None);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][selectedName]["dabNotch"] = rsp1a_dabNotch;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
if (ImGui::Checkbox(CONCAT("Bias-T##sdrplay_rsp1a_biast", name), &rsp1a_biasT)) {
|
if (ImGui::Checkbox(CONCAT("Bias-T##sdrplay_rsp1a_biast", name), &rsp1a_biasT)) {
|
||||||
openDevParams->rxChannelA->rsp1aTunerParams.biasTEnable = rsp1a_biasT;
|
openDevParams->rxChannelA->rsp1aTunerParams.biasTEnable = rsp1a_biasT;
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp1a_BiasTControl, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp1a_BiasTControl, sdrplay_api_Update_Ext1_None);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][selectedName]["biast"] = rsp1a_biasT;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSP2Menu(float menuWidth) {
|
void RSP2Menu(float menuWidth) {
|
||||||
if (ImGui::Checkbox(CONCAT("MW/FM Notch##sdrplay_rsp2_notch", name), &rsp2_notch)) {
|
ImGui::Text("Antenna");
|
||||||
openDevParams->rxChannelA->rsp2TunerParams.rfNotchEnable = rsp2_notch;
|
ImGui::SameLine();
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp2_RfNotchControl, sdrplay_api_Update_Ext1_None);
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
}
|
if (ImGui::Combo(CONCAT("##sdrplay_rsp2_ant", name), &rsp2_antennaPort, rsp2_antennaPortsTxt)) {
|
||||||
if (ImGui::Checkbox(CONCAT("Bias-T##sdrplay_rsp2_biast", name), &rsp2_biasT)) {
|
|
||||||
openDevParams->rxChannelA->rsp2TunerParams.biasTEnable = rsp2_biasT;
|
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp2_BiasTControl, sdrplay_api_Update_Ext1_None);
|
|
||||||
}
|
|
||||||
if (ImGui::Combo(CONCAT("Antenna##sdrplay_rsp2_ant", name), &rsp2_antennaPort, rsp2_antennaPortsTxt)) {
|
|
||||||
openDevParams->rxChannelA->rsp2TunerParams.antennaSel = rsp2_antennaPorts[rsp2_antennaPort];
|
openDevParams->rxChannelA->rsp2TunerParams.antennaSel = rsp2_antennaPorts[rsp2_antennaPort];
|
||||||
openDevParams->rxChannelA->rsp2TunerParams.amPortSel = (rsp2_antennaPort == 2) ? sdrplay_api_Rsp2_AMPORT_1 : sdrplay_api_Rsp2_AMPORT_2;
|
openDevParams->rxChannelA->rsp2TunerParams.amPortSel = (rsp2_antennaPort == 2) ? sdrplay_api_Rsp2_AMPORT_1 : sdrplay_api_Rsp2_AMPORT_2;
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp2_AntennaControl, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp2_AntennaControl, sdrplay_api_Update_Ext1_None);
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp2_AmPortSelect, sdrplay_api_Update_Ext1_None);
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp2_AmPortSelect, sdrplay_api_Update_Ext1_None);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][selectedName]["antenna"] = rsp2_antennaPort;
|
||||||
|
config.release(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Checkbox(CONCAT("MW/FM Notch##sdrplay_rsp2_notch", name), &rsp2_notch)) {
|
||||||
|
openDevParams->rxChannelA->rsp2TunerParams.rfNotchEnable = rsp2_notch;
|
||||||
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp2_RfNotchControl, sdrplay_api_Update_Ext1_None);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][selectedName]["notch"] = rsp2_notch;
|
||||||
|
config.release(true);
|
||||||
|
}
|
||||||
|
if (ImGui::Checkbox(CONCAT("Bias-T##sdrplay_rsp2_biast", name), &rsp2_biasT)) {
|
||||||
|
openDevParams->rxChannelA->rsp2TunerParams.biasTEnable = rsp2_biasT;
|
||||||
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Rsp2_BiasTControl, sdrplay_api_Update_Ext1_None);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][selectedName]["biast"] = rsp2_biasT;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,21 +682,37 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RSPdxMenu(float menuWidth) {
|
void RSPdxMenu(float menuWidth) {
|
||||||
|
ImGui::Text("Antenna");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
|
if (ImGui::Combo(CONCAT("##sdrplay_rspdx_ant", name), &rspdx_antennaPort, rspdx_antennaPortsTxt)) {
|
||||||
|
openDevParams->devParams->rspDxParams.antennaSel = rspdx_antennaPorts[rspdx_antennaPort];
|
||||||
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_None, sdrplay_api_Update_RspDx_AntennaControl);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][selectedName]["antenna"] = rspdx_antennaPort;
|
||||||
|
config.release(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox(CONCAT("FM Notch##sdrplay_rspdx_fmnotch", name), &rspdx_fmNotch)) {
|
if (ImGui::Checkbox(CONCAT("FM Notch##sdrplay_rspdx_fmnotch", name), &rspdx_fmNotch)) {
|
||||||
openDevParams->devParams->rspDxParams.rfNotchEnable = rspdx_fmNotch;
|
openDevParams->devParams->rspDxParams.rfNotchEnable = rspdx_fmNotch;
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_None, sdrplay_api_Update_RspDx_RfNotchControl);
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_None, sdrplay_api_Update_RspDx_RfNotchControl);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][selectedName]["fmNotch"] = rspdx_fmNotch;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
if (ImGui::Checkbox(CONCAT("DAB Notch##sdrplay_rspdx_dabnotch", name), &rspdx_dabNotch)) {
|
if (ImGui::Checkbox(CONCAT("DAB Notch##sdrplay_rspdx_dabnotch", name), &rspdx_dabNotch)) {
|
||||||
openDevParams->devParams->rspDxParams.rfDabNotchEnable = rspdx_dabNotch;
|
openDevParams->devParams->rspDxParams.rfDabNotchEnable = rspdx_dabNotch;
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_None, sdrplay_api_Update_RspDx_RfDabNotchControl);
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_None, sdrplay_api_Update_RspDx_RfDabNotchControl);
|
||||||
|
config.aquire();
|
||||||
|
config.conf["devices"][selectedName]["dabNotch"] = rspdx_dabNotch;
|
||||||
|
config.release(true);
|
||||||
}
|
}
|
||||||
if (ImGui::Checkbox(CONCAT("Bias-T##sdrplay_rspdx_biast", name), &rspdx_biasT)) {
|
if (ImGui::Checkbox(CONCAT("Bias-T##sdrplay_rspdx_biast", name), &rspdx_biasT)) {
|
||||||
openDevParams->devParams->rspDxParams.biasTEnable = rspdx_biasT;
|
openDevParams->devParams->rspDxParams.biasTEnable = rspdx_biasT;
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_None, sdrplay_api_Update_RspDx_BiasTControl);
|
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_None, sdrplay_api_Update_RspDx_BiasTControl);
|
||||||
}
|
config.aquire();
|
||||||
if (ImGui::Combo(CONCAT("Antenna##sdrplay_rspdx_ant", name), &rspdx_antennaPort, rspdx_antennaPortsTxt)) {
|
config.conf["devices"][selectedName]["biast"] = rspdx_biasT;
|
||||||
openDevParams->devParams->rspDxParams.antennaSel = rspdx_antennaPorts[rspdx_antennaPort];
|
config.release(true);
|
||||||
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_None, sdrplay_api_Update_RspDx_AntennaControl);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,6 +764,7 @@ private:
|
|||||||
int lnaGain = 9;
|
int lnaGain = 9;
|
||||||
int gain = 59;
|
int gain = 59;
|
||||||
int lnaSteps = 9;
|
int lnaSteps = 9;
|
||||||
|
int agc = 0;
|
||||||
|
|
||||||
int bufferSize = 0;
|
int bufferSize = 0;
|
||||||
int bufferIndex = 0;
|
int bufferIndex = 0;
|
||||||
@ -582,6 +790,8 @@ private:
|
|||||||
|
|
||||||
std::vector<sdrplay_api_DeviceT> devList;
|
std::vector<sdrplay_api_DeviceT> devList;
|
||||||
std::string devListTxt;
|
std::string devListTxt;
|
||||||
|
std::vector<std::string> devNameList;
|
||||||
|
std::string selectedName;
|
||||||
};
|
};
|
||||||
|
|
||||||
MOD_EXPORT void _INIT_() {
|
MOD_EXPORT void _INIT_() {
|
||||||
|
Loading…
Reference in New Issue
Block a user