mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 18:47:33 -05:00
#1362 Updates heterodyne channelizer with alternate sorted set implementation to resolve issue when determining if the tuner can tune a requested channel. (#1363)
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -20,15 +20,17 @@ package io.github.dsheirer.source.tuner.manager;
|
|||||||
|
|
||||||
import io.github.dsheirer.source.tuner.TunerController;
|
import io.github.dsheirer.source.tuner.TunerController;
|
||||||
import io.github.dsheirer.source.tuner.channel.TunerChannel;
|
import io.github.dsheirer.source.tuner.channel.TunerChannel;
|
||||||
|
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates tuner center frequency for a set of tuner channels.
|
* Calculates tuner center frequency for a set of tuner channels.
|
||||||
*/
|
*/
|
||||||
public class CenterFrequencyCalculator
|
public class CenterFrequencyCalculator
|
||||||
{
|
{
|
||||||
|
private static final Logger mLog = LoggerFactory.getLogger(CenterFrequencyCalculator.class);
|
||||||
public static final long INVALID_FREQUENCY = -1;
|
public static final long INVALID_FREQUENCY = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -145,7 +147,20 @@ public class CenterFrequencyCalculator
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SortedSet<TunerChannel> allChannels = new TreeSet<>(channels);
|
SortedSet<TunerChannel> allChannels = new TreeSet<>();
|
||||||
|
|
||||||
|
for(TunerChannel tunerChannel: allChannels)
|
||||||
|
{
|
||||||
|
if(tunerChannel != null)
|
||||||
|
{
|
||||||
|
allChannels.add(tunerChannel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mLog.error("Null tuner channel encountered - continuing");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
allChannels.add(channel);
|
allChannels.add(channel);
|
||||||
|
|
||||||
//If the bandwidth of the channel set is less than or equal to the tuner's usable bandwidth, then
|
//If the bandwidth of the channel set is less than or equal to the tuner's usable bandwidth, then
|
||||||
|
|||||||
Reference in New Issue
Block a user