From ce3fea374706ad12363533b2a1a0f3205daad39f Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 1 Sep 2022 18:12:59 +0200 Subject: [PATCH] fixed lowpass setting not presistent for NFM --- decoder_modules/radio/src/demodulators/nfm.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/decoder_modules/radio/src/demodulators/nfm.h b/decoder_modules/radio/src/demodulators/nfm.h index d504d41c..29e5f9ad 100644 --- a/decoder_modules/radio/src/demodulators/nfm.h +++ b/decoder_modules/radio/src/demodulators/nfm.h @@ -15,6 +15,16 @@ namespace demod { void init(std::string name, ConfigManager* config, dsp::stream* input, double bandwidth, double audioSR) { this->name = name; + this->_config = config; + + // Load config + _config->acquire(); + bool modified = false; + if (config->conf[name][getName()].contains("lowPass")) { + _lowPass = config->conf[name][getName()]["lowPass"]; + } + _config->release(modified); + // Define structure demod.init(input, getIFSampleRate(), bandwidth, _lowPass); @@ -27,9 +37,9 @@ namespace demod { void showMenu() { if (ImGui::Checkbox(("Low Pass##_radio_wfm_lowpass_" + name).c_str(), &_lowPass)) { demod.setLowPass(_lowPass); - // _config->acquire(); - // _config->conf[name][getName()]["lowPass"] = _lowPass; - // _config->release(true); + _config->acquire(); + _config->conf[name][getName()]["lowPass"] = _lowPass; + _config->release(true); } } @@ -62,6 +72,8 @@ namespace demod { private: dsp::demod::FM demod; + ConfigManager* _config = NULL; + bool _lowPass = true; std::string name;