mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 10:37:26 -05:00
Closes #70 - airspy mini sample rates.
Change code to no longer assume that 10 MHz is an available default sample rate. The mini is only capable of 6 and 3 MHz. Note: only the 6 MHz sample rate option should be used at this time. 6 MHz can be decimated to 48 kHz using an integer decimator. sdrtrunk doesn't support the 3 MHz option, because it can't decimate that rate to 48 kHz until the new channelizer is developed.
This commit is contained in:
@@ -298,7 +298,14 @@ public class AirspyTunerController extends TunerController
|
|||||||
|
|
||||||
if( rate == null )
|
if( rate == null )
|
||||||
{
|
{
|
||||||
rate = DEFAULT_SAMPLE_RATE;
|
if( !mSampleRates.isEmpty() )
|
||||||
|
{
|
||||||
|
rate = mSampleRates.get( 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rate = DEFAULT_SAMPLE_RATE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -359,6 +366,7 @@ public class AirspyTunerController extends TunerController
|
|||||||
@Override
|
@Override
|
||||||
public void setTunedFrequency( long frequency ) throws SourceException
|
public void setTunedFrequency( long frequency ) throws SourceException
|
||||||
{
|
{
|
||||||
|
mLog.debug("Setting tuned frequency to: " + frequency );
|
||||||
if( FREQUENCY_MIN <= frequency && frequency <= FREQUENCY_MAX )
|
if( FREQUENCY_MIN <= frequency && frequency <= FREQUENCY_MAX )
|
||||||
{
|
{
|
||||||
ByteBuffer buffer = ByteBuffer.allocateDirect( 4 );
|
ByteBuffer buffer = ByteBuffer.allocateDirect( 4 );
|
||||||
@@ -635,8 +643,6 @@ public class AirspyTunerController extends TunerController
|
|||||||
{
|
{
|
||||||
mSampleRates.clear();
|
mSampleRates.clear();
|
||||||
|
|
||||||
mSampleRates.add( DEFAULT_SAMPLE_RATE );
|
|
||||||
|
|
||||||
//Get a count of available sample rates. If we get an exception, then
|
//Get a count of available sample rates. If we get an exception, then
|
||||||
//we're using an older firmware revision and only the default 10 MHz
|
//we're using an older firmware revision and only the default 10 MHz
|
||||||
//rate is supported
|
//rate is supported
|
||||||
@@ -644,18 +650,17 @@ public class AirspyTunerController extends TunerController
|
|||||||
{
|
{
|
||||||
byte[] rawCount = readArray( Command.GET_SAMPLE_RATES, 0, 0, 4 );
|
byte[] rawCount = readArray( Command.GET_SAMPLE_RATES, 0, 0, 4 );
|
||||||
|
|
||||||
|
|
||||||
if( rawCount != null )
|
if( rawCount != null )
|
||||||
{
|
{
|
||||||
int count = EndianUtils.readSwappedInteger( rawCount, 0 );
|
int count = EndianUtils.readSwappedInteger( rawCount, 0 );
|
||||||
|
|
||||||
byte[] rawRates = readArray( Command.GET_SAMPLE_RATES, 0,
|
byte[] rawRates = readArray( Command.GET_SAMPLE_RATES, 0,
|
||||||
count, ( count * 4 ) );
|
count, ( count * 4 ) );
|
||||||
|
|
||||||
for( int x = 0; x < count; x++ )
|
for( int x = 0; x < count; x++ )
|
||||||
{
|
{
|
||||||
int rate = EndianUtils.readSwappedInteger( rawRates, ( x * 4 ) );
|
int rate = EndianUtils.readSwappedInteger( rawRates, ( x * 4 ) );
|
||||||
|
|
||||||
if( rate != DEFAULT_SAMPLE_RATE.getRate() )
|
if( rate != DEFAULT_SAMPLE_RATE.getRate() )
|
||||||
{
|
{
|
||||||
mSampleRates.add( new AirspySampleRate( x, rate,
|
mSampleRates.add( new AirspySampleRate( x, rate,
|
||||||
@@ -668,6 +673,11 @@ public class AirspyTunerController extends TunerController
|
|||||||
{
|
{
|
||||||
//Press on, nothing else to do here ..
|
//Press on, nothing else to do here ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( mSampleRates.isEmpty())
|
||||||
|
{
|
||||||
|
mSampleRates.add( DEFAULT_SAMPLE_RATE );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user