mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-09 02:25:24 +02:00
Compare commits
14 Commits
5ab3428b90
...
new_rigctl
Author | SHA1 | Date | |
---|---|---|---|
711ed7711f | |||
a8e6f24b29 | |||
b914587228 | |||
3c1d0c7422 | |||
11f87e0fe2 | |||
e192cb963b | |||
fe407a2f27 | |||
6891d0bb0f | |||
b835d07573 | |||
f205d97b52 | |||
628dcfcce0 | |||
d1e7cc56b4 | |||
334860c963 | |||
69161253e8 |
@ -147,12 +147,12 @@ int sdrpp_main(int argc, char* argv[]) {
|
|||||||
defConfig["menuElements"][3]["name"] = "Sinks";
|
defConfig["menuElements"][3]["name"] = "Sinks";
|
||||||
defConfig["menuElements"][3]["open"] = true;
|
defConfig["menuElements"][3]["open"] = true;
|
||||||
|
|
||||||
defConfig["menuElements"][3]["name"] = "Frequency Manager";
|
defConfig["menuElements"][4]["name"] = "Frequency Manager";
|
||||||
defConfig["menuElements"][3]["open"] = true;
|
|
||||||
|
|
||||||
defConfig["menuElements"][4]["name"] = "VFO Color";
|
|
||||||
defConfig["menuElements"][4]["open"] = true;
|
defConfig["menuElements"][4]["open"] = true;
|
||||||
|
|
||||||
|
defConfig["menuElements"][5]["name"] = "VFO Color";
|
||||||
|
defConfig["menuElements"][5]["open"] = true;
|
||||||
|
|
||||||
defConfig["menuElements"][6]["name"] = "Band Plan";
|
defConfig["menuElements"][6]["name"] = "Band Plan";
|
||||||
defConfig["menuElements"][6]["open"] = true;
|
defConfig["menuElements"][6]["open"] = true;
|
||||||
|
|
||||||
@ -232,12 +232,19 @@ int sdrpp_main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
defConfig["modules"] = json::array();
|
defConfig["modules"] = json::array();
|
||||||
|
|
||||||
defConfig["offsetMode"] = (int)0; // Off
|
defConfig["offsets"]["SpyVerter"] = 120000000.0;
|
||||||
defConfig["offset"] = 0.0;
|
defConfig["offsets"]["Ham-It-Up"] = 125000000.0;
|
||||||
|
defConfig["offsets"]["MMDS S-band (1998MHz)"] = -1998000000.0;
|
||||||
|
defConfig["offsets"]["DK5AV X-Band"] = -6800000000.0;
|
||||||
|
defConfig["offsets"]["Ku LNB (9750MHz)"] = -9750000000.0;
|
||||||
|
defConfig["offsets"]["Ku LNB (10700MHz)"] = -10700000000.0;
|
||||||
|
|
||||||
|
defConfig["selectedOffset"] = "None";
|
||||||
|
defConfig["manualOffset"] = 0.0;
|
||||||
defConfig["showMenu"] = true;
|
defConfig["showMenu"] = true;
|
||||||
defConfig["showWaterfall"] = true;
|
defConfig["showWaterfall"] = true;
|
||||||
defConfig["source"] = "";
|
defConfig["source"] = "";
|
||||||
defConfig["decimationPower"] = 0;
|
defConfig["decimation"] = 1;
|
||||||
defConfig["iqCorrection"] = false;
|
defConfig["iqCorrection"] = false;
|
||||||
defConfig["invertIQ"] = false;
|
defConfig["invertIQ"] = false;
|
||||||
|
|
||||||
@ -318,12 +325,18 @@ int sdrpp_main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
// Remove unused elements
|
// Remove unused elements
|
||||||
auto items = core::configManager.conf.items();
|
auto items = core::configManager.conf.items();
|
||||||
|
auto newConf = core::configManager.conf;
|
||||||
|
bool configCorrected = false;
|
||||||
for (auto const& item : items) {
|
for (auto const& item : items) {
|
||||||
if (!defConfig.contains(item.key())) {
|
if (!defConfig.contains(item.key())) {
|
||||||
flog::info("Unused key in config {0}, repairing", item.key());
|
flog::info("Unused key in config {0}, repairing", item.key());
|
||||||
core::configManager.conf.erase(item.key());
|
newConf.erase(item.key());
|
||||||
|
configCorrected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (configCorrected) {
|
||||||
|
core::configManager.conf = newConf;
|
||||||
|
}
|
||||||
|
|
||||||
// Update to new module representation in config if needed
|
// Update to new module representation in config if needed
|
||||||
for (auto [_name, inst] : core::configManager.conf["moduleInstances"].items()) {
|
for (auto [_name, inst] : core::configManager.conf["moduleInstances"].items()) {
|
||||||
|
@ -5,113 +5,120 @@
|
|||||||
#include <gui/main_window.h>
|
#include <gui/main_window.h>
|
||||||
#include <gui/style.h>
|
#include <gui/style.h>
|
||||||
#include <signal_path/signal_path.h>
|
#include <signal_path/signal_path.h>
|
||||||
|
#include <utils/optionlist.h>
|
||||||
|
#include <gui/dialogs/dialog_box.h>
|
||||||
|
|
||||||
namespace sourcemenu {
|
namespace sourcemenu {
|
||||||
int offsetMode = 0;
|
|
||||||
int sourceId = 0;
|
int sourceId = 0;
|
||||||
double customOffset = 0.0;
|
EventHandler<std::string> sourcesChangedHandler;
|
||||||
double effectiveOffset = 0.0;
|
EventHandler<std::string> sourceUnregisterHandler;
|
||||||
int decimationPower = 0;
|
OptionList<std::string, std::string> sources;
|
||||||
|
std::string selectedSource;
|
||||||
|
|
||||||
|
int decimId = 0;
|
||||||
|
OptionList<int, int> decimations;
|
||||||
|
|
||||||
bool iqCorrection = false;
|
bool iqCorrection = false;
|
||||||
bool invertIQ = false;
|
bool invertIQ = false;
|
||||||
|
|
||||||
EventHandler<std::string> sourceRegisteredHandler;
|
int offsetId = 0;
|
||||||
EventHandler<std::string> sourceUnregisterHandler;
|
double manualOffset = 0.0;
|
||||||
EventHandler<std::string> sourceUnregisteredHandler;
|
std::string selectedOffset;
|
||||||
|
double effectiveOffset = 0.0;
|
||||||
|
OptionList<std::string, double> offsets;
|
||||||
|
std::map<std::string, double> namedOffsets;
|
||||||
|
|
||||||
std::vector<std::string> sourceNames;
|
bool showAddOffsetDialog = false;
|
||||||
std::string sourceNamesTxt;
|
char newOffsetName[1024];
|
||||||
std::string selectedSource;
|
double newOffset = 0.0;
|
||||||
|
|
||||||
|
bool showDelOffsetDialog = false;
|
||||||
|
std::string delOffsetName = "";
|
||||||
|
|
||||||
|
// Offset IDs
|
||||||
enum {
|
enum {
|
||||||
OFFSET_MODE_NONE,
|
OFFSET_ID_NONE,
|
||||||
OFFSET_MODE_CUSTOM,
|
OFFSET_ID_MANUAL,
|
||||||
OFFSET_MODE_SPYVERTER,
|
OFFSET_ID_CUSTOM_BASE
|
||||||
OFFSET_MODE_HAM_IT_UP,
|
|
||||||
OFFSET_MODE_MMDS_SB_1998,
|
|
||||||
OFFSET_MODE_DK5AV_XB,
|
|
||||||
OFFSET_MODE_KU_LNB_9750,
|
|
||||||
OFFSET_MODE_KU_LNB_10700,
|
|
||||||
_OFFSET_MODE_COUNT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* offsetModesTxt = "None\0"
|
|
||||||
"Custom\0"
|
|
||||||
"SpyVerter\0"
|
|
||||||
"Ham-It-Up\0"
|
|
||||||
"MMDS S-band (1998MHz)\0"
|
|
||||||
"DK5AV X-Band\0"
|
|
||||||
"Ku LNB (9750MHz)\0"
|
|
||||||
"Ku LNB (10700MHz)\0";
|
|
||||||
|
|
||||||
const char* decimationStages = "None\0"
|
|
||||||
"2\0"
|
|
||||||
"4\0"
|
|
||||||
"8\0"
|
|
||||||
"16\0"
|
|
||||||
"32\0"
|
|
||||||
"64\0";
|
|
||||||
|
|
||||||
void updateOffset() {
|
void updateOffset() {
|
||||||
if (offsetMode == OFFSET_MODE_CUSTOM) { effectiveOffset = customOffset; }
|
// Compute the effective offset
|
||||||
else if (offsetMode == OFFSET_MODE_SPYVERTER) {
|
switch (offsetId) {
|
||||||
effectiveOffset = 120000000;
|
case OFFSET_ID_NONE:
|
||||||
} // 120MHz Up-conversion
|
|
||||||
else if (offsetMode == OFFSET_MODE_HAM_IT_UP) {
|
|
||||||
effectiveOffset = 125000000;
|
|
||||||
} // 125MHz Up-conversion
|
|
||||||
else if (offsetMode == OFFSET_MODE_MMDS_SB_1998) {
|
|
||||||
effectiveOffset = -1998000000;
|
|
||||||
} // 1.998GHz Down-conversion
|
|
||||||
else if (offsetMode == OFFSET_MODE_DK5AV_XB) {
|
|
||||||
effectiveOffset = -6800000000;
|
|
||||||
} // 6.8GHz Down-conversion
|
|
||||||
else if (offsetMode == OFFSET_MODE_KU_LNB_9750) {
|
|
||||||
effectiveOffset = -9750000000;
|
|
||||||
} // 9.750GHz Down-conversion
|
|
||||||
else if (offsetMode == OFFSET_MODE_KU_LNB_10700) {
|
|
||||||
effectiveOffset = -10700000000;
|
|
||||||
} // 10.7GHz Down-conversion
|
|
||||||
else {
|
|
||||||
effectiveOffset = 0;
|
effectiveOffset = 0;
|
||||||
|
break;
|
||||||
|
case OFFSET_ID_MANUAL:
|
||||||
|
effectiveOffset = manualOffset;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
effectiveOffset = namedOffsets[offsets.name(offsetId)];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply it
|
||||||
sigpath::sourceManager.setTuningOffset(effectiveOffset);
|
sigpath::sourceManager.setTuningOffset(effectiveOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void selectOffsetById(int id) {
|
||||||
|
// Update the offset mode
|
||||||
|
offsetId = id;
|
||||||
|
selectedOffset = offsets.name(id);
|
||||||
|
|
||||||
|
// Update the offset
|
||||||
|
updateOffset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectOffsetByName(const std::string& name) {
|
||||||
|
// If the name doesn't exist, select 'None'
|
||||||
|
if (!offsets.nameExists(name)) {
|
||||||
|
selectOffsetById(OFFSET_ID_NONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select using the ID associated with the name
|
||||||
|
selectOffsetById(offsets.nameId(name));
|
||||||
|
}
|
||||||
|
|
||||||
void refreshSources() {
|
void refreshSources() {
|
||||||
sourceNames = sigpath::sourceManager.getSourceNames();
|
// Get sources
|
||||||
sourceNamesTxt.clear();
|
auto sourceNames = sigpath::sourceManager.getSourceNames();
|
||||||
|
|
||||||
|
// Define source options
|
||||||
|
sources.clear();
|
||||||
for (auto name : sourceNames) {
|
for (auto name : sourceNames) {
|
||||||
sourceNamesTxt += name;
|
sources.define(name, name, name);
|
||||||
sourceNamesTxt += '\0';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectSource(std::string name) {
|
void selectSource(std::string name) {
|
||||||
if (sourceNames.empty()) {
|
// If there is no source, give up
|
||||||
|
if (sources.empty()) {
|
||||||
|
sourceId = 0;
|
||||||
selectedSource.clear();
|
selectedSource.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto it = std::find(sourceNames.begin(), sourceNames.end(), name);
|
|
||||||
if (it == sourceNames.end()) {
|
// If a source with the given name doesn't exist, select the first source instead
|
||||||
selectSource(sourceNames[0]);
|
if (!sources.valueExists(name)) {
|
||||||
|
selectSource(sources.value(0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sourceId = std::distance(sourceNames.begin(), it);
|
|
||||||
selectedSource = sourceNames[sourceId];
|
// Update the GUI variables
|
||||||
sigpath::sourceManager.selectSource(sourceNames[sourceId]);
|
sourceId = sources.valueId(name);
|
||||||
|
selectedSource = name;
|
||||||
|
|
||||||
|
// Select the source module
|
||||||
|
sigpath::sourceManager.selectSource(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSourceRegistered(std::string name, void* ctx) {
|
void onSourcesChanged(std::string name, void* ctx) {
|
||||||
|
// Update the source list
|
||||||
refreshSources();
|
refreshSources();
|
||||||
|
|
||||||
if (selectedSource.empty()) {
|
// Reselect the current source
|
||||||
sourceId = 0;
|
selectSource(selectedSource);
|
||||||
selectSource(sourceNames[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceId = std::distance(sourceNames.begin(), std::find(sourceNames.begin(), sourceNames.end(), selectedSource));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSourceUnregister(std::string name, void* ctx) {
|
void onSourceUnregister(std::string name, void* ctx) {
|
||||||
@ -120,60 +127,173 @@ namespace sourcemenu {
|
|||||||
// TODO: Stop everything
|
// TODO: Stop everything
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSourceUnregistered(std::string name, void* ctx) {
|
void reloadOffsets() {
|
||||||
refreshSources();
|
// Clear list
|
||||||
|
offsets.clear();
|
||||||
|
namedOffsets.clear();
|
||||||
|
|
||||||
if (sourceNames.empty()) {
|
// Define special offset modes
|
||||||
selectedSource = "";
|
offsets.define("None", OFFSET_ID_NONE);
|
||||||
return;
|
offsets.define("Manual", OFFSET_ID_MANUAL);
|
||||||
|
|
||||||
|
// Acquire the config file
|
||||||
|
core::configManager.acquire();
|
||||||
|
|
||||||
|
// Load custom offsets
|
||||||
|
auto ofs = core::configManager.conf["offsets"].items();
|
||||||
|
for (auto& o : ofs) {
|
||||||
|
namedOffsets[o.key()] = (double)o.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == selectedSource) {
|
// Define custom offsets
|
||||||
sourceId = std::clamp<int>(sourceId, 0, sourceNames.size() - 1);
|
for (auto& [name, offset] : namedOffsets) {
|
||||||
selectSource(sourceNames[sourceId]);
|
offsets.define(name, offsets.size());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceId = std::distance(sourceNames.begin(), std::find(sourceNames.begin(), sourceNames.end(), selectedSource));
|
// Release the config file
|
||||||
|
core::configManager.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
|
// Load offset modes
|
||||||
|
reloadOffsets();
|
||||||
|
|
||||||
|
// Define decimation values
|
||||||
|
decimations.define(1, "None", 1);
|
||||||
|
decimations.define(2, "2x", 2);
|
||||||
|
decimations.define(4, "4x", 4);
|
||||||
|
decimations.define(8, "8x", 8);
|
||||||
|
decimations.define(16, "16x", 16);
|
||||||
|
decimations.define(32, "32x", 32);
|
||||||
|
decimations.define(64, "64x", 64);
|
||||||
|
|
||||||
|
// Acquire the config file
|
||||||
core::configManager.acquire();
|
core::configManager.acquire();
|
||||||
std::string selected = core::configManager.conf["source"];
|
|
||||||
customOffset = core::configManager.conf["offset"];
|
// Load other settings
|
||||||
offsetMode = core::configManager.conf["offsetMode"];
|
std::string selectedSource = core::configManager.conf["source"];
|
||||||
decimationPower = core::configManager.conf["decimationPower"];
|
manualOffset = core::configManager.conf["manualOffset"];
|
||||||
|
std::string selectedOffset = core::configManager.conf["selectedOffset"];
|
||||||
iqCorrection = core::configManager.conf["iqCorrection"];
|
iqCorrection = core::configManager.conf["iqCorrection"];
|
||||||
invertIQ = core::configManager.conf["invertIQ"];
|
invertIQ = core::configManager.conf["invertIQ"];
|
||||||
|
int decimation = core::configManager.conf["decimation"];
|
||||||
|
if (decimations.keyExists(decimation)) {
|
||||||
|
decimId = decimations.keyId(decimation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release the config file
|
||||||
|
core::configManager.release();
|
||||||
|
|
||||||
|
// Select the source module
|
||||||
|
refreshSources();
|
||||||
|
selectSource(selectedSource);
|
||||||
|
|
||||||
|
// Update frontend settings
|
||||||
sigpath::iqFrontEnd.setDCBlocking(iqCorrection);
|
sigpath::iqFrontEnd.setDCBlocking(iqCorrection);
|
||||||
sigpath::iqFrontEnd.setInvertIQ(invertIQ);
|
sigpath::iqFrontEnd.setInvertIQ(invertIQ);
|
||||||
updateOffset();
|
sigpath::iqFrontEnd.setDecimation(decimations.value(decimId));
|
||||||
|
selectOffsetByName(selectedOffset);
|
||||||
|
|
||||||
refreshSources();
|
// Register handlers
|
||||||
selectSource(selected);
|
sourcesChangedHandler.handler = onSourcesChanged;
|
||||||
sigpath::iqFrontEnd.setDecimation(1 << decimationPower);
|
|
||||||
|
|
||||||
sourceRegisteredHandler.handler = onSourceRegistered;
|
|
||||||
sourceUnregisterHandler.handler = onSourceUnregister;
|
sourceUnregisterHandler.handler = onSourceUnregister;
|
||||||
sourceUnregisteredHandler.handler = onSourceUnregistered;
|
sigpath::sourceManager.onSourceRegistered.bindHandler(&sourcesChangedHandler);
|
||||||
sigpath::sourceManager.onSourceRegistered.bindHandler(&sourceRegisteredHandler);
|
|
||||||
sigpath::sourceManager.onSourceUnregister.bindHandler(&sourceUnregisterHandler);
|
sigpath::sourceManager.onSourceUnregister.bindHandler(&sourceUnregisterHandler);
|
||||||
sigpath::sourceManager.onSourceUnregistered.bindHandler(&sourceUnregisteredHandler);
|
sigpath::sourceManager.onSourceUnregistered.bindHandler(&sourcesChangedHandler);
|
||||||
|
}
|
||||||
|
|
||||||
core::configManager.release();
|
void addOffset(const std::string& name, double offset) {
|
||||||
|
// Acquire the config file
|
||||||
|
core::configManager.acquire();
|
||||||
|
|
||||||
|
// Define a new offset
|
||||||
|
core::configManager.conf["offsets"][name] = offset;
|
||||||
|
|
||||||
|
// Acquire the config file
|
||||||
|
core::configManager.release(true);
|
||||||
|
|
||||||
|
// Reload the offsets
|
||||||
|
reloadOffsets();
|
||||||
|
|
||||||
|
// Attempt to re-select the same one
|
||||||
|
selectOffsetByName(selectedOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void delOffset(const std::string& name) {
|
||||||
|
// Acquire the config file
|
||||||
|
core::configManager.acquire();
|
||||||
|
|
||||||
|
// Define a new offset
|
||||||
|
core::configManager.conf["offsets"].erase(name);
|
||||||
|
|
||||||
|
// Acquire the config file
|
||||||
|
core::configManager.release(true);
|
||||||
|
|
||||||
|
// Reload the offsets
|
||||||
|
reloadOffsets();
|
||||||
|
|
||||||
|
// Attempt to re-select the same one
|
||||||
|
selectOffsetByName(selectedOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool addOffsetDialog() {
|
||||||
|
bool open = true;
|
||||||
|
gui::mainWindow.lockWaterfallControls = true;
|
||||||
|
|
||||||
|
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||||
|
|
||||||
|
const char* id = "Add offset##sdrpp_add_offset_dialog_";
|
||||||
|
ImGui::OpenPopup(id);
|
||||||
|
|
||||||
|
if (ImGui::BeginPopup(id, ImGuiWindowFlags_NoResize)) {
|
||||||
|
ImGui::LeftLabel("Name");
|
||||||
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
|
ImGui::InputText("##sdrpp_add_offset_name", newOffsetName, 1023);
|
||||||
|
|
||||||
|
ImGui::LeftLabel("Offset");
|
||||||
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
|
ImGui::InputDouble("##sdrpp_add_offset_offset", &newOffset);
|
||||||
|
|
||||||
|
bool nameExists = offsets.nameExists(newOffsetName);
|
||||||
|
bool reservedName = !strcmp(newOffsetName, "None") || !strcmp(newOffsetName, "Manual");
|
||||||
|
bool denyApply = !newOffsetName[0] || nameExists || reservedName;
|
||||||
|
|
||||||
|
if (nameExists) {
|
||||||
|
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "An offset with the given name already exists.");
|
||||||
|
}
|
||||||
|
else if (reservedName) {
|
||||||
|
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "The given name is reserved.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (denyApply) { style::beginDisabled(); }
|
||||||
|
if (ImGui::Button("Apply")) {
|
||||||
|
addOffset(newOffsetName, newOffset);
|
||||||
|
open = false;
|
||||||
|
}
|
||||||
|
if (denyApply) { style::endDisabled(); }
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Cancel")) {
|
||||||
|
open = false;
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
return open;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(void* ctx) {
|
void draw(void* ctx) {
|
||||||
float itemWidth = ImGui::GetContentRegionAvail().x;
|
float itemWidth = ImGui::GetContentRegionAvail().x;
|
||||||
|
float lineHeight = ImGui::GetTextLineHeightWithSpacing();
|
||||||
|
float spacing = lineHeight - ImGui::GetTextLineHeight();
|
||||||
bool running = gui::mainWindow.sdrIsRunning();
|
bool running = gui::mainWindow.sdrIsRunning();
|
||||||
|
|
||||||
if (running) { style::beginDisabled(); }
|
if (running) { style::beginDisabled(); }
|
||||||
|
|
||||||
ImGui::SetNextItemWidth(itemWidth);
|
ImGui::SetNextItemWidth(itemWidth);
|
||||||
if (ImGui::Combo("##source", &sourceId, sourceNamesTxt.c_str())) {
|
if (ImGui::Combo("##source", &sourceId, sources.txt)) {
|
||||||
selectSource(sourceNames[sourceId]);
|
std::string newSource = sources.value(sourceId);
|
||||||
|
selectSource(newSource);
|
||||||
core::configManager.acquire();
|
core::configManager.acquire();
|
||||||
core::configManager.conf["source"] = sourceNames[sourceId];
|
core::configManager.conf["source"] = newSource;
|
||||||
core::configManager.release(true);
|
core::configManager.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,21 +316,45 @@ namespace sourcemenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::LeftLabel("Offset mode");
|
ImGui::LeftLabel("Offset mode");
|
||||||
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX());
|
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX() - 2.0f*(lineHeight + 1.5f*spacing));
|
||||||
if (ImGui::Combo("##_sdrpp_offset_mode", &offsetMode, offsetModesTxt)) {
|
if (ImGui::Combo("##_sdrpp_offset", &offsetId, offsets.txt)) {
|
||||||
updateOffset();
|
selectOffsetById(offsetId);
|
||||||
core::configManager.acquire();
|
core::configManager.acquire();
|
||||||
core::configManager.conf["offsetMode"] = offsetMode;
|
core::configManager.conf["selectedOffset"] = offsets.key(offsetId);
|
||||||
core::configManager.release(true);
|
core::configManager.release(true);
|
||||||
}
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - spacing);
|
||||||
|
if (offsetId < OFFSET_ID_CUSTOM_BASE) { ImGui::BeginDisabled(); }
|
||||||
|
if (ImGui::Button("-##_sdrpp_offset_del_", ImVec2(lineHeight + 0.5f*spacing, 0))) {
|
||||||
|
delOffsetName = selectedOffset;
|
||||||
|
showDelOffsetDialog = true;
|
||||||
|
}
|
||||||
|
if (offsetId < OFFSET_ID_CUSTOM_BASE) { ImGui::EndDisabled(); }
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - spacing);
|
||||||
|
if (ImGui::Button("+##_sdrpp_offset_add_", ImVec2(lineHeight + 0.5f*spacing, 0))) {
|
||||||
|
strcpy(newOffsetName, "New Offset");
|
||||||
|
showAddOffsetDialog = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Offset delete confirmation
|
||||||
|
if (ImGui::GenericDialog("sdrpp_del_offset_confirm", showDelOffsetDialog, GENERIC_DIALOG_BUTTONS_YES_NO, []() {
|
||||||
|
ImGui::Text("Deleting offset named \"%s\". Are you sure?", delOffsetName.c_str());
|
||||||
|
}) == GENERIC_DIALOG_BUTTON_YES) {
|
||||||
|
delOffset(delOffsetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Offset add diaglog
|
||||||
|
if (showAddOffsetDialog) { showAddOffsetDialog = addOffsetDialog(); }
|
||||||
|
|
||||||
ImGui::LeftLabel("Offset");
|
ImGui::LeftLabel("Offset");
|
||||||
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX());
|
ImGui::FillWidth();
|
||||||
if (offsetMode == OFFSET_MODE_CUSTOM) {
|
if (offsetId == OFFSET_ID_MANUAL) {
|
||||||
if (ImGui::InputDouble("##freq_offset", &customOffset, 1.0, 100.0)) {
|
if (ImGui::InputDouble("##freq_offset", &manualOffset, 1.0, 100.0)) {
|
||||||
updateOffset();
|
updateOffset();
|
||||||
core::configManager.acquire();
|
core::configManager.acquire();
|
||||||
core::configManager.conf["offset"] = customOffset;
|
core::configManager.conf["manualOffset"] = manualOffset;
|
||||||
core::configManager.release(true);
|
core::configManager.release(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,11 +366,11 @@ namespace sourcemenu {
|
|||||||
|
|
||||||
if (running) { style::beginDisabled(); }
|
if (running) { style::beginDisabled(); }
|
||||||
ImGui::LeftLabel("Decimation");
|
ImGui::LeftLabel("Decimation");
|
||||||
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX());
|
ImGui::FillWidth();
|
||||||
if (ImGui::Combo("##source_decim", &decimationPower, decimationStages)) {
|
if (ImGui::Combo("##source_decim", &decimId, decimations.txt)) {
|
||||||
sigpath::iqFrontEnd.setDecimation(1 << decimationPower);
|
sigpath::iqFrontEnd.setDecimation(decimations.value(decimId));
|
||||||
core::configManager.acquire();
|
core::configManager.acquire();
|
||||||
core::configManager.conf["decimationPower"] = decimationPower;
|
core::configManager.conf["decimation"] = decimations.key(decimId);
|
||||||
core::configManager.release(true);
|
core::configManager.release(true);
|
||||||
}
|
}
|
||||||
if (running) { style::endDisabled(); }
|
if (running) { style::endDisabled(); }
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_STR "1.2.0"
|
#define VERSION_STR "1.2.1"
|
@ -10,23 +10,54 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <radio_interface.h>
|
#include <radio_interface.h>
|
||||||
|
#include <utils/optionlist.h>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
||||||
|
|
||||||
SDRPP_MOD_INFO{
|
SDRPP_MOD_INFO{
|
||||||
/* Name: */ "rigctl_client",
|
/* Name: */ "rigctl_client",
|
||||||
/* Description: */ "Client for the RigCTL protocol",
|
/* Description: */ "Client for the RigCTL protocol",
|
||||||
/* Author: */ "Ryzerth",
|
/* Author: */ "Ryzerth",
|
||||||
/* Version: */ 0, 1, 0,
|
/* Version: */ 0, 2, 0,
|
||||||
/* Max instances */ 1
|
/* Max instances */ 1
|
||||||
};
|
};
|
||||||
|
|
||||||
ConfigManager config;
|
ConfigManager config;
|
||||||
|
|
||||||
|
enum Mode {
|
||||||
|
MODE_PANADAPTER,
|
||||||
|
MODE_MIRROR
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Priority {
|
||||||
|
PRIOR_SDR,
|
||||||
|
PRIOR_RIGCTL
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::map<int, net::rigctl::Mode> RADIO_TO_RIGCTL = {
|
||||||
|
{ RADIO_IFACE_MODE_NFM, net::rigctl::MODE_FM },
|
||||||
|
{ RADIO_IFACE_MODE_WFM, net::rigctl::MODE_WFM },
|
||||||
|
{ RADIO_IFACE_MODE_AM , net::rigctl::MODE_AM },
|
||||||
|
{ RADIO_IFACE_MODE_DSB, net::rigctl::MODE_DSB },
|
||||||
|
{ RADIO_IFACE_MODE_USB, net::rigctl::MODE_USB },
|
||||||
|
{ RADIO_IFACE_MODE_CW , net::rigctl::MODE_CW },
|
||||||
|
{ RADIO_IFACE_MODE_LSB, net::rigctl::MODE_LSB }
|
||||||
|
};
|
||||||
|
|
||||||
class RigctlClientModule : public ModuleManager::Instance {
|
class RigctlClientModule : public ModuleManager::Instance {
|
||||||
public:
|
public:
|
||||||
RigctlClientModule(std::string name) {
|
RigctlClientModule(std::string name) {
|
||||||
this->name = name;
|
this->name = name;
|
||||||
|
|
||||||
|
// Define the operation modes
|
||||||
|
modes.define("panadapter", "Pandapter", MODE_PANADAPTER);
|
||||||
|
modes.define("mirror", "Mirror", MODE_MIRROR);
|
||||||
|
|
||||||
|
// Define the priority modes
|
||||||
|
priorities.define("sdr", "SDR", PRIOR_SDR);
|
||||||
|
priorities.define("rigctl", "RigCTL", PRIOR_RIGCTL);
|
||||||
|
|
||||||
// Load default
|
// Load default
|
||||||
strcpy(host, "127.0.0.1");
|
strcpy(host, "127.0.0.1");
|
||||||
|
|
||||||
@ -40,13 +71,28 @@ public:
|
|||||||
port = config.conf[name]["port"];
|
port = config.conf[name]["port"];
|
||||||
port = std::clamp<int>(port, 1, 65535);
|
port = std::clamp<int>(port, 1, 65535);
|
||||||
}
|
}
|
||||||
|
if (config.conf[name].contains("mode")) {
|
||||||
|
std::string modeStr = config.conf[name]["mode"];
|
||||||
|
if (modes.keyExists(modeStr)) { modeId = modes.keyId(modeStr); }
|
||||||
|
}
|
||||||
|
if (config.conf[name].contains("priority")) {
|
||||||
|
std::string priorityStr = config.conf[name]["priority"];
|
||||||
|
if (priorities.keyExists(priorityStr)) { priorityId = modes.keyId(priorityStr); }
|
||||||
|
}
|
||||||
|
if (config.conf[name].contains("interval")) {
|
||||||
|
interval = config.conf[name]["interval"];
|
||||||
|
interval = std::clamp<int>(interval, 100, 1000);
|
||||||
|
}
|
||||||
if (config.conf[name].contains("ifFreq")) {
|
if (config.conf[name].contains("ifFreq")) {
|
||||||
ifFreq = config.conf[name]["ifFreq"];
|
ifFreq = config.conf[name]["ifFreq"];
|
||||||
}
|
}
|
||||||
|
if (config.conf[name].contains("vfo")) {
|
||||||
|
selectedVFO = config.conf[name]["vfo"];
|
||||||
|
}
|
||||||
config.release();
|
config.release();
|
||||||
|
|
||||||
_retuneHandler.ctx = this;
|
// Refresh VFOs
|
||||||
_retuneHandler.handler = retuneHandler;
|
refreshVFOs();
|
||||||
|
|
||||||
gui::menu.registerEntry(name, menuHandler, this, NULL);
|
gui::menu.registerEntry(name, menuHandler, this, NULL);
|
||||||
}
|
}
|
||||||
@ -85,10 +131,20 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch source to panadapter mode
|
if (mode == MODE_PANADAPTER) {
|
||||||
sigpath::sourceManager.setPanadapterIF(ifFreq);
|
// Switch source to panadapter mode
|
||||||
sigpath::sourceManager.setTuningMode(SourceManager::TuningMode::PANADAPTER);
|
sigpath::sourceManager.setPanadapterIF(ifFreq);
|
||||||
sigpath::sourceManager.onRetune.bindHandler(&_retuneHandler);
|
sigpath::sourceManager.setTuningMode(SourceManager::TuningMode::PANADAPTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the worker thread
|
||||||
|
run = true;
|
||||||
|
if (mode == MODE_PANADAPTER) {
|
||||||
|
workerThread = std::thread(&RigctlClientModule::panadapterWorker, this);
|
||||||
|
}
|
||||||
|
else if (mode == MODE_MIRROR) {
|
||||||
|
workerThread = std::thread(&RigctlClientModule::mirrorWorker, this);
|
||||||
|
}
|
||||||
|
|
||||||
running = true;
|
running = true;
|
||||||
}
|
}
|
||||||
@ -97,9 +153,15 @@ public:
|
|||||||
std::lock_guard<std::recursive_mutex> lck(mtx);
|
std::lock_guard<std::recursive_mutex> lck(mtx);
|
||||||
if (!running) { return; }
|
if (!running) { return; }
|
||||||
|
|
||||||
// Switch source back to normal mode
|
// Stop the worker thread
|
||||||
sigpath::sourceManager.onRetune.unbindHandler(&_retuneHandler);
|
run = false;
|
||||||
sigpath::sourceManager.setTuningMode(SourceManager::TuningMode::NORMAL);
|
if (workerThread.joinable()) { workerThread.join(); }
|
||||||
|
|
||||||
|
if (mode == MODE_PANADAPTER) {
|
||||||
|
// Switch source back to normal mode
|
||||||
|
sigpath::sourceManager.onRetune.unbindHandler(&_retuneHandler);
|
||||||
|
sigpath::sourceManager.setTuningMode(SourceManager::TuningMode::NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
// Disconnect from rigctl server
|
// Disconnect from rigctl server
|
||||||
client->close();
|
client->close();
|
||||||
@ -125,19 +187,70 @@ private:
|
|||||||
config.conf[_this->name]["port"] = _this->port;
|
config.conf[_this->name]["port"] = _this->port;
|
||||||
config.release(true);
|
config.release(true);
|
||||||
}
|
}
|
||||||
if (_this->running) { style::endDisabled(); }
|
|
||||||
|
|
||||||
ImGui::LeftLabel("IF Frequency");
|
ImGui::LeftLabel("Mode");
|
||||||
ImGui::FillWidth();
|
ImGui::FillWidth();
|
||||||
if (ImGui::InputDouble(CONCAT("##_rigctl_if_freq_", _this->name), &_this->ifFreq, 100.0, 100000.0, "%.0f")) {
|
if (ImGui::Combo(CONCAT("##_rigctl_cli_mode_", _this->name), &_this->modeId, _this->modes.txt)) {
|
||||||
if (_this->running) {
|
_this->mode = _this->modes[_this->modeId];
|
||||||
sigpath::sourceManager.setPanadapterIF(_this->ifFreq);
|
|
||||||
}
|
|
||||||
config.acquire();
|
config.acquire();
|
||||||
config.conf[_this->name]["ifFreq"] = _this->ifFreq;
|
config.conf[_this->name]["mode"] = _this->modes.key(_this->modeId);
|
||||||
config.release(true);
|
config.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::LeftLabel("Priority");
|
||||||
|
ImGui::FillWidth();
|
||||||
|
if (ImGui::Combo(CONCAT("##_rigctl_cli_priority_", _this->name), &_this->priorityId, _this->priorities.txt)) {
|
||||||
|
_this->priority = _this->priorities[_this->priorityId];
|
||||||
|
config.acquire();
|
||||||
|
config.conf[_this->name]["priority"] = _this->priorities.key(_this->priorityId);
|
||||||
|
config.release(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::LeftLabel("Interval");
|
||||||
|
ImGui::FillWidth();
|
||||||
|
if (ImGui::InputInt(CONCAT("##_rigctl_cli_interval_", _this->name), &_this->interval, 10, 100)) {
|
||||||
|
_this->interval = std::clamp<int>(_this->interval, 100, 1000);
|
||||||
|
config.acquire();
|
||||||
|
config.conf[_this->name]["interval"] = _this->interval;
|
||||||
|
config.release(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this->mode == MODE_PANADAPTER) {
|
||||||
|
ImGui::LeftLabel("IF Frequency");
|
||||||
|
ImGui::FillWidth();
|
||||||
|
if (ImGui::InputDouble(CONCAT("##_rigctl_if_freq_", _this->name), &_this->ifFreq, 100.0, 100000.0, "%.0f")) {
|
||||||
|
if (_this->running) {
|
||||||
|
sigpath::sourceManager.setPanadapterIF(_this->ifFreq);
|
||||||
|
}
|
||||||
|
config.acquire();
|
||||||
|
config.conf[_this->name]["ifFreq"] = _this->ifFreq;
|
||||||
|
config.release(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_this->mode == MODE_MIRROR) {
|
||||||
|
ImGui::LeftLabel("Controlled VFO");
|
||||||
|
ImGui::FillWidth();
|
||||||
|
if (ImGui::Combo(CONCAT("##_rigctl_cli_vfo_", _this->name), &_this->vfoId, _this->vfos.txt)) {
|
||||||
|
_this->selectedVFO = _this->vfos[_this->vfoId];
|
||||||
|
config.acquire();
|
||||||
|
config.conf[_this->name]["vfo"] = _this->vfos.key(_this->vfoId);
|
||||||
|
config.release(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Checkbox(CONCAT("Sync Frequency##_rigctl_sync_freq_", _this->name), &_this->syncFrequency);
|
||||||
|
if (_this->vfoIsRadio) {
|
||||||
|
ImGui::Checkbox(CONCAT("Sync Mode##_rigctl_sync_freq_", _this->name), &_this->syncMode);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bool dummy = false;
|
||||||
|
if (!_this->running) { style::beginDisabled(); }
|
||||||
|
ImGui::Checkbox(CONCAT("Sync Mode##_rigctl_sync_freq_", _this->name), &dummy);
|
||||||
|
if (!_this->running) { style::endDisabled(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this->running) { style::endDisabled(); }
|
||||||
|
|
||||||
ImGui::FillWidth();
|
ImGui::FillWidth();
|
||||||
if (_this->running && ImGui::Button(CONCAT("Stop##_rigctl_cli_stop_", _this->name), ImVec2(menuWidth, 0))) {
|
if (_this->running && ImGui::Button(CONCAT("Stop##_rigctl_cli_stop_", _this->name), ImVec2(menuWidth, 0))) {
|
||||||
_this->stop();
|
_this->stop();
|
||||||
@ -159,11 +272,131 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void retuneHandler(double freq, void* ctx) {
|
void selectVFO(const std::string& vfoName) {
|
||||||
RigctlClientModule* _this = (RigctlClientModule*)ctx;
|
// If no vfo is available, deselect
|
||||||
if (!_this->client || !_this->client->isOpen()) { return; }
|
if (vfos.empty()) {
|
||||||
if (_this->client->setFreq(freq)) {
|
selectedVFO.clear();
|
||||||
flog::error("Could not set frequency");
|
vfoIsRadio = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If a vfo with that name isn't found, select the first VFO in the list
|
||||||
|
if (!vfos.keyExists(vfoName)) {
|
||||||
|
selectVFO(vfos.key(0));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the VFO is from a radio module
|
||||||
|
vfoIsRadio = (core::moduleManager.getInstanceModuleName(vfoName) == "radio");
|
||||||
|
|
||||||
|
// Update the selected VFO
|
||||||
|
selectedVFO = vfoName;
|
||||||
|
vfoId = vfos.keyId(vfoName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void refreshVFOs() {
|
||||||
|
// Clear the list
|
||||||
|
vfos.clear();
|
||||||
|
|
||||||
|
// Define using the VFO list from the waterfall
|
||||||
|
for (auto const& [_name, vfo] : gui::waterfall.vfos) {
|
||||||
|
vfos.define(_name, _name, _name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reselect the current VFO
|
||||||
|
selectVFO(selectedVFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
void panadapterWorker() {
|
||||||
|
int64_t lastRigctlFreq = -1;
|
||||||
|
int64_t lastCenterFreq = -1;
|
||||||
|
int64_t rigctlFreq;
|
||||||
|
int64_t centerFreq;
|
||||||
|
|
||||||
|
while (run) {
|
||||||
|
// Query the current modes
|
||||||
|
try {
|
||||||
|
// Get the current rigctl frequency
|
||||||
|
rigctlFreq = (int64_t)client->getFreq();
|
||||||
|
|
||||||
|
// Get the current center frequency
|
||||||
|
centerFreq = (int64_t)gui::waterfall.getCenterFrequency();
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
flog::error("Error while getting frequencies: {}", e.what());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update frequencies depending on the priority
|
||||||
|
if (priority == PRIOR_SDR) {
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (priority == PRIOR_RIGCTL) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save frequencies
|
||||||
|
lastRigctlFreq = rigctlFreq;
|
||||||
|
lastCenterFreq = centerFreq;
|
||||||
|
|
||||||
|
// Wait for the time interval
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(interval));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mirrorWorker() {
|
||||||
|
int64_t lastRigctlFreq = -1;
|
||||||
|
int64_t lastFreq = -1;
|
||||||
|
int64_t rigctlFreq;
|
||||||
|
int64_t freq;
|
||||||
|
int lastRigctlMode = -1;
|
||||||
|
int lastVFOMode = -1;
|
||||||
|
int rigctlMode;
|
||||||
|
int vfoMode;
|
||||||
|
|
||||||
|
while (run) {
|
||||||
|
// Query the current modes
|
||||||
|
try {
|
||||||
|
// Get the current rigctl frequency
|
||||||
|
rigctlFreq = (int64_t)client->getFreq();
|
||||||
|
|
||||||
|
// Get the rigctl and VFO modes
|
||||||
|
if (selectedVFO.empty()) {
|
||||||
|
// Get the VFO frequency
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
// Get the mode if needed
|
||||||
|
if (syncMode && vfoIsRadio) {
|
||||||
|
// Get the current rigctl mode
|
||||||
|
// rigctlMode = client->getMode();
|
||||||
|
|
||||||
|
// Get the current VFO mode
|
||||||
|
core::modComManager.callInterface(selectedVFO, RADIO_IFACE_CMD_GET_MODE, NULL, &vfoMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
freq = (int64_t)gui::waterfall.getCenterFrequency();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
flog::error("Error while getting frequencies: {}", e.what());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update frequencies depending on the priority
|
||||||
|
if (priority == PRIOR_SDR) {
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (priority == PRIOR_RIGCTL) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save modes and frequencies
|
||||||
|
lastRigctlFreq = rigctlFreq;
|
||||||
|
lastFreq = freq;
|
||||||
|
lastRigctlMode = rigctlMode;
|
||||||
|
lastVFOMode = vfoMode;
|
||||||
|
|
||||||
|
// Wait for the time interval
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(interval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,9 +409,31 @@ private:
|
|||||||
int port = 4532;
|
int port = 4532;
|
||||||
std::shared_ptr<net::rigctl::Client> client;
|
std::shared_ptr<net::rigctl::Client> client;
|
||||||
|
|
||||||
|
Mode mode = MODE_PANADAPTER;
|
||||||
|
int modeId = 0;
|
||||||
|
|
||||||
|
Priority priority = PRIOR_SDR;
|
||||||
|
int priorityId = 0;
|
||||||
|
|
||||||
|
int interval = 100;
|
||||||
|
|
||||||
double ifFreq = 8830000.0;
|
double ifFreq = 8830000.0;
|
||||||
|
|
||||||
|
bool syncFrequency = true;
|
||||||
|
bool syncMode = true;
|
||||||
|
bool vfoIsRadio = false;
|
||||||
|
|
||||||
EventHandler<double> _retuneHandler;
|
EventHandler<double> _retuneHandler;
|
||||||
|
|
||||||
|
OptionList<std::string, Mode> modes;
|
||||||
|
OptionList<std::string, Priority> priorities;
|
||||||
|
|
||||||
|
std::string selectedVFO = "";
|
||||||
|
int vfoId = 0;
|
||||||
|
OptionList<std::string, std::string> vfos;
|
||||||
|
|
||||||
|
std::atomic_bool run;
|
||||||
|
std::thread workerThread;
|
||||||
};
|
};
|
||||||
|
|
||||||
MOD_EXPORT void _INIT_() {
|
MOD_EXPORT void _INIT_() {
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <utils/networking.h>
|
|
||||||
|
|
||||||
class RigCTLClient {
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
@ -18,7 +18,7 @@ SDRPP_MOD_INFO{
|
|||||||
/* Name: */ "rigctl_server",
|
/* Name: */ "rigctl_server",
|
||||||
/* Description: */ "My fancy new module",
|
/* Description: */ "My fancy new module",
|
||||||
/* Author: */ "Ryzerth",
|
/* Author: */ "Ryzerth",
|
||||||
/* Version: */ 0, 1, 0,
|
/* Version: */ 0, 1, 1,
|
||||||
/* Max instances */ -1
|
/* Max instances */ -1
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -153,21 +153,16 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::BeginTable(CONCAT("Stop##_rigctl_srv_tbl_", _this->name), 2);
|
|
||||||
ImGui::TableNextRow();
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
|
||||||
if (ImGui::Checkbox(CONCAT("Tuning##_rigctl_srv_tune_ena_", _this->name), &_this->tuningEnabled)) {
|
if (ImGui::Checkbox(CONCAT("Tuning##_rigctl_srv_tune_ena_", _this->name), &_this->tuningEnabled)) {
|
||||||
config.acquire();
|
config.acquire();
|
||||||
config.conf[_this->name]["tuning"] = _this->tuningEnabled;
|
config.conf[_this->name]["tuning"] = _this->tuningEnabled;
|
||||||
config.release(true);
|
config.release(true);
|
||||||
}
|
}
|
||||||
ImGui::TableSetColumnIndex(1);
|
|
||||||
if (ImGui::Checkbox(CONCAT("Recording##_rigctl_srv_tune_ena_", _this->name), &_this->recordingEnabled)) {
|
if (ImGui::Checkbox(CONCAT("Recording##_rigctl_srv_tune_ena_", _this->name), &_this->recordingEnabled)) {
|
||||||
config.acquire();
|
config.acquire();
|
||||||
config.conf[_this->name]["recording"] = _this->recordingEnabled;
|
config.conf[_this->name]["recording"] = _this->recordingEnabled;
|
||||||
config.release(true);
|
config.release(true);
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
|
||||||
|
|
||||||
if (ImGui::Checkbox(CONCAT("Listen on startup##_rigctl_srv_auto_lst_", _this->name), &_this->autoStart)) {
|
if (ImGui::Checkbox(CONCAT("Listen on startup##_rigctl_srv_auto_lst_", _this->name), &_this->autoStart)) {
|
||||||
config.acquire();
|
config.acquire();
|
||||||
|
@ -377,7 +377,7 @@ Modules in beta are still included in releases for the most part but not enabled
|
|||||||
| frequency_manager | Working | - | OPT_BUILD_FREQUENCY_MANAGER | ✅ | ✅ | ✅ |
|
| frequency_manager | Working | - | OPT_BUILD_FREQUENCY_MANAGER | ✅ | ✅ | ✅ |
|
||||||
| iq_exporter | Working | - | OPT_BUILD_IQ_EXPORTER | ✅ | ✅ | ⛔ |
|
| iq_exporter | Working | - | OPT_BUILD_IQ_EXPORTER | ✅ | ✅ | ⛔ |
|
||||||
| recorder | Working | - | OPT_BUILD_RECORDER | ✅ | ✅ | ✅ |
|
| recorder | Working | - | OPT_BUILD_RECORDER | ✅ | ✅ | ✅ |
|
||||||
| rigctl_client | Unfinished | - | OPT_BUILD_RIGCTL_CLIENT | ✅ | ✅ | ⛔ |
|
| rigctl_client | Beta | - | OPT_BUILD_RIGCTL_CLIENT | ✅ | ✅ | ⛔ |
|
||||||
| rigctl_server | Working | - | OPT_BUILD_RIGCTL_SERVER | ✅ | ✅ | ✅ |
|
| rigctl_server | Working | - | OPT_BUILD_RIGCTL_SERVER | ✅ | ✅ | ✅ |
|
||||||
| scanner | Beta | - | OPT_BUILD_SCANNER | ✅ | ✅ | ⛔ |
|
| scanner | Beta | - | OPT_BUILD_SCANNER | ✅ | ✅ | ⛔ |
|
||||||
| scheduler | Unfinished | - | OPT_BUILD_SCHEDULER | ⛔ | ⛔ | ⛔ |
|
| scheduler | Unfinished | - | OPT_BUILD_SCHEDULER | ⛔ | ⛔ | ⛔ |
|
||||||
|
@ -23,6 +23,12 @@
|
|||||||
"start": 531000,
|
"start": 531000,
|
||||||
"end": 1602000
|
"end": 1602000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "160m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 1810000,
|
||||||
|
"end": 2000000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "120m SW broadcast",
|
"name": "120m SW broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
@ -35,6 +41,12 @@
|
|||||||
"start": 3200000,
|
"start": 3200000,
|
||||||
"end": 3400000
|
"end": 3400000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "80m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 3500000,
|
||||||
|
"end": 3800000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "75m SW Broadcast",
|
"name": "75m SW Broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
@ -47,12 +59,24 @@
|
|||||||
"start": 4750000,
|
"start": 4750000,
|
||||||
"end": 5060000
|
"end": 5060000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "60m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 5351500,
|
||||||
|
"end": 5366500
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "49m SW Broadcast",
|
"name": "49m SW Broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
"start": 5900000,
|
"start": 5900000,
|
||||||
"end": 6200000
|
"end": 6200000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "40m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 7000000,
|
||||||
|
"end": 7200000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "40m SW Broadcast",
|
"name": "40m SW Broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
@ -65,6 +89,12 @@
|
|||||||
"start": 9400000,
|
"start": 9400000,
|
||||||
"end": 9900000
|
"end": 9900000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "30m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 10100000,
|
||||||
|
"end": 10150000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "25m SW Broadcast",
|
"name": "25m SW Broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
@ -77,12 +107,24 @@
|
|||||||
"start": 13570000,
|
"start": 13570000,
|
||||||
"end": 13870000
|
"end": 13870000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "20m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 14000000,
|
||||||
|
"end": 14350000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "19m SW Broadcast",
|
"name": "19m SW Broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
"start": 15100000,
|
"start": 15100000,
|
||||||
"end": 15800000
|
"end": 15800000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "17m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 18068000,
|
||||||
|
"end": 18168000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "16m SW Broadcast",
|
"name": "16m SW Broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
@ -95,23 +137,65 @@
|
|||||||
"start": 18900000,
|
"start": 18900000,
|
||||||
"end": 19020000
|
"end": 19020000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "15m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 21000000,
|
||||||
|
"end": 21450000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "13m SW Broadcast",
|
"name": "13m SW Broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
"start": 21450000,
|
"start": 21450000,
|
||||||
"end": 21850000
|
"end": 21850000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "12m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 24890000,
|
||||||
|
"end": 24990000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "11m SW Broadcast",
|
"name": "11m SW Broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
"start": 25670000,
|
"start": 25670000,
|
||||||
"end": 26100000
|
"end": 26100000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "10m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 28000000,
|
||||||
|
"end": 29700000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "FM Broadcast",
|
"name": "FM Broadcast",
|
||||||
"type": "broadcast",
|
"type": "broadcast",
|
||||||
"start": 87500000,
|
"start": 87500000,
|
||||||
"end": 108000000
|
"end": 108000000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "6m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 50000000,
|
||||||
|
"end": 52000000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "4m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 70000000,
|
||||||
|
"end": 70500000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "2m ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 144000000,
|
||||||
|
"end": 146000000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "70cm ham band",
|
||||||
|
"type": "amateur",
|
||||||
|
"start": 430000000,
|
||||||
|
"end": 440000000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user