Skip to content

Commit

Permalink
fix sdrplay configuration bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreRouma committed Dec 18, 2024
1 parent 895199a commit c266a37
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions source_modules/sdrplay_source/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,34 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
lnaSteps = 28;
}

// Select default settings
srId = 0;
sampleRate = samplerates.value(0);
bandwidthId = 8;
lnaGain = lnaSteps - 1;
gain = 59;
agc = false;
agcAttack = 500;
agcDecay = 500;
agcDecayDelay = 200;
agcDecayThreshold = 5;
agcSetPoint = -30;
ifModeId = 0;
rsp1a_fmmwNotch = false;
rsp2_fmmwNotch = false;
rspdx_fmmwNotch = false;
rspduo_fmmwNotch = false;
rsp1a_dabNotch = false;
rspdx_dabNotch = false;
rspduo_dabNotch = false;
rsp1a_biasT = false;
rsp2_biasT = false;
rspdx_biasT = false;
rspduo_biasT = false;
rsp2_antennaPort = 0;
rspdx_antennaPort = 0;
rspduo_antennaPort = 0;

config.acquire();

// General options
Expand Down Expand Up @@ -678,12 +706,26 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
}
else {
config.acquire();
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];
// Reload samplerate
if (config.conf["devices"][_this->selectedName].contains("samplerate")) {
int sr = config.conf["devices"][_this->selectedName]["samplerate"];
if (_this->samplerates.keyExists(sr)) {
_this->srId = _this->samplerates.keyId(sr);
}
}
else {
_this->srId = 0;
}
_this->bandwidthId = config.conf["devices"][_this->selectedName]["bwMode"];

// Reload bandwidth
if (config.conf["devices"][_this->selectedName].contains("bwMode")) {
_this->bandwidthId = config.conf["devices"][_this->selectedName]["bwMode"];
}
else {
// Auto
_this->bandwidthId = 8;
}
_this->sampleRate = _this->samplerates[_this->srId];
config.release();
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : _this->bandwidths[_this->bandwidthId];
}
Expand Down Expand Up @@ -1085,7 +1127,7 @@ class SDRPlaySourceModule : public ModuleManager::Instance {
sdrplay_api_RxChannelParamsT* channelParams;

sdrplay_api_Bw_MHzT bandwidth;
int bandwidthId = 0;
int bandwidthId = 8; // Auto

int devId = 0;
int srId = 0;
Expand Down

0 comments on commit c266a37

Please sign in to comment.