Potential fix for windows 7 not detecting the home key and the radio not saving the bandwidth when set through the frequency manager

This commit is contained in:
Ryzerth 2021-07-31 21:00:47 +02:00
parent 85eb08e422
commit f16c296f38
12 changed files with 73 additions and 4 deletions

View File

@ -82,8 +82,9 @@ namespace displaymenu {
void draw(void* ctx) {
float menuWidth = ImGui::GetContentRegionAvailWidth();
if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall) || ImGui::IsKeyPressed(GLFW_KEY_HOME, false)) {
if (ImGui::IsKeyPressed(GLFW_KEY_HOME, false)) { showWaterfall = !showWaterfall; }
bool homePressed = ImGui::IsKeyPressed(GLFW_KEY_HOME, false);
if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall) || homePressed) {
if (homePressed) { showWaterfall = !showWaterfall; }
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();
core::configManager.acquire();
core::configManager.conf["showWaterfall"] = showWaterfall;

View File

@ -389,8 +389,9 @@ namespace ImGui {
}
// If the left and right keys are pressed while hovering the freq scale, move it too
if ((ImGui::IsKeyPressed(GLFW_KEY_LEFT) || ImGui::IsKeyPressed(GLFW_KEY_RIGHT)) && mouseInFreq) {
viewOffset += ImGui::IsKeyPressed(GLFW_KEY_LEFT) ? (viewBandwidth / 20.0) : (-viewBandwidth / 20.0);
bool leftKeyPressed = ImGui::IsKeyPressed(GLFW_KEY_LEFT);
if ((leftKeyPressed || ImGui::IsKeyPressed(GLFW_KEY_RIGHT)) && mouseInFreq) {
viewOffset += leftKeyPressed ? (viewBandwidth / 20.0) : (-viewBandwidth / 20.0);
if (viewOffset + (viewBandwidth / 2.0) > wholeBandwidth / 2.0) {
double freqOffset = (viewOffset + (viewBandwidth / 2.0)) - (wholeBandwidth / 2.0);

View File

@ -173,6 +173,14 @@ public:
resamp.updateWindow(&win);
}
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;
if (lock) { _config->release(true); }
}
private:
void setSnapInterval(float snapInt) {
snapInterval = snapInt;

View File

@ -176,6 +176,14 @@ public:
resamp.updateWindow(&win);
}
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;
if (lock) { _config->release(true); }
}
private:
void setSnapInterval(float snapInt) {
snapInterval = snapInt;

View File

@ -168,6 +168,14 @@ public:
_vfo->setBandwidth(bw, updateWaterfall);
}
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;
if (lock) { _config->release(true); }
}
private:
void setSnapInterval(float snapInt) {
snapInterval = snapInt;

View File

@ -162,6 +162,14 @@ public:
setAudioSampleRate(audioSampRate);
}
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;
if (lock) { _config->release(true); }
}
private:
void setSnapInterval(float snapInt) {
snapInterval = snapInt;

View File

@ -173,6 +173,14 @@ public:
resamp.updateWindow(&win);
}
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;
if (lock) { _config->release(true); }
}
private:
void setSnapInterval(float snapInt) {
snapInterval = snapInt;

View File

@ -179,6 +179,7 @@ private:
else if (code == RADIO_IFACE_CMD_SET_BANDWIDTH) {
float* _in = (float*)in;
_this->currentDemod->setBandwidth(*_in, true);
_this->currentDemod->saveParameters();
}
}

View File

@ -15,4 +15,5 @@ public:
virtual void setBandwidth(float bandWidth, bool updateWaterfall = true) = 0;
virtual dsp::stream<dsp::stereo_t>* getOutput() = 0;
virtual void showMenu() = 0;
virtual void saveParameters(bool lock = true) = 0;
};

View File

@ -118,6 +118,13 @@ public:
// Do nothing
}
void saveParameters(bool lock = true) {
if (lock) { _config->acquire(); }
_config->conf[uiPrefix]["WFM"]["snapInterval"] = snapInterval;
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
if (lock) { _config->release(true); }
}
private:
void setSnapInterval(float snapInt) {
snapInterval = snapInt;

View File

@ -173,6 +173,14 @@ public:
resamp.updateWindow(&win);
}
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;
if (lock) { _config->release(true); }
}
private:
void setSnapInterval(float snapInt) {
snapInterval = snapInt;

View File

@ -246,6 +246,16 @@ 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"]["deempMode"] = deempId;
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
_config->conf[uiPrefix]["WFM"]["stereo"] = stereo;
if (lock) { _config->release(true); }
}
private:
const float bwMax = 250000;