mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-02-04 13:54:43 +01:00
Merge branch 'AlexandreRouma:master' into master
This commit is contained in:
commit
dcda74c0cf
@ -37,6 +37,32 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const char* OPENGL_VERSIONS_GLSL[] = {
|
||||
"#version 120",
|
||||
"#version 300 es",
|
||||
"#version 120"
|
||||
};
|
||||
|
||||
const int OPENGL_VERSIONS_MAJOR[] = {
|
||||
3,
|
||||
3,
|
||||
2
|
||||
};
|
||||
|
||||
const int OPENGL_VERSIONS_MINOR[] = {
|
||||
0,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
const bool OPENGL_VERSIONS_IS_ES[] = {
|
||||
false,
|
||||
true,
|
||||
false
|
||||
};
|
||||
|
||||
#define OPENGL_VERSION_COUNT (sizeof(OPENGL_VERSIONS_GLSL) / sizeof(char*))
|
||||
|
||||
namespace core {
|
||||
ConfigManager configManager;
|
||||
ModuleManager moduleManager;
|
||||
@ -258,26 +284,6 @@ int sdrpp_main(int argc, char *argv[]) {
|
||||
|
||||
if (options::opts.serverMode) { return server_main(); }
|
||||
|
||||
// Setup window
|
||||
glfwSetErrorCallback(glfw_error_callback);
|
||||
if (!glfwInit()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// GL 3.2 + GLSL 150
|
||||
const char* glsl_version = "#version 150";
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac
|
||||
#else
|
||||
// GL 3.0 + GLSL 120
|
||||
const char* glsl_version = "#version 120";
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
#endif
|
||||
|
||||
core::configManager.acquire();
|
||||
int winWidth = core::configManager.conf["windowSize"]["w"];
|
||||
int winHeight = core::configManager.conf["windowSize"]["h"];
|
||||
@ -291,13 +297,51 @@ int sdrpp_main(int argc, char *argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Setup window
|
||||
glfwSetErrorCallback(glfw_error_callback);
|
||||
if (!glfwInit()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// GL 3.2 + GLSL 150
|
||||
const char* glsl_version = "#version 150";
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac
|
||||
|
||||
// Create window with graphics context
|
||||
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
||||
core::window = glfwCreateWindow(winWidth, winHeight, "SDR++ v" VERSION_STR " (Built at " __TIME__ ", " __DATE__ ")", NULL, NULL);
|
||||
if (core::window == NULL)
|
||||
return 1;
|
||||
glfwMakeContextCurrent(core::window);
|
||||
#else
|
||||
const char* glsl_version = "#version 120";
|
||||
GLFWmonitor* monitor = NULL;
|
||||
for (int i = 0; i < OPENGL_VERSION_COUNT; i++) {
|
||||
glsl_version = OPENGL_VERSIONS_GLSL[i];
|
||||
glfwWindowHint(GLFW_CLIENT_API, OPENGL_VERSIONS_IS_ES[i] ? GLFW_OPENGL_ES_API : GLFW_OPENGL_API);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, OPENGL_VERSIONS_MAJOR[i]);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, OPENGL_VERSIONS_MINOR[i]);
|
||||
|
||||
// Create window with graphics context
|
||||
monitor = glfwGetPrimaryMonitor();
|
||||
core::window = glfwCreateWindow(winWidth, winHeight, "SDR++ v" VERSION_STR " (Built at " __TIME__ ", " __DATE__ ")", NULL, NULL);
|
||||
if (core::window == NULL) {
|
||||
spdlog::info("OpenGL {0}.{1} {2}was not supported", OPENGL_VERSIONS_MAJOR[i], OPENGL_VERSIONS_MINOR[i], OPENGL_VERSIONS_IS_ES[i] ? "ES ": "");
|
||||
continue;
|
||||
}
|
||||
spdlog::info("Using OpenGL {0}.{1}{2}", OPENGL_VERSIONS_MAJOR[i], OPENGL_VERSIONS_MINOR[i], OPENGL_VERSIONS_IS_ES[i] ? " ES": "");
|
||||
glfwMakeContextCurrent(core::window);
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Add callback for max/min if GLFW supports it
|
||||
#if (GLFW_VERSION_MAJOR == 3) && (GLFW_VERSION_MINOR >= 3)
|
||||
if (maximized) {
|
||||
glfwMaximizeWindow(core::window);
|
||||
|
@ -322,6 +322,7 @@ namespace ImGui {
|
||||
}
|
||||
hzDist = std::clamp<double>(hzDist, relatedVfo->minBandwidth, relatedVfo->maxBandwidth);
|
||||
relatedVfo->setBandwidth(hzDist);
|
||||
relatedVfo->onUserChangedBandwidth.emit(hzDist);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,8 @@ namespace ImGui {
|
||||
bool bandwidthLocked;
|
||||
|
||||
ImU32 color = IM_COL32(255, 255, 255, 50);
|
||||
|
||||
Event<double> onUserChangedBandwidth;
|
||||
};
|
||||
|
||||
class WaterFall {
|
||||
|
@ -30,10 +30,11 @@ public:
|
||||
|
||||
friend class VFOManager;
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
dsp::VFO* dspVFO;
|
||||
ImGui::WaterfallVFO* wtfVFO;
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
|
||||
};
|
||||
|
||||
|
@ -371,6 +371,18 @@ namespace net {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
// Allow port reusing if the app was killed or crashed
|
||||
// and the socket is stuck in TIME_WAIT state.
|
||||
// This option has a different meaning on Windows,
|
||||
// so we use it only for non-Windows systems
|
||||
int enable = 1;
|
||||
if (setsockopt(listenSock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof (int)) < 0) {
|
||||
throw std::runtime_error("Could not configure socket");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get address from hostname/ip
|
||||
hostent* remoteHost = gethostbyname(host.c_str());
|
||||
if (remoteHost == NULL || remoteHost->h_addr_list[0] == NULL) {
|
||||
|
@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_STR "1.0.3"
|
||||
#define VERSION_STR "1.0.4"
|
@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
|
||||
make -j2
|
||||
|
||||
cd ..
|
||||
sh make_debian_package.sh ./build
|
||||
sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev
|
@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUIL
|
||||
make -j2
|
||||
|
||||
cd ..
|
||||
sh make_debian_package.sh ./build
|
||||
sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk1-dev
|
@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
|
||||
make -j2
|
||||
|
||||
cd ..
|
||||
sh make_debian_package.sh ./build
|
||||
sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev
|
@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
|
||||
make -j2
|
||||
|
||||
cd ..
|
||||
sh make_debian_package.sh ./build
|
||||
sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev
|
@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
|
||||
make -j2
|
||||
|
||||
cd ..
|
||||
sh make_debian_package.sh ./build
|
||||
sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev
|
@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
|
||||
make -j2
|
||||
|
||||
cd ..
|
||||
sh make_debian_package.sh ./build
|
||||
sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev
|
@ -8,10 +8,11 @@ mkdir sdrpp_debian_amd64/DEBIAN
|
||||
# Create package info
|
||||
echo Create package info
|
||||
echo Package: sdrpp >> sdrpp_debian_amd64/DEBIAN/control
|
||||
echo Version: 0.2.5$BUILD_NO >> sdrpp_debian_amd64/DEBIAN/control
|
||||
echo Version: 1.0.4$BUILD_NO >> sdrpp_debian_amd64/DEBIAN/control
|
||||
echo Maintainer: Ryzerth >> sdrpp_debian_amd64/DEBIAN/control
|
||||
echo Architecture: all >> sdrpp_debian_amd64/DEBIAN/control
|
||||
echo Description: Bloat-free SDR receiver software >> sdrpp_debian_amd64/DEBIAN/control
|
||||
echo Depends: $2 >> sdrpp_debian_amd64/DEBIAN/control
|
||||
|
||||
# Copying files
|
||||
ORIG_DIR=$PWD
|
||||
|
@ -55,6 +55,11 @@ public:
|
||||
resamp.updateWindow(&win);
|
||||
|
||||
m2s.init(&resamp.out);
|
||||
|
||||
onUserChangedBandwidthHandler.handler = vfoUserChangedBandwidthHandler;
|
||||
onUserChangedBandwidthHandler.ctx = this;
|
||||
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
void start() {
|
||||
@ -89,6 +94,7 @@ public:
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
squelch.setInput(_vfo->output);
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -130,15 +136,6 @@ public:
|
||||
_config->conf[uiPrefix]["AM"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
if (running) {
|
||||
if (_vfo->getBandwidthChanged()) {
|
||||
bw = _vfo->getBandwidth();
|
||||
setBandwidth(bw, false);
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["AM"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Snap Interval");
|
||||
ImGui::SameLine();
|
||||
@ -160,7 +157,18 @@ public:
|
||||
_config->conf[uiPrefix]["AM"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void vfoUserChangedBandwidthHandler(double newBw, void* ctx) {
|
||||
AMDemodulator* _this = (AMDemodulator*)ctx;
|
||||
if (_this->running) {
|
||||
_this->bw = newBw;
|
||||
_this->setBandwidth(_this->bw, false);
|
||||
_this->_config->acquire();
|
||||
_this->_config->conf[_this->uiPrefix]["AM"]["bandwidth"] = _this->bw;
|
||||
_this->_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
|
||||
bandWidth = std::clamp<float>(bandWidth, bwMin, bwMax);
|
||||
@ -175,9 +183,9 @@ public:
|
||||
|
||||
void saveParameters(bool lock = true) {
|
||||
if (lock) { _config->acquire(); }
|
||||
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["WFM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
|
||||
_config->conf[uiPrefix]["AM"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["AM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["AM"]["squelchLevel"] = squelchLevel;
|
||||
if (lock) { _config->release(true); }
|
||||
}
|
||||
|
||||
@ -208,4 +216,6 @@ private:
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
EventHandler<double> onUserChangedBandwidthHandler;
|
||||
|
||||
};
|
@ -57,6 +57,11 @@ public:
|
||||
resamp.updateWindow(&win);
|
||||
|
||||
m2s.init(&resamp.out);
|
||||
|
||||
onUserChangedBandwidthHandler.handler = vfoUserChangedBandwidthHandler;
|
||||
onUserChangedBandwidthHandler.ctx = this;
|
||||
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
void start() {
|
||||
@ -93,6 +98,7 @@ public:
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
squelch.setInput(_vfo->output);
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -133,14 +139,6 @@ public:
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["CW"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}if (running) {
|
||||
if (_vfo->getBandwidthChanged()) {
|
||||
bw = _vfo->getBandwidth();
|
||||
setBandwidth(bw, false);
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["CW"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Snap Interval");
|
||||
@ -163,7 +161,18 @@ public:
|
||||
_config->conf[uiPrefix]["CW"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void vfoUserChangedBandwidthHandler(double newBw, void* ctx) {
|
||||
CWDemodulator* _this = (CWDemodulator*)ctx;
|
||||
if (_this->running) {
|
||||
_this->bw = newBw;
|
||||
_this->setBandwidth(_this->bw, false);
|
||||
_this->_config->acquire();
|
||||
_this->_config->conf[_this->uiPrefix]["CW"]["bandwidth"] = _this->bw;
|
||||
_this->_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
|
||||
bandWidth = std::clamp<float>(bandWidth, bwMin, bwMax);
|
||||
@ -178,9 +187,9 @@ public:
|
||||
|
||||
void saveParameters(bool lock = true) {
|
||||
if (lock) { _config->acquire(); }
|
||||
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["WFM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
|
||||
_config->conf[uiPrefix]["CW"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["CW"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["CW"]["squelchLevel"] = squelchLevel;
|
||||
if (lock) { _config->release(true); }
|
||||
}
|
||||
|
||||
@ -212,4 +221,6 @@ private:
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
EventHandler<double> onUserChangedBandwidthHandler;
|
||||
|
||||
};
|
@ -55,6 +55,11 @@ public:
|
||||
resamp.updateWindow(&win);
|
||||
|
||||
m2s.init(&resamp.out);
|
||||
|
||||
onUserChangedBandwidthHandler.handler = vfoUserChangedBandwidthHandler;
|
||||
onUserChangedBandwidthHandler.ctx = this;
|
||||
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
void start() {
|
||||
@ -89,6 +94,7 @@ public:
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
squelch.setInput(_vfo->output);
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -130,15 +136,6 @@ public:
|
||||
_config->conf[uiPrefix]["DSB"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
if (running) {
|
||||
if (_vfo->getBandwidthChanged()) {
|
||||
bw = _vfo->getBandwidth();
|
||||
setBandwidth(bw, false);
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["DSB"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Snap Interval");
|
||||
ImGui::SameLine();
|
||||
@ -160,7 +157,18 @@ public:
|
||||
_config->conf[uiPrefix]["DSB"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void vfoUserChangedBandwidthHandler(double newBw, void* ctx) {
|
||||
DSBDemodulator* _this = (DSBDemodulator*)ctx;
|
||||
if (_this->running) {
|
||||
_this->bw = newBw;
|
||||
_this->setBandwidth(_this->bw, false);
|
||||
_this->_config->acquire();
|
||||
_this->_config->conf[_this->uiPrefix]["DSB"]["bandwidth"] = _this->bw;
|
||||
_this->_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
|
||||
bandWidth = std::clamp<float>(bandWidth, bwMin, bwMax);
|
||||
@ -170,9 +178,9 @@ public:
|
||||
|
||||
void saveParameters(bool lock = true) {
|
||||
if (lock) { _config->acquire(); }
|
||||
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["WFM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
|
||||
_config->conf[uiPrefix]["DSB"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["DSB"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["DSB"]["squelchLevel"] = squelchLevel;
|
||||
if (lock) { _config->release(true); }
|
||||
}
|
||||
|
||||
@ -203,4 +211,6 @@ private:
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
EventHandler<double> onUserChangedBandwidthHandler;
|
||||
|
||||
};
|
@ -51,6 +51,11 @@ public:
|
||||
resamp.init(&demod.out, &win, bbSampRate, audioSampRate);
|
||||
win.setSampleRate(bbSampRate * resamp.getInterpolation());
|
||||
resamp.updateWindow(&win);
|
||||
|
||||
onUserChangedBandwidthHandler.handler = vfoUserChangedBandwidthHandler;
|
||||
onUserChangedBandwidthHandler.ctx = this;
|
||||
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
void start() {
|
||||
@ -81,6 +86,7 @@ public:
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
squelch.setInput(_vfo->output);
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -122,15 +128,6 @@ public:
|
||||
_config->conf[uiPrefix]["FM"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
if (running) {
|
||||
if (_vfo->getBandwidthChanged()) {
|
||||
bw = _vfo->getBandwidth();
|
||||
setBandwidth(bw, false);
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["FM"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Snap Interval");
|
||||
ImGui::SameLine();
|
||||
@ -152,7 +149,18 @@ public:
|
||||
_config->conf[uiPrefix]["FM"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void vfoUserChangedBandwidthHandler(double newBw, void* ctx) {
|
||||
FMDemodulator* _this = (FMDemodulator*)ctx;
|
||||
if (_this->running) {
|
||||
_this->bw = newBw;
|
||||
_this->setBandwidth(_this->bw, false);
|
||||
_this->_config->acquire();
|
||||
_this->_config->conf[_this->uiPrefix]["FM"]["bandwidth"] = _this->bw;
|
||||
_this->_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
|
||||
bandWidth = std::clamp<float>(bandWidth, bwMin, bwMax);
|
||||
@ -164,9 +172,9 @@ public:
|
||||
|
||||
void saveParameters(bool lock = true) {
|
||||
if (lock) { _config->acquire(); }
|
||||
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["WFM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
|
||||
_config->conf[uiPrefix]["FM"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["FM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["FM"]["squelchLevel"] = squelchLevel;
|
||||
if (lock) { _config->release(true); }
|
||||
}
|
||||
|
||||
@ -195,4 +203,6 @@ private:
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
EventHandler<double> onUserChangedBandwidthHandler;
|
||||
|
||||
};
|
@ -55,6 +55,11 @@ public:
|
||||
resamp.updateWindow(&win);
|
||||
|
||||
m2s.init(&resamp.out);
|
||||
|
||||
onUserChangedBandwidthHandler.handler = vfoUserChangedBandwidthHandler;
|
||||
onUserChangedBandwidthHandler.ctx = this;
|
||||
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
void start() {
|
||||
@ -89,6 +94,7 @@ public:
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
squelch.setInput(_vfo->output);
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -129,14 +135,6 @@ public:
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["LSB"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}if (running) {
|
||||
if (_vfo->getBandwidthChanged()) {
|
||||
bw = _vfo->getBandwidth();
|
||||
setBandwidth(bw, false);
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["LSB"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Snap Interval");
|
||||
@ -159,7 +157,18 @@ public:
|
||||
_config->conf[uiPrefix]["LSB"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void vfoUserChangedBandwidthHandler(double newBw, void* ctx) {
|
||||
LSBDemodulator* _this = (LSBDemodulator*)ctx;
|
||||
if (_this->running) {
|
||||
_this->bw = newBw;
|
||||
_this->setBandwidth(_this->bw, false);
|
||||
_this->_config->acquire();
|
||||
_this->_config->conf[_this->uiPrefix]["LSB"]["bandwidth"] = _this->bw;
|
||||
_this->_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
|
||||
bandWidth = std::clamp<float>(bandWidth, bwMin, bwMax);
|
||||
@ -175,9 +184,9 @@ public:
|
||||
|
||||
void saveParameters(bool lock = true) {
|
||||
if (lock) { _config->acquire(); }
|
||||
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["WFM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
|
||||
_config->conf[uiPrefix]["LSB"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["LSB"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["LSB"]["squelchLevel"] = squelchLevel;
|
||||
if (lock) { _config->release(true); }
|
||||
}
|
||||
|
||||
@ -208,4 +217,6 @@ private:
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
EventHandler<double> onUserChangedBandwidthHandler;
|
||||
|
||||
};
|
@ -120,8 +120,8 @@ public:
|
||||
|
||||
void saveParameters(bool lock = true) {
|
||||
if (lock) { _config->acquire(); }
|
||||
_config->conf[uiPrefix]["WFM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
|
||||
_config->conf[uiPrefix]["RAW"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["RAW"]["squelchLevel"] = squelchLevel;
|
||||
if (lock) { _config->release(true); }
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,11 @@ public:
|
||||
resamp.updateWindow(&win);
|
||||
|
||||
m2s.init(&resamp.out);
|
||||
|
||||
onUserChangedBandwidthHandler.handler = vfoUserChangedBandwidthHandler;
|
||||
onUserChangedBandwidthHandler.ctx = this;
|
||||
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
void start() {
|
||||
@ -89,6 +94,7 @@ public:
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
squelch.setInput(_vfo->output);
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -129,14 +135,6 @@ public:
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["USB"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}if (running) {
|
||||
if (_vfo->getBandwidthChanged()) {
|
||||
bw = _vfo->getBandwidth();
|
||||
setBandwidth(bw, false);
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["USB"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Snap Interval");
|
||||
@ -159,7 +157,18 @@ public:
|
||||
_config->conf[uiPrefix]["USB"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void vfoUserChangedBandwidthHandler(double newBw, void* ctx) {
|
||||
USBDemodulator* _this = (USBDemodulator*)ctx;
|
||||
if (_this->running) {
|
||||
_this->bw = newBw;
|
||||
_this->setBandwidth(_this->bw, false);
|
||||
_this->_config->acquire();
|
||||
_this->_config->conf[_this->uiPrefix]["USB"]["bandwidth"] = _this->bw;
|
||||
_this->_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
|
||||
bandWidth = std::clamp<float>(bandWidth, bwMin, bwMax);
|
||||
@ -175,9 +184,9 @@ public:
|
||||
|
||||
void saveParameters(bool lock = true) {
|
||||
if (lock) { _config->acquire(); }
|
||||
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["WFM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
|
||||
_config->conf[uiPrefix]["USB"]["bandwidth"] = bw;
|
||||
_config->conf[uiPrefix]["USB"]["snapInterval"] = snapInterval;
|
||||
_config->conf[uiPrefix]["USB"]["squelchLevel"] = squelchLevel;
|
||||
if (lock) { _config->release(true); }
|
||||
}
|
||||
|
||||
@ -208,4 +217,6 @@ private:
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
EventHandler<double> onUserChangedBandwidthHandler;
|
||||
|
||||
};
|
@ -72,6 +72,10 @@ public:
|
||||
|
||||
if (deempId == 2) { deemp.bypass = true; }
|
||||
|
||||
onUserChangedBandwidthHandler.handler = vfoUserChangedBandwidthHandler;
|
||||
onUserChangedBandwidthHandler.ctx = this;
|
||||
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
void start() {
|
||||
@ -114,6 +118,7 @@ public:
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
squelch.setInput(_vfo->output);
|
||||
_vfo->wtfVFO->onUserChangedBandwidth.bindHandler(&onUserChangedBandwidthHandler);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -158,15 +163,6 @@ public:
|
||||
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
if (running) {
|
||||
if (_vfo->getBandwidthChanged()) {
|
||||
bw = _vfo->getBandwidth();
|
||||
setBandwidth(bw, false);
|
||||
_config->acquire();
|
||||
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Snap Interval");
|
||||
ImGui::SameLine();
|
||||
@ -208,6 +204,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void vfoUserChangedBandwidthHandler(double newBw, void* ctx) {
|
||||
WFMDemodulator* _this = (WFMDemodulator*)ctx;
|
||||
if (_this->running) {
|
||||
_this->bw = newBw;
|
||||
_this->setBandwidth(_this->bw, false);
|
||||
_this->_config->acquire();
|
||||
_this->_config->conf[_this->uiPrefix]["WFM"]["bandwidth"] = _this->bw;
|
||||
_this->_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setDeempIndex(int id) {
|
||||
if (id >= 2 || id < 0) {
|
||||
deemp.bypass = true;
|
||||
@ -286,4 +293,6 @@ private:
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
EventHandler<double> onUserChangedBandwidthHandler;
|
||||
|
||||
};
|
@ -427,20 +427,22 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
// if number of arguments isn't correct or the VFO is not "VFO", return error
|
||||
// if number of arguments isn't correct, return error
|
||||
if (parts.size() != 3) {
|
||||
resp = "RPRT 1\n";
|
||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that the bandwidth is an integer
|
||||
// Check that the bandwidth is an integer (0 or -1 for default bandwidth)
|
||||
int pos = 0;
|
||||
for (char c : parts[2]) {
|
||||
if (!std::isdigit(c)) {
|
||||
if (!std::isdigit(c) && !(c == '-' && !pos)) {
|
||||
resp = "RPRT 1\n";
|
||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||
return;
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
||||
float newBandwidth = std::atoi(parts[2].c_str());
|
||||
@ -479,7 +481,7 @@ private:
|
||||
// If tuning is enabled, set the mode and optionally the bandwidth
|
||||
if (!selectedVfo.empty() && core::modComManager.getModuleName(selectedVfo) == "radio" && tuningEnabled) {
|
||||
core::modComManager.callInterface(selectedVfo, RADIO_IFACE_CMD_SET_MODE, &newMode, NULL);
|
||||
if (newBandwidth) {
|
||||
if (newBandwidth > 0) {
|
||||
core::modComManager.callInterface(selectedVfo, RADIO_IFACE_CMD_SET_BANDWIDTH, &newBandwidth, NULL);
|
||||
}
|
||||
}
|
||||
@ -488,32 +490,32 @@ private:
|
||||
}
|
||||
else if (parts[0] == "m" || parts[0] == "\\get_mode") {
|
||||
std::lock_guard lck(vfoMtx);
|
||||
resp = "RAW ";
|
||||
resp = "RAW\n";
|
||||
|
||||
if (!selectedVfo.empty() && core::modComManager.getModuleName(selectedVfo) == "radio") {
|
||||
int mode;
|
||||
core::modComManager.callInterface(selectedVfo, RADIO_IFACE_CMD_GET_MODE, NULL, &mode);
|
||||
|
||||
if (mode == RADIO_IFACE_MODE_NFM) {
|
||||
resp = "FM ";
|
||||
resp = "FM\n";
|
||||
}
|
||||
else if (mode == RADIO_IFACE_MODE_WFM) {
|
||||
resp = "WFM ";
|
||||
resp = "WFM\n";
|
||||
}
|
||||
else if (mode == RADIO_IFACE_MODE_AM) {
|
||||
resp = "AM ";
|
||||
resp = "AM\n";
|
||||
}
|
||||
else if (mode == RADIO_IFACE_MODE_DSB) {
|
||||
resp = "DSB ";
|
||||
resp = "DSB\n";
|
||||
}
|
||||
else if (mode == RADIO_IFACE_MODE_USB) {
|
||||
resp = "USB ";
|
||||
resp = "USB\n";
|
||||
}
|
||||
else if (mode == RADIO_IFACE_MODE_CW) {
|
||||
resp = "CW ";
|
||||
resp = "CW\n";
|
||||
}
|
||||
else if (mode == RADIO_IFACE_MODE_LSB) {
|
||||
resp = "LSB ";
|
||||
resp = "LSB\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -551,6 +553,21 @@ private:
|
||||
resp = "VFO\n";
|
||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||
}
|
||||
else if (parts[0] == "\\chk_vfo") {
|
||||
std::lock_guard lck(vfoMtx);
|
||||
resp = "CHKVFO 0\n";
|
||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||
}
|
||||
else if (parts[0] == "s") {
|
||||
std::lock_guard lck(vfoMtx);
|
||||
resp = "0\nVFOA\n";
|
||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||
}
|
||||
else if (parts[0] == "S") {
|
||||
std::lock_guard lck(vfoMtx);
|
||||
resp = "RPRT 0\n";
|
||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||
}
|
||||
else if (parts[0] == "AOS" || parts[0] == "\\recorder_start") {
|
||||
std::lock_guard lck(recorderMtx);
|
||||
|
||||
@ -591,13 +608,85 @@ private:
|
||||
core::modComManager.callInterface(selectedRecorder, RECORDER_IFACE_CMD_STOP, NULL, NULL);
|
||||
}
|
||||
|
||||
// Respond with a sucess
|
||||
// Respond with a success
|
||||
resp = "RPRT 0\n";
|
||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||
}
|
||||
else if (parts[0] == "q" || parts[0] == "\\quit") {
|
||||
// Will close automatically
|
||||
}
|
||||
else if (parts[0] == "\\dump_state") {
|
||||
std::lock_guard lck(vfoMtx);
|
||||
resp =
|
||||
/* rigctl protocol version */
|
||||
"0\n"
|
||||
/* rigctl model */
|
||||
"2\n"
|
||||
/* ITU region */
|
||||
"1\n"
|
||||
/* RX/TX frequency ranges
|
||||
* start, end, modes, low_power, high_power, vfo, ant
|
||||
* start/end - Start/End frequency [Hz]
|
||||
* modes - Bit field of RIG_MODE's (AM|AMS|CW|CWR|USB|LSB|FM|WFM)
|
||||
* low_power/high_power - Lower/Higher RF power in mW,
|
||||
* -1 for no power (ie. rx list)
|
||||
* vfo - VFO list equipped with this range (RIG_VFO_A)
|
||||
* ant - Antenna list equipped with this range, 0 means all
|
||||
* FIXME: get limits from receiver
|
||||
*/
|
||||
"0.000000 10000000000.000000 0x2ef -1 -1 0x1 0x0\n"
|
||||
/* End of RX frequency ranges. */
|
||||
"0 0 0 0 0 0 0\n"
|
||||
/* End of TX frequency ranges. The SDR++ is reciver only. */
|
||||
"0 0 0 0 0 0 0\n"
|
||||
/* Tuning steps: modes, tuning_step */
|
||||
"0xef 1\n"
|
||||
"0xef 0\n"
|
||||
/* End of tuning steps */
|
||||
"0 0\n"
|
||||
/* Filter sizes: modes, width
|
||||
* FIXME: get filter sizes from presets
|
||||
*/
|
||||
"0x82 500\n" /* CW | CWR normal */
|
||||
"0x82 200\n" /* CW | CWR narrow */
|
||||
"0x82 2000\n" /* CW | CWR wide */
|
||||
"0x221 10000\n" /* AM | AMS | FM normal */
|
||||
"0x221 5000\n" /* AM | AMS | FM narrow */
|
||||
"0x221 20000\n" /* AM | AMS | FM wide */
|
||||
"0x0c 2700\n" /* SSB normal */
|
||||
"0x0c 1400\n" /* SSB narrow */
|
||||
"0x0c 3900\n" /* SSB wide */
|
||||
"0x40 160000\n" /* WFM normal */
|
||||
"0x40 120000\n" /* WFM narrow */
|
||||
"0x40 200000\n" /* WFM wide */
|
||||
/* End of filter sizes */
|
||||
"0 0\n"
|
||||
/* max_rit */
|
||||
"0\n"
|
||||
/* max_xit */
|
||||
"0\n"
|
||||
/* max_ifshift */
|
||||
"0\n"
|
||||
/* Announces (bit field list) */
|
||||
"0\n" /* RIG_ANN_NONE */
|
||||
/* Preamp list in dB, 0 terminated */
|
||||
"0\n"
|
||||
/* Attenuator list in dB, 0 terminated */
|
||||
"0\n"
|
||||
/* Bit field list of get functions */
|
||||
"0\n" /* RIG_FUNC_NONE */
|
||||
/* Bit field list of set functions */
|
||||
"0\n" /* RIG_FUNC_NONE */
|
||||
/* Bit field list of get level */
|
||||
"0x40000020\n" /* RIG_LEVEL_SQL | RIG_LEVEL_STRENGTH */
|
||||
/* Bit field list of set level */
|
||||
"0x20\n" /* RIG_LEVEL_SQL */
|
||||
/* Bit field list of get parm */
|
||||
"0\n" /* RIG_PARM_NONE */
|
||||
/* Bit field list of set parm */
|
||||
"0\n" /* RIG_PARM_NONE */;
|
||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||
}
|
||||
else {
|
||||
// If command is not recognized, return error
|
||||
spdlog::error("Rigctl client sent invalid command: '{0}'", cmd);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Grey",
|
||||
"author": "Paul (PD0SWL)",
|
||||
"name": "Marine Grey",
|
||||
"author": "PD0SWL",
|
||||
"Border": "#6D6D7F7F",
|
||||
"BorderShadow": "#00000000",
|
||||
"Button": "#00000066",
|
||||
@ -10,11 +10,11 @@
|
||||
"ChildBg": "#FFFFFF00",
|
||||
"DragDropTarget": "#0000FFE5",
|
||||
"FrameBg": "#33353889",
|
||||
"FrameBgActive": "#00000089",
|
||||
"FrameBgHovered": "#00000089",
|
||||
"FrameBgActive": "#70707089",
|
||||
"FrameBgHovered": "#70707089",
|
||||
"Header": "#5E5E4C4F",
|
||||
"HeaderActive": "#5E5E4C4F",
|
||||
"HeaderHovered": "#5E5E4C66",
|
||||
"HeaderHovered": "#70707089",
|
||||
"MenuBarBg": "#232323FF",
|
||||
"ModalWindowDimBg": "#33333359",
|
||||
"NavHighlight": "#666666FF",
|
||||
|
Loading…
x
Reference in New Issue
Block a user