diff --git a/discord_integration/src/main.cpp b/discord_integration/src/main.cpp index 55c29c0e..d7f2c7d6 100644 --- a/discord_integration/src/main.cpp +++ b/discord_integration/src/main.cpp @@ -75,24 +75,24 @@ private: void updatePresence() { double selectedFreq = gui::freqSelect.frequency; std::string selectedName = gui::waterfall.selectedVFO; - if (selectedFreq != lastFreq) { - lastFreq = selectedFreq; - - strcpy(mode, "Raw"); - - if (core::modComManager.interfaceExists(selectedName)) { - if (core::modComManager.getModuleName(selectedName) == "radio") { - int modeNum; - core::modComManager.callInterface(selectedName, RADIO_IFACE_CMD_GET_MODE, NULL, &modeNum); - if (modeNum == RADIO_IFACE_MODE_NFM) { strcpy(mode, "NFM"); } - else if (modeNum == RADIO_IFACE_MODE_WFM) { strcpy(mode, "FM"); } - else if (modeNum == RADIO_IFACE_MODE_AM) { strcpy(mode, "AM"); } - else if (modeNum == RADIO_IFACE_MODE_DSB) { strcpy(mode, "DSB"); } - else if (modeNum == RADIO_IFACE_MODE_USB) { strcpy(mode, "USB"); } - else if (modeNum == RADIO_IFACE_MODE_CW) { strcpy(mode, "CW"); } - else if (modeNum == RADIO_IFACE_MODE_LSB) { strcpy(mode, "LSB"); } - } + strcpy(mode, "Raw"); + if (core::modComManager.interfaceExists(selectedName)) { + if (core::modComManager.getModuleName(selectedName) == "radio") { + int modeNum; + core::modComManager.callInterface(selectedName, RADIO_IFACE_CMD_GET_MODE, NULL, &modeNum); + if (modeNum == RADIO_IFACE_MODE_NFM) { strcpy(mode, "NFM"); } + else if (modeNum == RADIO_IFACE_MODE_WFM) { strcpy(mode, "FM"); } + else if (modeNum == RADIO_IFACE_MODE_AM) { strcpy(mode, "AM"); } + else if (modeNum == RADIO_IFACE_MODE_DSB) { strcpy(mode, "DSB"); } + else if (modeNum == RADIO_IFACE_MODE_USB) { strcpy(mode, "USB"); } + else if (modeNum == RADIO_IFACE_MODE_CW) { strcpy(mode, "CW"); } + else if (modeNum == RADIO_IFACE_MODE_LSB) { strcpy(mode, "LSB"); } } + } + + if (selectedFreq != lastFreq || mode != lastMode) { + lastFreq = selectedFreq; + lastMode = mode; // Print out frequency to buffer if (selectedFreq >= 1000000.0) { @@ -134,6 +134,7 @@ private: double lastFreq; char* freq = new char[1024]; char* mode = new char[1024]; + std::string lastMode = ""; // Threading int workerCounter = 0; diff --git a/meteor_demodulator/src/main.cpp b/meteor_demodulator/src/main.cpp index e520dc55..f6a5caf0 100644 --- a/meteor_demodulator/src/main.cpp +++ b/meteor_demodulator/src/main.cpp @@ -71,7 +71,8 @@ public: } void enable() { - vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 150000, INPUT_SAMPLE_RATE, 150000, 150000, true); + double bw = gui::waterfall.getBandwidth(); + vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, std::clamp(savedOffset, -bw/2.0, bw/2.0), 150000, INPUT_SAMPLE_RATE, 150000, 150000, true); demod.setInput(vfo->output); @@ -91,6 +92,7 @@ public: symSink.stop(); sink.stop(); + savedOffset = vfo->getOffset(); sigpath::vfoManager.deleteVFO(vfo); enabled = false; } @@ -167,7 +169,7 @@ private: std::string name; bool enabled = true; - + double savedOffset = 0; // DSP Chain diff --git a/radio/src/main.cpp b/radio/src/main.cpp index 50012d66..8cabb0fd 100644 --- a/radio/src/main.cpp +++ b/radio/src/main.cpp @@ -194,7 +194,7 @@ private: bool enabled = true; int demodId = 0; float audioSampRate = 48000; - double savedOffset; + double savedOffset = 0; Demodulator* currentDemod = NULL; VFOManager::VFO* vfo;