Added scroll to sliders

This commit is contained in:
Ryzerth
2021-02-07 12:30:25 +01:00
parent c26855d07e
commit 9def1843b2
10 changed files with 198 additions and 16 deletions

View File

@ -8,6 +8,7 @@
#include <config.h>
#include <options.h>
#include <libairspyhf/airspyhf.h>
#include <gui/widgets/stepped_slider.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -225,7 +226,7 @@ private:
if (_this->agcMode > 0) {
airspyhf_set_hf_agc_threshold(_this->openDev, _this->agcMode - 1);
}
airspyhf_set_hf_att(_this->openDev, _this->atten / 6);
airspyhf_set_hf_att(_this->openDev, _this->atten / 6.0f);
airspyhf_set_hf_lna(_this->openDev, _this->hfLNA);
airspyhf_start(_this->openDev, callback, _this);
@ -328,10 +329,9 @@ private:
ImGui::Text("Attenuation");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderInt(CONCAT("##_airspyhf_attn_", _this->name), &_this->atten, 0, 48, "%d dB")) {
_this->atten = (_this->atten / 6) * 6;
if (ImGui::SliderFloatWithSteps(CONCAT("##_airspyhf_attn_", _this->name), &_this->atten, 0, 48, 6, "%.0f dB")) {
if (_this->running) {
airspyhf_set_hf_att(_this->openDev, _this->atten / 6);
airspyhf_set_hf_att(_this->openDev, _this->atten / 6.0f);
}
if (_this->selectedSerStr != "") {
config.aquire();
@ -361,7 +361,7 @@ private:
int srId = 0;
int agcMode = AGC_MODE_OFF;
bool hfLNA = false;
int atten = 0;
float atten = 0.0f;
std::string selectedSerStr = "";
std::vector<uint64_t> devList;