mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Automatic Frequency Control enhancement. Provides default AFC and ability to disable in the Decoder tab of each channel. Spectral display includes visual indicators of frequency center (grey) and current AFC offset (yellow).
This commit is contained in:
@@ -302,6 +302,32 @@ public class OverlayPanel extends JPanel
|
||||
xaxis, (float)(getSize().getHeight()) - mSpectrumInset ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a vertical line at the xaxis
|
||||
*/
|
||||
private void drawAFC( Graphics2D graphics, float xaxis, boolean isError )
|
||||
{
|
||||
float height = (float)(getSize().getHeight()) - mSpectrumInset;
|
||||
|
||||
if( isError )
|
||||
{
|
||||
graphics.setColor( Color.YELLOW );
|
||||
|
||||
graphics.draw( new Line2D.Float( xaxis, height * 0.75f,
|
||||
xaxis, height - 1.0f ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.setColor( Color.LIGHT_GRAY );
|
||||
|
||||
graphics.draw( new Line2D.Float( xaxis, height * 0.65f,
|
||||
xaxis, height - 1.0f ) );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the x-axis value corresponding to the frequency
|
||||
*/
|
||||
@@ -436,8 +462,22 @@ public class OverlayPanel extends JPanel
|
||||
yAxis,
|
||||
width );
|
||||
}
|
||||
|
||||
/* Draw Automatic Frequency Control line */
|
||||
if( channel.hasAFC() )
|
||||
{
|
||||
int frequency = (int)tunerChannel.getFrequency();
|
||||
|
||||
int error = frequency + channel.getAFC().getErrorCorrection();
|
||||
|
||||
drawAFC( graphics, getAxisFromFrequency( frequency ), false );
|
||||
|
||||
drawAFC( graphics, getAxisFromFrequency( error ), true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textual label at the x/y position, clipping the end of the text
|
||||
* to fit within the maxwidth value.
|
||||
|
||||
Reference in New Issue
Block a user