mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-23 16:34:43 +01:00
Fixed SoapySDR trying to set gain on no device
This commit is contained in:
parent
19e07eb767
commit
03dc5d2042
@ -7,8 +7,8 @@ if (MSVC)
|
||||
include_directories(sdrpp "C:/Program Files/PothosSDR/include/volk/")
|
||||
include_directories(sdrpp "C:/Program Files/PothosSDR/include/")
|
||||
else()
|
||||
# set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpremissive -fsanitize=address -g")
|
||||
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpremissive")
|
||||
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive -fsanitize=address -g")
|
||||
# set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive")
|
||||
include_directories(sdrpp "/usr/include/volk")
|
||||
link_libraries(pthread)
|
||||
link_libraries(GL)
|
||||
|
@ -15,6 +15,7 @@ namespace io {
|
||||
currentGains = new float[1];
|
||||
refresh();
|
||||
if (devList.size() == 0) {
|
||||
dev = NULL;
|
||||
return;
|
||||
}
|
||||
setDevice(devList[0]);
|
||||
@ -96,7 +97,7 @@ namespace io {
|
||||
}
|
||||
|
||||
void setSampleRate(float sampleRate) {
|
||||
if (running) {
|
||||
if (running || dev == NULL) {
|
||||
return;
|
||||
}
|
||||
_sampleRate = sampleRate;
|
||||
@ -104,10 +105,16 @@ namespace io {
|
||||
}
|
||||
|
||||
void setFrequency(float freq) {
|
||||
if (dev == NULL) {
|
||||
return;
|
||||
}
|
||||
dev->setFrequency(SOAPY_SDR_RX, 0, freq);
|
||||
}
|
||||
|
||||
void setGain(int gainId, float gain) {
|
||||
if (dev == NULL) {
|
||||
return;
|
||||
}
|
||||
currentGains[gainId] = gain;
|
||||
dev->setGain(SOAPY_SDR_RX, 0, gainList[gainId], gain);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user