mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 17:17:29 -05:00
Resolves issue with AFC and frequency change event handling,
specifically for P25 C4FM frequency tracking. -Clarifies frequency change event naming and adds request/notitification events for channel frequency correction type events -Removes DC offset filter from P25 C4FM demodulator which was operating independently of the AFC tracking component within the C4FM symbol filter. -Changed FCD tuner center DC spike buffer size after detecting that the DC center spike was influencing the P25 C4FM filter frequency tracker whenever the tuner's center frequency was changed to bring the channel boundary within 3 kHz of the center spike -- set it to 5 kHz to provide a better buffer. -Updated spectral channel display to provide better indication of automatic frequency control (yellow line) versus channel frequency
This commit is contained in:
@@ -31,7 +31,7 @@ import settings.Setting;
|
||||
import settings.SettingChangeListener;
|
||||
import settings.SettingsManager;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.FrequencyChangeEvent.Attribute;
|
||||
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
||||
import spectrum.converter.DFTResultsConverter;
|
||||
import spectrum.converter.RealDecibelConverter;
|
||||
import spectrum.menu.AveragingItem;
|
||||
@@ -99,7 +99,7 @@ public class ChannelSpectrumPanel extends JPanel
|
||||
|
||||
/* Set the DFTProcessor to the decimated 24kHz sample rate */
|
||||
mDFTProcessor.frequencyChanged(
|
||||
new FrequencyChangeEvent( Attribute.SAMPLE_RATE, 24000 ) );
|
||||
new FrequencyChangeEvent( Event.SAMPLE_RATE_CHANGE_NOTIFICATION, 24000 ) );
|
||||
|
||||
initGui();
|
||||
}
|
||||
|
||||
@@ -476,11 +476,9 @@ public class DFTProcessor implements Listener<ComplexBuffer>,
|
||||
@Override
|
||||
public void frequencyChanged( FrequencyChangeEvent event )
|
||||
{
|
||||
switch( event.getAttribute() )
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case SAMPLE_RATE_ERROR:
|
||||
break;
|
||||
case SAMPLE_RATE:
|
||||
case SAMPLE_RATE_CHANGE_NOTIFICATION:
|
||||
mSampleRate = event.getValue().intValue();
|
||||
calculateConsumptionRate();
|
||||
break;
|
||||
|
||||
@@ -428,24 +428,33 @@ public class OverlayPanel extends JPanel
|
||||
/**
|
||||
* Draws a vertical line at the xaxis
|
||||
*/
|
||||
private void drawAFC( Graphics2D graphics, double xaxis, boolean isError )
|
||||
private void drawChannelCenterLine( Graphics2D graphics, double xaxis )
|
||||
{
|
||||
double height = getSize().getHeight() - mSpectrumInset;
|
||||
|
||||
if( isError )
|
||||
{
|
||||
graphics.setColor( Color.YELLOW );
|
||||
graphics.setColor( Color.LIGHT_GRAY );
|
||||
|
||||
graphics.draw( new Line2D.Double( xaxis, height * 0.75d,
|
||||
xaxis, height - 1.0d ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.setColor( Color.LIGHT_GRAY );
|
||||
graphics.draw( new Line2D.Double( xaxis, height * 0.65d,
|
||||
xaxis, height - 1.0d ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a vertical line at the xaxis
|
||||
*/
|
||||
private void drawAFC( Graphics2D graphics, double frequencyAxis, double errorAxis )
|
||||
{
|
||||
double height = getSize().getHeight() - mSpectrumInset;
|
||||
double lineHeight = height * 0.75d;
|
||||
|
||||
graphics.draw( new Line2D.Double( xaxis, height * 0.65d,
|
||||
xaxis, height - 1.0d ) );
|
||||
}
|
||||
graphics.setColor( Color.YELLOW );
|
||||
|
||||
//Vertical frequency error line
|
||||
graphics.draw( new Line2D.Double( errorAxis, lineHeight,
|
||||
errorAxis, height - 1.0d ) );
|
||||
|
||||
//Horizontal line connecting frequency and error lines
|
||||
graphics.draw( new Line2D.Double( frequencyAxis, lineHeight,
|
||||
errorAxis, lineHeight ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -599,16 +608,18 @@ public class OverlayPanel extends JPanel
|
||||
width );
|
||||
}
|
||||
|
||||
long frequency = tunerChannel.getFrequency();
|
||||
|
||||
double frequencyAxis = getAxisFromFrequency( frequency );
|
||||
|
||||
drawChannelCenterLine( graphics, frequencyAxis );
|
||||
|
||||
/* Draw Automatic Frequency Control line */
|
||||
if( channel.hasFrequencyControl() )
|
||||
{
|
||||
long frequency = tunerChannel.getFrequency();
|
||||
|
||||
long error = frequency + channel.getFrequencyCorrection();
|
||||
|
||||
drawAFC( graphics, getAxisFromFrequency( frequency ), false );
|
||||
|
||||
drawAFC( graphics, getAxisFromFrequency( error ), true );
|
||||
drawAFC( graphics, frequencyAxis, getAxisFromFrequency( error ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -663,13 +674,13 @@ public class OverlayPanel extends JPanel
|
||||
@Override
|
||||
public void frequencyChanged( FrequencyChangeEvent event )
|
||||
{
|
||||
switch( event.getAttribute() )
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case SAMPLE_RATE:
|
||||
case SAMPLE_RATE_CHANGE_NOTIFICATION:
|
||||
mBandwidth = event.getValue().intValue();
|
||||
mLabelSizeMonitor.update();
|
||||
break;
|
||||
case FREQUENCY:
|
||||
case FREQUENCY_CHANGE_NOTIFICATION:
|
||||
mFrequency = event.getValue().longValue();
|
||||
mLabelSizeMonitor.update();
|
||||
break;
|
||||
|
||||
@@ -65,7 +65,7 @@ import source.SourceException;
|
||||
import source.tuner.Tuner;
|
||||
import source.tuner.TunerSelectionListener;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.FrequencyChangeEvent.Attribute;
|
||||
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
||||
import source.tuner.frequency.FrequencyChangeListener;
|
||||
import spectrum.OverlayPanel.ChannelDisplay;
|
||||
import spectrum.converter.ComplexDecibelConverter;
|
||||
@@ -434,10 +434,10 @@ public class SpectralDisplayPanel extends JPanel
|
||||
try
|
||||
{
|
||||
frequencyChanged( new FrequencyChangeEvent(
|
||||
Attribute.FREQUENCY, mTuner.getFrequency() ) );
|
||||
Event.FREQUENCY_CHANGE_NOTIFICATION, mTuner.getFrequency() ) );
|
||||
|
||||
frequencyChanged( new FrequencyChangeEvent(
|
||||
Attribute.SAMPLE_RATE, mTuner.getSampleRate() ) );
|
||||
Event.SAMPLE_RATE_CHANGE_NOTIFICATION, mTuner.getSampleRate() ) );
|
||||
}
|
||||
catch ( SourceException e )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user