mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2026-04-19 23:02:43 +00:00
Fixed radio bandwidth not adjusted when the menu is closed or hidden
This commit is contained in:
@@ -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;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user