fixed limesdr antenna not set on startup and worked around limesuite bug

pull/814/head
AlexandreRouma 2022-07-16 02:36:03 +02:00
rodzic 25f09a355e
commit 277d399e48
1 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -323,12 +323,20 @@ private:
// Open device
_this->openDev = NULL;
LMS_Open(&_this->openDev, _this->devList[_this->devId], NULL);
LMS_Init(_this->openDev);
int err = LMS_Init(_this->openDev);
// On open fail, retry (work around for LimeSuite bug)
if (err) {
LMS_Close(_this->openDev);
LMS_Open(&_this->openDev, _this->devList[_this->devId], NULL);
LMS_Init(_this->openDev);
}
spdlog::warn("Channel count: {0}", LMS_GetNumChannels(_this->openDev, false));
// Set options
LMS_EnableChannel(_this->openDev, false, _this->chanId, true);
LMS_SetAntenna(_this->openDev, false, _this->chanId, _this->antennaId);
LMS_SetSampleRate(_this->openDev, _this->sampleRate, 0);
LMS_SetLOFrequency(_this->openDev, false, _this->chanId, _this->freq);
LMS_SetGaindB(_this->openDev, false, _this->chanId, _this->gain);
@ -364,6 +372,7 @@ private:
LMS_StopStream(&_this->devStream);
LMS_DestroyStream(_this->openDev, &_this->devStream);
LMS_EnableChannel(_this->openDev, false, _this->chanId, false);
LMS_Close(_this->openDev);