mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 11:07:35 -05:00
#172 Allow users to adjust tuner min/max frequency ranges so that they can ensure tuners stay put and support channels in a predicatable manner. (#1850)
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -74,6 +74,17 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
|
||||
mFrequencyErrorCorrectionManager = new FrequencyErrorCorrectionManager(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the frequency controller with the new minimum and maximum values.
|
||||
* @param minimum frequency Hertz
|
||||
* @param maximum frequency Hertz
|
||||
*/
|
||||
public void setFrequencyExtents(long minimum, long maximum)
|
||||
{
|
||||
mFrequencyController.setMinimumFrequency(minimum);
|
||||
mFrequencyController.setMaximumFrequency(maximum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock for the frequency controller. This should only be used by the channel source manager to lock access to the
|
||||
* frequency controller while creating a channel source, to block multi-threaded access to the frequency controller
|
||||
@@ -175,7 +186,31 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
|
||||
*/
|
||||
public void apply(TunerConfiguration config) throws SourceException
|
||||
{
|
||||
setFrequency(config.getFrequency());
|
||||
//Set the frequency from the config. If the config frequency generates an error, try setting the default
|
||||
//frequency before we give up on the tuner as having an error.
|
||||
try
|
||||
{
|
||||
setFrequency(config.getFrequency());
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
mLog.warn("Unable to restore previous frequency [" + config.getFrequency() + "] trying default frequency");
|
||||
if(config.getFrequency() != TunerConfiguration.DEFAULT_FREQUENCY)
|
||||
{
|
||||
setFrequency(TunerConfiguration.DEFAULT_FREQUENCY);
|
||||
//If we're successful to here, update the config with the default frequency.
|
||||
config.setFrequency(TunerConfiguration.DEFAULT_FREQUENCY);
|
||||
}
|
||||
}
|
||||
|
||||
if(config.getMinimumFrequency() > 0)
|
||||
{
|
||||
setMinimumFrequency(config.getMinimumFrequency());
|
||||
}
|
||||
if(config.getMaximumFrequency() > 0)
|
||||
{
|
||||
setMaximumFrequency(config.getMaximumFrequency());
|
||||
}
|
||||
setFrequencyCorrection(config.getFrequencyCorrection());
|
||||
getFrequencyErrorCorrectionManager().setEnabled(config.getAutoPPMCorrectionEnabled());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user