Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override setGain and getGainRange to avoid changing RFGR. #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,12 @@ void SoapySDRPlay::setGain(const int direction, const size_t channel, const std:
}
}

void SoapySDRPlay::setGain(const int direction, const size_t channel, const double value)
{
// Only IFGR should be used for adjusting the overall system gain.
this->setGain(direction, channel, "IFGR", value);
}

double SoapySDRPlay::getGain(const int direction, const size_t channel, const std::string &name) const
{
std::lock_guard <std::mutex> lock(_general_state_mutex);
Expand All @@ -669,6 +675,12 @@ double SoapySDRPlay::getGain(const int direction, const size_t channel, const st
return 0;
}

double SoapySDRPlay::getGain(const int direction, const size_t channel) const
{
// Only IFGR should be used for adjusting the overall system gain.
return this->getGain(direction, channel, "IFGR");
}

SoapySDR::Range SoapySDRPlay::getGainRange(const int direction, const size_t channel, const std::string &name) const
{
if (name == "IFGR")
Expand Down Expand Up @@ -698,6 +710,12 @@ SoapySDR::Range SoapySDRPlay::getGainRange(const int direction, const size_t cha
return SoapySDR::Range(20, 59);
}

SoapySDR::Range SoapySDRPlay::getGainRange(const int direction, const size_t channel) const
{
// Only IFGR should be used for adjusting the overall system gain.
return this->getGainRange(direction, channel, "IFGR");
}

/*******************************************************************
* Frequency API
******************************************************************/
Expand Down
6 changes: 6 additions & 0 deletions SoapySDRPlay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,16 @@ class SoapySDRPlay: public SoapySDR::Device

void setGain(const int direction, const size_t channel, const std::string &name, const double value);

void setGain(const int direction, const size_t channel, const double value);

double getGain(const int direction, const size_t channel, const std::string &name) const;

double getGain(const int direction, const size_t channel) const;

SoapySDR::Range getGainRange(const int direction, const size_t channel, const std::string &name) const;

SoapySDR::Range getGainRange(const int direction, const size_t channel) const;

/*******************************************************************
* Frequency API
******************************************************************/
Expand Down