mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Resolves #373 - Adds support for Tuner frequency error PPM monitoring
and auto-correction for R820T tuners. -Updated TunerModel and TunerViewPanel to add 2 new columns to display the current tuner's PPM setting and (when available) the measured frequency error averaged over 5 second intervals provided by certain decoders (e.g. P25 C4FM and LSM). Frequency error value from P25 decoders is provided from the Costas Loop PLL once 2 or more P25 message sync events have been observed in a short period. -Updated R820T tuner to auto-correct PPM when measured frequency error exceeds the +/- 0.4PPM threshold for a period of 30 seconds or more. Feature can be enabled/disabled by user in the tuner editor panel. Resolved several issues with P25 C4FM/LSM decoders that was impacting performance related to channel misalignment from tuner PPM offsets.
This commit is contained in:
@@ -41,6 +41,7 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
|
||||
private int mMiddleUnusableHalfBandwidth;
|
||||
private double mUsableBandwidthPercentage;
|
||||
private Listener<SourceEvent> mSourceEventListener;
|
||||
private int mMeasuredFrequencyError;
|
||||
|
||||
/**
|
||||
* Abstract tuner controller class. The tuner controller manages frequency bandwidth and currently tuned channels
|
||||
@@ -242,6 +243,46 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
|
||||
return (int)(getUsableBandwidth() / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Current measured frequency error as received/reported from certain downstream decoders.
|
||||
* @return measured frequency error in hertz averaged over 1-second intervals
|
||||
*/
|
||||
public int getMeasuredFrequencyError()
|
||||
{
|
||||
return mMeasuredFrequencyError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this tuner controller has a non-zero measured frequency error value.
|
||||
*/
|
||||
public boolean hasMeasuredFrequencyError()
|
||||
{
|
||||
return mMeasuredFrequencyError != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the current PPM error value as measured by certain downstream decoders.
|
||||
* @return
|
||||
*/
|
||||
public double getPPMFrequencyError()
|
||||
{
|
||||
if(hasMeasuredFrequencyError())
|
||||
{
|
||||
return mMeasuredFrequencyError / ((double)getFrequency() / 1E6d);
|
||||
}
|
||||
|
||||
return 0.0d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the measured frequency error average.
|
||||
* @param measuredFrequencyError in hertz averaged over a 5 second interval.
|
||||
*/
|
||||
public void setMeasuredFrequencyError(int measuredFrequencyError)
|
||||
{
|
||||
mMeasuredFrequencyError = measuredFrequencyError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the listener to be notified any time that the tuner changes frequency
|
||||
* or bandwidth/sample rate.
|
||||
|
||||
Reference in New Issue
Block a user