mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-24 01:48:28 +01:00
Fixed sample rate bug
This commit is contained in:
parent
eac0a7a13f
commit
b3d1eabbad
@ -72,7 +72,7 @@ float* volume = &dummyVolume;
|
||||
float fftMin = -70.0;
|
||||
float fftMax = 0.0;
|
||||
watcher<double> offset(0.0, true);
|
||||
watcher<float> bw(8000000.0, true);
|
||||
float bw = 8000000;
|
||||
bool playing = false;
|
||||
watcher<bool> dcbias(false, false);
|
||||
bool showCredits = false;
|
||||
@ -101,6 +101,10 @@ void windowInit() {
|
||||
gui::menu.registerEntry("Display", displaymenu::draw, NULL);
|
||||
|
||||
gui::freqSelect.init();
|
||||
|
||||
// Set default values for waterfall in case no source init's it
|
||||
gui::waterfall.setBandwidth(8000000);
|
||||
gui::waterfall.setViewBandwidth(8000000);
|
||||
|
||||
fft_in = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * fftSize);
|
||||
fft_out = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * fftSize);
|
||||
@ -146,9 +150,7 @@ void windowInit() {
|
||||
gui::freqSelect.frequencyChanged = false;
|
||||
sigpath::sourceManager.tune(frequency);
|
||||
gui::waterfall.setCenterFrequency(frequency);
|
||||
gui::waterfall.setBandwidth(8000000);
|
||||
gui::waterfall.setViewBandwidth(8000000);
|
||||
bw.val = 8000000;
|
||||
bw = gui::waterfall.getBandwidth();
|
||||
gui::waterfall.vfoFreqChanged = false;
|
||||
gui::waterfall.centerFreqMoved = false;
|
||||
gui::waterfall.selectFirstVFO();
|
||||
@ -446,7 +448,10 @@ void drawWindow() {
|
||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Zoom").x / 2.0));
|
||||
ImGui::Text("Zoom");
|
||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10);
|
||||
ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw.val, gui::waterfall.getBandwidth(), 1000.0, "");
|
||||
if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, gui::waterfall.getBandwidth(), 1000.0, "")) {
|
||||
gui::waterfall.setViewBandwidth(bw);
|
||||
gui::waterfall.setViewOffset(vfo->centerOffset); // center vfo on screen
|
||||
}
|
||||
|
||||
ImGui::NewLine();
|
||||
|
||||
@ -474,11 +479,6 @@ void drawWindow() {
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
if (bw.changed()) {
|
||||
gui::waterfall.setViewBandwidth(bw.val);
|
||||
gui::waterfall.setViewOffset(vfo->centerOffset);
|
||||
}
|
||||
|
||||
gui::waterfall.setFFTMin(fftMin);
|
||||
gui::waterfall.setFFTMax(fftMax);
|
||||
gui::waterfall.setWaterfallMin(fftMin);
|
||||
@ -490,4 +490,8 @@ void drawWindow() {
|
||||
if (showCredits) {
|
||||
credits::show();
|
||||
}
|
||||
}
|
||||
|
||||
void setViewBandwidthSlider(float bandwidth) {
|
||||
bw = bandwidth;
|
||||
}
|
@ -4,4 +4,5 @@
|
||||
#define WINDOW_FLAGS ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground
|
||||
|
||||
void windowInit();
|
||||
void drawWindow();
|
||||
void drawWindow();
|
||||
void setViewBandwidthSlider(float bandwidth);
|
7
pluto_demo_release/band_colors.json
Normal file
7
pluto_demo_release/band_colors.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"broadcast": "#0000FFFF",
|
||||
"amateur": "#FF0000FF",
|
||||
"aviation": "#00FF00FF",
|
||||
"marine": "#00FFFFFF",
|
||||
"military": "#FFFF00FF"
|
||||
}
|
267
pluto_demo_release/bandplans/general.json
Normal file
267
pluto_demo_release/bandplans/general.json
Normal file
@ -0,0 +1,267 @@
|
||||
{
|
||||
"name": "General",
|
||||
"country_name": "Worldwide",
|
||||
"country_code": "--",
|
||||
"author_name": "Ryzerth",
|
||||
"author_url": "https://github.com/AlexandreRouma",
|
||||
"bands": [
|
||||
{
|
||||
"name": "Long Wave",
|
||||
"type": "broadcast",
|
||||
"start": 148500,
|
||||
"end": 283500
|
||||
},
|
||||
{
|
||||
"name": "Medium Wave",
|
||||
"type": "broadcast",
|
||||
"start": 526500,
|
||||
"end": 1606500
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 2300000,
|
||||
"end": 2468000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 3200000,
|
||||
"end": 3400000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 3950000,
|
||||
"end": 4000000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 4750000,
|
||||
"end": 4995000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 5005000,
|
||||
"end": 5060000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 5900000,
|
||||
"end": 6200000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 7200000,
|
||||
"end": 7450000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 9400000,
|
||||
"end": 9900000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 11600000,
|
||||
"end": 12100000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 13570000,
|
||||
"end": 13870000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 15100000,
|
||||
"end": 15800000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 17480000,
|
||||
"end": 17900000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 18900000,
|
||||
"end": 19020000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 21450000,
|
||||
"end": 21850000
|
||||
},
|
||||
{
|
||||
"name": "Shortwave Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 25670000,
|
||||
"end": 26100000
|
||||
},
|
||||
{
|
||||
"name": "FM Broadcast",
|
||||
"type": "broadcast",
|
||||
"start": 87500000,
|
||||
"end": 108000000
|
||||
},
|
||||
{
|
||||
"name": "Air Band VOR/ILS",
|
||||
"type": "aviation",
|
||||
"start": 108000000,
|
||||
"end": 118000000
|
||||
},
|
||||
{
|
||||
"name": "Air Band Voice",
|
||||
"type": "aviation",
|
||||
"start": 118000000,
|
||||
"end": 137000000
|
||||
},
|
||||
{
|
||||
"name": "160m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 1800000,
|
||||
"end": 2000000
|
||||
},
|
||||
{
|
||||
"name": "80m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 3500000,
|
||||
"end": 3950000
|
||||
},
|
||||
{
|
||||
"name": "60m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 5351500,
|
||||
"end": 5366500
|
||||
},
|
||||
{
|
||||
"name": "40m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 7000000,
|
||||
"end": 7200000
|
||||
},
|
||||
{
|
||||
"name": "30m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 10100000,
|
||||
"end": 10150000
|
||||
},
|
||||
{
|
||||
"name": "20m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 14000000,
|
||||
"end": 14350000
|
||||
},
|
||||
{
|
||||
"name": "17m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 18068000,
|
||||
"end": 18168000
|
||||
},
|
||||
{
|
||||
"name": "15m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 21000000,
|
||||
"end": 21450000
|
||||
},
|
||||
{
|
||||
"name": "12m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 24890000,
|
||||
"end": 24990000
|
||||
},
|
||||
{
|
||||
"name": "CB",
|
||||
"type": "amateur",
|
||||
"start": 26960000,
|
||||
"end": 27410000
|
||||
},
|
||||
{
|
||||
"name": "10m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 28000000,
|
||||
"end": 29750000
|
||||
},
|
||||
{
|
||||
"name": "6m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 50000000,
|
||||
"end": 54000000
|
||||
},
|
||||
{
|
||||
"name": "2m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 144000000,
|
||||
"end": 148000000
|
||||
},
|
||||
{
|
||||
"name": "Marine",
|
||||
"type": "marine",
|
||||
"start": 156000000,
|
||||
"end": 162025000
|
||||
},
|
||||
{
|
||||
"name": "1.25m Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 222000000,
|
||||
"end": 225000000
|
||||
},
|
||||
{
|
||||
"name": "Military Air",
|
||||
"type": "military",
|
||||
"start": 225000000,
|
||||
"end": 380000000
|
||||
},
|
||||
{
|
||||
"name": "Military Sat",
|
||||
"type": "military",
|
||||
"start": 240000000,
|
||||
"end": 270000000
|
||||
},
|
||||
{
|
||||
"name": "70cm Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 420000000,
|
||||
"end": 450000000
|
||||
},
|
||||
{
|
||||
"name": "PMR446",
|
||||
"type": "amateur",
|
||||
"start": 446000000,
|
||||
"end": 446200000
|
||||
},
|
||||
{
|
||||
"name": "33cm Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 902000000,
|
||||
"end": 928000000
|
||||
},
|
||||
{
|
||||
"name": "23cm Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 1240000000,
|
||||
"end": 1300000000
|
||||
},
|
||||
{
|
||||
"name": "13cm Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 2300000000,
|
||||
"end": 2310000000
|
||||
},
|
||||
{
|
||||
"name": "13cm Ham Band",
|
||||
"type": "amateur",
|
||||
"start": 2390000000,
|
||||
"end": 2450000000
|
||||
}
|
||||
]
|
||||
}
|
141
pluto_demo_release/bandplans/germany.json
Normal file
141
pluto_demo_release/bandplans/germany.json
Normal file
@ -0,0 +1,141 @@
|
||||
{
|
||||
"name": "Germany",
|
||||
"country_name": "Germany",
|
||||
"country_code": "DE",
|
||||
"author_name": "Tobias Mädel",
|
||||
"author_url": "https://tbspace.de",
|
||||
"bands": [
|
||||
{
|
||||
"name": "LW",
|
||||
"type": "amateur",
|
||||
"start": 135700,
|
||||
"end": 137800
|
||||
},
|
||||
{
|
||||
"name": "630m",
|
||||
"type": "amateur",
|
||||
"start": 472000,
|
||||
"end": 479000
|
||||
},
|
||||
{
|
||||
"name": "160m",
|
||||
"type": "amateur",
|
||||
"start": 1810000,
|
||||
"end": 2000000
|
||||
},
|
||||
{
|
||||
"name": "80m",
|
||||
"type": "amateur",
|
||||
"start": 3500000,
|
||||
"end": 3800000
|
||||
},
|
||||
{
|
||||
"name": "60m",
|
||||
"type": "amateur",
|
||||
"start": 5351500,
|
||||
"end": 5366500
|
||||
},
|
||||
{
|
||||
"name": "40m",
|
||||
"type": "amateur",
|
||||
"start": 7000000,
|
||||
"end": 7200000
|
||||
},
|
||||
{
|
||||
"name": "30m",
|
||||
"type": "amateur",
|
||||
"start": 10100000,
|
||||
"end": 10150000
|
||||
},
|
||||
{
|
||||
"name": "20m",
|
||||
"type": "amateur",
|
||||
"start": 14000000,
|
||||
"end": 14350000
|
||||
},
|
||||
{
|
||||
"name": "17m",
|
||||
"type": "amateur",
|
||||
"start": 18068000,
|
||||
"end": 18168000
|
||||
},
|
||||
{
|
||||
"name": "15m",
|
||||
"type": "amateur",
|
||||
"start": 21000000,
|
||||
"end": 21450000
|
||||
},
|
||||
{
|
||||
"name": "12m",
|
||||
"type": "amateur",
|
||||
"start": 24890000,
|
||||
"end": 24990000
|
||||
},
|
||||
{
|
||||
"name": "CB",
|
||||
"type": "other",
|
||||
"start": 26565000,
|
||||
"end": 27405000
|
||||
},
|
||||
{
|
||||
"name": "10m",
|
||||
"type": "amateur",
|
||||
"start": 28000000,
|
||||
"end": 29700000
|
||||
},
|
||||
{
|
||||
"name": "6m",
|
||||
"type": "amateur",
|
||||
"start": 50030000,
|
||||
"end": 51000000
|
||||
},
|
||||
{
|
||||
"name": "4m",
|
||||
"type": "amateur",
|
||||
"start": 70150000,
|
||||
"end": 70200000
|
||||
},
|
||||
{
|
||||
"name": "FM",
|
||||
"type": "broadcast",
|
||||
"start": 87500000,
|
||||
"end": 108000000
|
||||
},
|
||||
{
|
||||
"name": "2m",
|
||||
"type": "amateur",
|
||||
"start": 144000000,
|
||||
"end": 146000000
|
||||
},
|
||||
{
|
||||
"name": "Freenet",
|
||||
"type": "other",
|
||||
"start": 149025000,
|
||||
"end": 149115625
|
||||
},
|
||||
{
|
||||
"name": "70cm",
|
||||
"type": "amateur",
|
||||
"start": 430000000,
|
||||
"end": 440000000
|
||||
},
|
||||
{
|
||||
"name": "PMR446",
|
||||
"type": "other",
|
||||
"start": 446006250,
|
||||
"end": 446196875
|
||||
},
|
||||
{
|
||||
"name": "23cm",
|
||||
"type": "amateur",
|
||||
"start": 1240000000,
|
||||
"end": 1300000000
|
||||
},
|
||||
{
|
||||
"name": "13cm",
|
||||
"type": "amateur",
|
||||
"start": 2320000000,
|
||||
"end": 2450000000
|
||||
}
|
||||
]
|
||||
}
|
135
pluto_demo_release/bandplans/russia.json
Normal file
135
pluto_demo_release/bandplans/russia.json
Normal file
@ -0,0 +1,135 @@
|
||||
{
|
||||
"name": "Russia",
|
||||
"country_name": "Russia",
|
||||
"country_code": "RU",
|
||||
"author_name": "Raov",
|
||||
"author_url": "https://twitter.com/raov_birbtog",
|
||||
"bands": [
|
||||
{
|
||||
"name": "160m CW",
|
||||
"type": "amateur",
|
||||
"start": 1810000,
|
||||
"end": 1838000
|
||||
},
|
||||
{
|
||||
"name": "160m NB",
|
||||
"type": "amateur",
|
||||
"start": 1838000,
|
||||
"end": 1840000
|
||||
},
|
||||
{
|
||||
"name": "160m + Digi",
|
||||
"type": "amateur",
|
||||
"start": 1840000,
|
||||
"end": 1843000
|
||||
},
|
||||
{
|
||||
"name": "160m",
|
||||
"type": "amateur",
|
||||
"start": 1843000,
|
||||
"end": 2000000
|
||||
},
|
||||
{
|
||||
"name": "80m CW",
|
||||
"type": "amateur",
|
||||
"start": 3500000,
|
||||
"end": 3510000
|
||||
},
|
||||
{
|
||||
"name": "80m CW Contest",
|
||||
"type": "amateur",
|
||||
"start": 3510000,
|
||||
"end": 3560000
|
||||
},
|
||||
{
|
||||
"name": "80m CW",
|
||||
"type": "amateur",
|
||||
"start": 3560000,
|
||||
"end": 3570000
|
||||
},
|
||||
{
|
||||
"name": "80m NB, Digi 200Hz",
|
||||
"type": "amateur",
|
||||
"start": 3570000,
|
||||
"end": 3580000
|
||||
},
|
||||
{
|
||||
"name": "80m NB, Digi 500Hz",
|
||||
"type": "amateur",
|
||||
"start": 3580000,
|
||||
"end": 3600000
|
||||
},
|
||||
{
|
||||
"name": "80m SSB Contest",
|
||||
"type": "amateur",
|
||||
"start": 3600000,
|
||||
"end": 3650000
|
||||
},
|
||||
{
|
||||
"name": "80m",
|
||||
"type": "amateur",
|
||||
"start": 3650000,
|
||||
"end": 3700000
|
||||
},
|
||||
{
|
||||
"name": "80m SSB Contest",
|
||||
"type": "amateur",
|
||||
"start": 3700000,
|
||||
"end": 3800000
|
||||
},
|
||||
{
|
||||
"name": "60m CW 200Hz",
|
||||
"type": "amateur",
|
||||
"start": 5351500,
|
||||
"end": 5354000
|
||||
},
|
||||
{
|
||||
"name": "60m USB",
|
||||
"type": "amateur",
|
||||
"start": 5354000,
|
||||
"end": 5366000
|
||||
},
|
||||
{
|
||||
"name": "60m CW 20Hz",
|
||||
"type": "amateur",
|
||||
"start": 5356000,
|
||||
"end": 5366500
|
||||
},
|
||||
{
|
||||
"name": "40m CW",
|
||||
"type": "amateur",
|
||||
"start": 7000000,
|
||||
"end": 7040000
|
||||
},
|
||||
{
|
||||
"name": "40m NB, Digi 500Hz",
|
||||
"type": "amateur",
|
||||
"start": 7040000,
|
||||
"end": 7050000
|
||||
},
|
||||
{
|
||||
"name": "40m",
|
||||
"type": "amateur",
|
||||
"start": 7050000,
|
||||
"end": 7060000
|
||||
},
|
||||
{
|
||||
"name": "40m SSB Contest",
|
||||
"type": "amateur",
|
||||
"start": 7060000,
|
||||
"end": 7100000
|
||||
},
|
||||
{
|
||||
"name": "40m",
|
||||
"type": "amateur",
|
||||
"start": 7100000,
|
||||
"end": 7130000
|
||||
},
|
||||
{
|
||||
"name": "40m SSB Contest",
|
||||
"type": "amateur",
|
||||
"start": 7130000,
|
||||
"end": 7200000
|
||||
}
|
||||
]
|
||||
}
|
31
pluto_demo_release/config.json
Normal file
31
pluto_demo_release/config.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"audio": {
|
||||
"Radio": {
|
||||
"device": "Speakers (Realtek High Definiti",
|
||||
"sampleRate": 48000.0,
|
||||
"volume": 0.69921875
|
||||
}
|
||||
},
|
||||
"bandPlan": "General",
|
||||
"bandPlanEnabled": true,
|
||||
"defaultSink": "Audio",
|
||||
"fftHeight": 296,
|
||||
"frequency": 99000000,
|
||||
"max": 0.0,
|
||||
"maximized": false,
|
||||
"menuOrder": [
|
||||
"Source",
|
||||
"Radio",
|
||||
"Recorder",
|
||||
"Audio",
|
||||
"Band Plan",
|
||||
"Display"
|
||||
],
|
||||
"menuWidth": 300,
|
||||
"min": -70.0,
|
||||
"showWaterfall": true,
|
||||
"windowSize": {
|
||||
"h": 720,
|
||||
"w": 1280
|
||||
}
|
||||
}
|
7
pluto_demo_release/module_list.json
Normal file
7
pluto_demo_release/module_list.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Radio": "./modules/radio.dll",
|
||||
"Recorder": "./modules/recorder.dll",
|
||||
"Soapy": "./modules/soapy.dll",
|
||||
"RTLTCPSource": "./modules/rtl_tcp_source.dll",
|
||||
"PlutoSDRSource": "./modules/plutosdr_source.dll"
|
||||
}
|
BIN
pluto_demo_release/res/fonts/Roboto-Medium.ttf
Normal file
BIN
pluto_demo_release/res/fonts/Roboto-Medium.ttf
Normal file
Binary file not shown.
BIN
pluto_demo_release/res/icons/menu.png
Normal file
BIN
pluto_demo_release/res/icons/menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
pluto_demo_release/res/icons/play.png
Normal file
BIN
pluto_demo_release/res/icons/play.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
pluto_demo_release/res/icons/sdrpp.ico
Normal file
BIN
pluto_demo_release/res/icons/sdrpp.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
BIN
pluto_demo_release/res/icons/sdrpp.png
Normal file
BIN
pluto_demo_release/res/icons/sdrpp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
pluto_demo_release/res/icons/stop.png
Normal file
BIN
pluto_demo_release/res/icons/stop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@ -23,12 +23,20 @@ const char* gainModes[] = {
|
||||
|
||||
const char* gainModesTxt = "Manual\0Fast Attack\0Slow Attack\0Hybrid\0";
|
||||
|
||||
ConfigManager config;
|
||||
|
||||
class PlutoSDRSourceModule {
|
||||
public:
|
||||
PlutoSDRSourceModule(std::string name) {
|
||||
this->name = name;
|
||||
|
||||
sampleRate = 4000000.0;
|
||||
config.aquire();
|
||||
std::string _ip = config.conf["IP"];
|
||||
strcpy(&ip[3], _ip.c_str());
|
||||
sampleRate = config.conf["sampleRate"];
|
||||
gainMode = config.conf["gainMode"];
|
||||
gain = config.conf["gain"];
|
||||
config.release();
|
||||
|
||||
handler.ctx = this;
|
||||
handler.selectHandler = menuSelected;
|
||||
@ -136,7 +144,11 @@ private:
|
||||
ImGui::Text("IP");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
ImGui::InputText(CONCAT("##_pluto_ip_", _this->name), &_this->ip[3], 16);
|
||||
if (ImGui::InputText(CONCAT("##_pluto_ip_", _this->name), &_this->ip[3], 16)) {
|
||||
config.aquire();
|
||||
config.conf["IP"] = &_this->ip[3];
|
||||
config.release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Samplerate");
|
||||
ImGui::SameLine();
|
||||
@ -144,6 +156,9 @@ private:
|
||||
if (_this->running) { style::beginDisabled(); }
|
||||
if (ImGui::InputFloat(CONCAT("##_samplerate_select_", _this->name), &_this->sampleRate, 1, 1000, 0)) {
|
||||
core::setInputSampleRate(_this->sampleRate);
|
||||
config.aquire();
|
||||
config.conf["sampleRate"] = _this->sampleRate;
|
||||
config.release(true);
|
||||
}
|
||||
if (_this->running) { style::endDisabled(); }
|
||||
|
||||
@ -154,6 +169,9 @@ private:
|
||||
if (_this->running) {
|
||||
iio_channel_attr_write(iio_device_find_channel(_this->phy, "voltage0", false), "gain_control_mode", gainModes[_this->gainMode]);
|
||||
}
|
||||
config.aquire();
|
||||
config.conf["gainMode"] = _this->gainMode;
|
||||
config.release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("PGA Gain");
|
||||
@ -162,9 +180,11 @@ private:
|
||||
if (_this->gainMode) { style::beginDisabled(); }
|
||||
if (ImGui::SliderFloat(CONCAT("##_gain_select_", _this->name), &_this->gain, 0, 76)) {
|
||||
if (_this->running) {
|
||||
// SET PLUTO GAIN HERE
|
||||
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false),"hardwaregain", round(_this->gain));
|
||||
}
|
||||
config.aquire();
|
||||
config.conf["gain"] = _this->gain;
|
||||
config.release(true);
|
||||
}
|
||||
if (_this->gainMode) { style::endDisabled(); }
|
||||
}
|
||||
@ -218,13 +238,19 @@ private:
|
||||
bool ipMode = true;
|
||||
double freq;
|
||||
char ip[1024] = "ip:192.168.2.1";
|
||||
int port = 1234;
|
||||
int gainMode = 0;
|
||||
float gain = 0;
|
||||
};
|
||||
|
||||
MOD_EXPORT void _INIT_() {
|
||||
// Do your one time init here
|
||||
json defConf;
|
||||
defConf["IP"] = "192.168.2.1";
|
||||
defConf["sampleRate"] = 4000000.0f;
|
||||
defConf["gainMode"] = 0;
|
||||
defConf["gain"] = 0.0f;
|
||||
config.setPath(ROOT_DIR "/plutosdr_source_config.json");
|
||||
config.load(defConf);
|
||||
config.enableAutoSave();
|
||||
}
|
||||
|
||||
MOD_EXPORT void* _CREATE_INSTANCE_(std::string name) {
|
||||
@ -236,5 +262,6 @@ MOD_EXPORT void _DELETE_INSTANCE_(void* instance) {
|
||||
}
|
||||
|
||||
MOD_EXPORT void _STOP_() {
|
||||
// Do your one shutdown here
|
||||
config.disableAutoSave();
|
||||
config.save();
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
"Radio": {
|
||||
"device": "Speakers (Realtek High Definiti",
|
||||
"sampleRate": 48000.0,
|
||||
"volume": 0.546875
|
||||
"volume": 0.4609375
|
||||
},
|
||||
"Radio 1": {
|
||||
"device": "Speakers (Realtek High Definition Audio)",
|
||||
@ -20,7 +20,7 @@
|
||||
"bandPlanEnabled": true,
|
||||
"defaultSink": "Audio",
|
||||
"fftHeight": 296,
|
||||
"frequency": 1090020000,
|
||||
"frequency": 99000000,
|
||||
"max": 0.0,
|
||||
"maximized": false,
|
||||
"menuOrder": [
|
||||
|
6
root_dev/plutosdr_source_config.json
Normal file
6
root_dev/plutosdr_source_config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"IP": "192.168.2.1",
|
||||
"gain": 0.0,
|
||||
"gainMode": 2,
|
||||
"sampleRate": 4000000.0
|
||||
}
|
Loading…
Reference in New Issue
Block a user