mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 09:37:36 -05:00
Frequency limit for Automatic Frequency Control to prevent the controller from walking too far.
Defaults to a maximum of 3kHz, but can be set to as high as 15 kHz.
This commit is contained in:
@@ -24,6 +24,7 @@ public class AutomaticFrequencyControl implements SimplexSampleListener,
|
||||
private int mSkipThreshold = 4;
|
||||
private int mErrorCorrection = 0;
|
||||
private long mCurrentFrequency;
|
||||
private int mMaximumCorrection;
|
||||
private FrequencyChangeListener mListener;
|
||||
|
||||
public enum Mode
|
||||
@@ -31,9 +32,11 @@ public class AutomaticFrequencyControl implements SimplexSampleListener,
|
||||
NORMAL,FAST;
|
||||
}
|
||||
|
||||
public AutomaticFrequencyControl( FrequencyChangeListener listener )
|
||||
public AutomaticFrequencyControl( FrequencyChangeListener listener,
|
||||
int maximumCorrection )
|
||||
{
|
||||
mListener = listener;
|
||||
mMaximumCorrection = maximumCorrection;
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
@@ -150,6 +153,14 @@ public class AutomaticFrequencyControl implements SimplexSampleListener,
|
||||
if( correction != 0 )
|
||||
{
|
||||
mErrorCorrection -= correction;
|
||||
|
||||
if( Math.abs( mErrorCorrection ) > mMaximumCorrection )
|
||||
{
|
||||
mErrorCorrection = ( mErrorCorrection < 0 ) ?
|
||||
-mMaximumCorrection :
|
||||
mMaximumCorrection;
|
||||
}
|
||||
|
||||
dispatch();
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user