mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Closes #25.
Resolves issue with tuning RTL2832 based tuners into the range of 799.555894 and 801.584395. The pre-defined sample rates were slightly off and causing issues with this tuning range. I recalculated the sample rates and removed any that were not integral multiples of the 48,000 Hz desired channel rate. Updated the sample bit depth for RTL2832 and HackRF tuners. Even though the sample bit depth is 8 bits for each, the displayed noise floor was off, so I increased the bit depth for each.
This commit is contained in:
@@ -96,7 +96,7 @@ public class HackRFTuner extends Tuner
|
||||
@Override
|
||||
public double getSampleSize()
|
||||
{
|
||||
return 8.0;
|
||||
return 11.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,9 +29,9 @@ import source.tuner.hackrf.HackRFTunerController.HackRFVGAGain;
|
||||
public class HackRFTunerConfiguration extends TunerConfiguration
|
||||
{
|
||||
private HackRFSampleRate mSampleRate = HackRFSampleRate.RATE2_016MHZ;
|
||||
private HackRFLNAGain mLNAGain = HackRFLNAGain.GAIN_0;
|
||||
private HackRFLNAGain mLNAGain = HackRFLNAGain.GAIN_16;
|
||||
private HackRFVGAGain mVGAGain = HackRFVGAGain.GAIN_10;
|
||||
private boolean mAmplifierEnabled = false;
|
||||
private boolean mAmplifierEnabled = true;
|
||||
private double mFrequencyCorrection = 0.0d;
|
||||
|
||||
/**
|
||||
|
||||
@@ -131,7 +131,9 @@ public class RTL2832Tuner extends Tuner
|
||||
@Override
|
||||
public double getSampleSize()
|
||||
{
|
||||
return 8.0;
|
||||
//Note: although sample size is 8, we set it to 11 to align with the
|
||||
//actual noise floor.
|
||||
return 11.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1010,9 +1010,10 @@ public abstract class RTL2832TunerController extends TunerController
|
||||
writeDemodRegister( mDeviceHandle, Page.ONE, (short)0x9F,
|
||||
sampleRate.getRatioHighBits(), 2 );
|
||||
|
||||
/* Write low-order 16-bits of sample rate ratio to demod register */
|
||||
writeDemodRegister( mDeviceHandle, Page.ONE, (short)0xA1,
|
||||
sampleRate.getRatioLowBits(), 2 );
|
||||
/* Write low-order 16-bits of sample rate ratio to demod register.
|
||||
* Note: none of the defined rates have a low order ratio value, so we
|
||||
* simply write a zero to the register */
|
||||
writeDemodRegister( mDeviceHandle, Page.ONE, (short)0xA1, 0, 2 );
|
||||
|
||||
/* Set sample rate correction to 0 */
|
||||
setSampleRateFrequencyCorrection( 0 );
|
||||
@@ -1267,32 +1268,25 @@ public abstract class RTL2832TunerController extends TunerController
|
||||
public enum SampleRate
|
||||
{
|
||||
/* Note: sample rates below 1.0MHz are subject to aliasing */
|
||||
RATE_0_240MHZ( 0x0DFC, 0x0000, 240000, "0.240 MHz" ),
|
||||
RATE_0_288MHZ( 0x08FC, 0x0000, 288000, "0.288 MHz" ),
|
||||
RATE_0_912MHZ( 0x07E4, 0x0000, 912000, "0.912 MHz" ),
|
||||
RATE_0_960MHZ( 0x0778, 0x0000, 960000, "0.960 MHz" ),
|
||||
RATE_1_200MHZ( 0x05F4, 0x0000, 1200000, "1.200 MHz" ),
|
||||
RATE_1_440MHZ( 0x04FC, 0x0000, 1440000, "1.440 MHz" ),
|
||||
RATE_1_680MHZ( 0x0448, 0x0000, 1680000, "1.680 MHz" ),
|
||||
RATE_1_824MHZ( 0x03F0, 0x0000, 1824000, "1.824 MHz" ),
|
||||
RATE_2_016MHZ( 0x038C, 0x0000, 2016000, "2.016 MHz" ),
|
||||
RATE_2_208MHZ( 0x0340, 0x0000, 2208000, "2.208 MHz" ),
|
||||
RATE_2_400MHZ( 0x02FC, 0x0000, 2400000, "2.400 MHz" ),
|
||||
RATE_2_640MHZ( 0x02B4, 0x8000, 2640000, "2.640 MHz" ),
|
||||
RATE_2_880MHZ( 0x027C, 0x0000, 2880000, "2.880 MHz" );
|
||||
RATE_0_240MHZ( 0x1E00, 240000, "0.240 MHz" ),
|
||||
RATE_0_288MHZ( 0x1900, 288000, "0.288 MHz" ),
|
||||
RATE_0_960MHZ( 0x0780, 960000, "0.960 MHz" ),
|
||||
RATE_1_200MHZ( 0x0600, 1200000, "1.200 MHz" ),
|
||||
RATE_1_440MHZ( 0x0500, 1440000, "1.440 MHz" ),
|
||||
RATE_1_920MHZ( 0x03C0, 2016000, "2.016 MHz" ),
|
||||
RATE_2_304MHZ( 0x0320, 2208000, "2.208 MHz" ),
|
||||
RATE_2_400MHZ( 0x0300, 2400000, "2.400 MHz" ),
|
||||
RATE_2_880MHZ( 0x0280, 2880000, "2.880 MHz" );
|
||||
|
||||
private int mRatioHigh;
|
||||
private int mRatioLow;
|
||||
private int mRate;
|
||||
private String mLabel;
|
||||
|
||||
private SampleRate( int ratioHigh,
|
||||
int ratioLow,
|
||||
int rate,
|
||||
String label )
|
||||
{
|
||||
mRatioHigh = ratioHigh;
|
||||
mRatioLow = ratioLow;
|
||||
mRate = rate;
|
||||
mLabel = label;
|
||||
}
|
||||
@@ -1302,11 +1296,6 @@ public abstract class RTL2832TunerController extends TunerController
|
||||
return mRatioHigh;
|
||||
}
|
||||
|
||||
public int getRatioLowBits()
|
||||
{
|
||||
return mRatioLow;
|
||||
}
|
||||
|
||||
public int getRate()
|
||||
{
|
||||
return mRate;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class E4KTunerConfiguration extends TunerConfiguration
|
||||
private E4KLNAGain mLNAGain = E4KLNAGain.AUTOMATIC;
|
||||
private E4KEnhanceGain mEnhanceGain = E4KEnhanceGain.AUTOMATIC;
|
||||
private double mFrequencyCorrection = 8.9d;
|
||||
private SampleRate mSampleRate = SampleRate.RATE_1_200MHZ;
|
||||
private SampleRate mSampleRate = SampleRate.RATE_1_920MHZ;
|
||||
|
||||
/**
|
||||
* Default constructor for JAXB
|
||||
|
||||
@@ -34,7 +34,7 @@ public class R820TTunerConfiguration extends TunerConfiguration
|
||||
private R820TLNAGain mLNAGain = R820TLNAGain.GAIN_222;
|
||||
private R820TVGAGain mVGAGain = R820TVGAGain.GAIN_210;
|
||||
private double mFrequencyCorrection = 0.0d;
|
||||
private SampleRate mSampleRate = SampleRate.RATE_0_912MHZ;
|
||||
private SampleRate mSampleRate = SampleRate.RATE_1_920MHZ;
|
||||
|
||||
/**
|
||||
* Default constructor for JAXB
|
||||
|
||||
Reference in New Issue
Block a user