more bugfix

This commit is contained in:
Ryzerth 2021-07-20 21:39:16 +02:00
parent 0d7f1265da
commit 5f1a94c267
2 changed files with 21 additions and 21 deletions

View File

@ -25,20 +25,20 @@ public:
_config->acquire(); _config->acquire();
if(_config->conf.contains(prefix)) { if(_config->conf.contains(prefix)) {
if(!_config->conf[prefix].contains("USB")) { if(!_config->conf[prefix].contains("CW")) {
_config->conf[prefix]["USB"]["bandwidth"] = bw; _config->conf[prefix]["CW"]["bandwidth"] = bw;
_config->conf[prefix]["USB"]["snapInterval"] = snapInterval; _config->conf[prefix]["CW"]["snapInterval"] = snapInterval;
_config->conf[prefix]["USB"]["squelchLevel"] = squelchLevel; _config->conf[prefix]["CW"]["squelchLevel"] = squelchLevel;
} }
json conf = _config->conf[prefix]["USB"]; json conf = _config->conf[prefix]["CW"];
if (conf.contains("bandwidth")) { bw = conf["bandwidth"]; } if (conf.contains("bandwidth")) { bw = conf["bandwidth"]; }
if (conf.contains("snapInterval")) { snapInterval = conf["snapInterval"]; } if (conf.contains("snapInterval")) { snapInterval = conf["snapInterval"]; }
if (conf.contains("squelchLevel")) { squelchLevel = conf["squelchLevel"]; } if (conf.contains("squelchLevel")) { squelchLevel = conf["squelchLevel"]; }
} }
else { else {
_config->conf[prefix]["USB"]["bandwidth"] = bw; _config->conf[prefix]["CW"]["bandwidth"] = bw;
_config->conf[prefix]["USB"]["snapInterval"] = snapInterval; _config->conf[prefix]["CW"]["snapInterval"] = snapInterval;
_config->conf[prefix]["USB"]["squelchLevel"] = squelchLevel; _config->conf[prefix]["CW"]["squelchLevel"] = squelchLevel;
} }
_config->release(true); _config->release(true);
@ -127,18 +127,18 @@ public:
float menuWidth = ImGui::GetContentRegionAvailWidth(); float menuWidth = ImGui::GetContentRegionAvailWidth();
ImGui::SetNextItemWidth(menuWidth); ImGui::SetNextItemWidth(menuWidth);
if (ImGui::InputFloat(("##_radio_usb_bw_" + uiPrefix).c_str(), &bw, 1, 100, "%.0f", 0)) { if (ImGui::InputFloat(("##_radio_cw_bw_" + uiPrefix).c_str(), &bw, 1, 100, "%.0f", 0)) {
bw = std::clamp<float>(bw, bwMin, bwMax); bw = std::clamp<float>(bw, bwMin, bwMax);
setBandwidth(bw); setBandwidth(bw);
_config->acquire(); _config->acquire();
_config->conf[uiPrefix]["USB"]["bandwidth"] = bw; _config->conf[uiPrefix]["CW"]["bandwidth"] = bw;
_config->release(true); _config->release(true);
}if (running) { }if (running) {
if (_vfo->getBandwidthChanged()) { if (_vfo->getBandwidthChanged()) {
bw = _vfo->getBandwidth(); bw = _vfo->getBandwidth();
setBandwidth(bw, false); setBandwidth(bw, false);
_config->acquire(); _config->acquire();
_config->conf[uiPrefix]["USB"]["bandwidth"] = bw; _config->conf[uiPrefix]["CW"]["bandwidth"] = bw;
_config->release(true); _config->release(true);
} }
} }
@ -146,21 +146,21 @@ public:
ImGui::Text("Snap Interval"); ImGui::Text("Snap Interval");
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::InputFloat(("##_radio_usb_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) { if (ImGui::InputFloat(("##_radio_cw_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) {
if (snapInterval < 1) { snapInterval = 1; } if (snapInterval < 1) { snapInterval = 1; }
setSnapInterval(snapInterval); setSnapInterval(snapInterval);
_config->acquire(); _config->acquire();
_config->conf[uiPrefix]["USB"]["snapInterval"] = snapInterval; _config->conf[uiPrefix]["CW"]["snapInterval"] = snapInterval;
_config->release(true); _config->release(true);
} }
ImGui::Text("Squelch"); ImGui::Text("Squelch");
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderFloat(("##_radio_usb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) { if (ImGui::SliderFloat(("##_radio_cw_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
squelch.setLevel(squelchLevel); squelch.setLevel(squelchLevel);
_config->acquire(); _config->acquire();
_config->conf[uiPrefix]["USB"]["squelchLevel"] = squelchLevel; _config->conf[uiPrefix]["CW"]["squelchLevel"] = squelchLevel;
_config->release(true); _config->release(true);
} }
} }

View File

@ -25,17 +25,17 @@ public:
_config->acquire(); _config->acquire();
if(_config->conf.contains(prefix)) { if(_config->conf.contains(prefix)) {
if(!_config->conf[prefix].contains("CW")) { if(!_config->conf[prefix].contains("RAW")) {
_config->conf[prefix]["CW"]["snapInterval"] = snapInterval; _config->conf[prefix]["RAW"]["snapInterval"] = snapInterval;
_config->conf[prefix]["CW"]["squelchLevel"] = squelchLevel; _config->conf[prefix]["RAW"]["squelchLevel"] = squelchLevel;
} }
json conf = _config->conf[prefix]["CW"]; json conf = _config->conf[prefix]["RAW"];
if (conf.contains("snapInterval")) { snapInterval = conf["snapInterval"]; } if (conf.contains("snapInterval")) { snapInterval = conf["snapInterval"]; }
if (conf.contains("squelchLevel")) { squelchLevel = conf["squelchLevel"]; } if (conf.contains("squelchLevel")) { squelchLevel = conf["squelchLevel"]; }
} }
else { else {
_config->conf[prefix]["CW"]["snapInterval"] = snapInterval; _config->conf[prefix]["RAW"]["snapInterval"] = snapInterval;
_config->conf[prefix]["CW"]["squelchLevel"] = squelchLevel; _config->conf[prefix]["RAW"]["squelchLevel"] = squelchLevel;
} }
_config->release(true); _config->release(true);