mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 10:37:26 -05:00
Resolves issue with spectral and waterfall alignment with frequency
overlay. Minor edits to MPT and P25 config editors Resolved issue with channels not accepting channel config changes between restarts (processing chain was not being deleted) Minor edits to P25 decoder state
This commit is contained in:
@@ -904,10 +904,16 @@ public class Channel extends Configuration
|
|||||||
{
|
{
|
||||||
mProcessingChain.stop();
|
mProcessingChain.stop();
|
||||||
|
|
||||||
mSelected = false;
|
if( mChannelType == ChannelType.STANDARD )
|
||||||
}
|
{
|
||||||
|
mProcessingChain.dispose();
|
||||||
|
mProcessingChain = null;
|
||||||
|
}
|
||||||
|
|
||||||
fireChannelEvent( Event.CHANNEL_PROCESSING_STOPPED );
|
mSelected = false;
|
||||||
|
|
||||||
|
fireChannelEvent( Event.CHANNEL_PROCESSING_STOPPED );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -126,14 +126,14 @@ public class MPT1327ConfigEditor extends DecodeEditor
|
|||||||
mTrafficChannelPoolSize.setLabelTable( mTrafficChannelPoolSize.createStandardLabels( 10, 10 ) );
|
mTrafficChannelPoolSize.setLabelTable( mTrafficChannelPoolSize.createStandardLabels( 10, 10 ) );
|
||||||
mTrafficChannelPoolSize.setPaintLabels( true );
|
mTrafficChannelPoolSize.setPaintLabels( true );
|
||||||
|
|
||||||
mTrafficChannelPoolSizeLabel = new JLabel( "Traffic Channel Pool Size: " + mTrafficChannelPoolSize.getValue() + " " );
|
mTrafficChannelPoolSizeLabel = new JLabel( "Traffic Channel Pool: " + mTrafficChannelPoolSize.getValue() + " " );
|
||||||
|
|
||||||
mTrafficChannelPoolSize.addChangeListener( new ChangeListener()
|
mTrafficChannelPoolSize.addChangeListener( new ChangeListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void stateChanged( ChangeEvent e )
|
public void stateChanged( ChangeEvent e )
|
||||||
{
|
{
|
||||||
mTrafficChannelPoolSizeLabel.setText( "Traffic Channel Pool Size: " + mTrafficChannelPoolSize.getValue() );
|
mTrafficChannelPoolSizeLabel.setText( "Traffic Channel Pool: " + mTrafficChannelPoolSize.getValue() );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|||||||
@@ -148,8 +148,14 @@ public class P25DecoderPanel extends DecoderPanel
|
|||||||
if( from != null )
|
if( from != null )
|
||||||
{
|
{
|
||||||
mFromAlias.setText( from.getName() );
|
mFromAlias.setText( from.getName() );
|
||||||
mFromAlias.setIcon( mSettingsManager
|
|
||||||
.getImageIcon( from.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
|
String icon = from.getIconName();
|
||||||
|
|
||||||
|
if( icon != null )
|
||||||
|
{
|
||||||
|
mFromAlias.setIcon( mSettingsManager.getImageIcon(
|
||||||
|
icon, SettingsManager.DEFAULT_ICON_SIZE ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -173,8 +179,14 @@ public class P25DecoderPanel extends DecoderPanel
|
|||||||
if( to != null )
|
if( to != null )
|
||||||
{
|
{
|
||||||
mToAlias.setText( to.getName() );
|
mToAlias.setText( to.getName() );
|
||||||
mToAlias.setIcon( mSettingsManager
|
|
||||||
.getImageIcon( to.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
|
String icon = to.getIconName();
|
||||||
|
|
||||||
|
if( icon != null )
|
||||||
|
{
|
||||||
|
mToAlias.setIcon( mSettingsManager.getImageIcon(
|
||||||
|
icon, SettingsManager.DEFAULT_ICON_SIZE ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2922,7 +2922,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
/**
|
/**
|
||||||
* Broadcasts an update for the TO group or unit address
|
* Broadcasts an update for the TO group or unit address
|
||||||
*/
|
*/
|
||||||
private void updateTo( String to )
|
private void updateTo( final String to )
|
||||||
{
|
{
|
||||||
if( to != null && !to.contentEquals( "0000" ) && !to.contentEquals( "000000" ) )
|
if( to != null && !to.contentEquals( "0000" ) && !to.contentEquals( "000000" ) )
|
||||||
{
|
{
|
||||||
@@ -2959,7 +2959,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
/**
|
/**
|
||||||
* Broadcasts an update for the FROM group or unit address
|
* Broadcasts an update for the FROM group or unit address
|
||||||
*/
|
*/
|
||||||
private void updateFrom( String from )
|
private void updateFrom( final String from )
|
||||||
{
|
{
|
||||||
if( from != null && !from.contentEquals( "0000" ) && !from.contentEquals( "000000" ) )
|
if( from != null && !from.contentEquals( "0000" ) && !from.contentEquals( "000000" ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,14 +105,14 @@ public class P25Editor extends DecodeEditor
|
|||||||
mTrafficChannelPoolSize.setLabelTable( mTrafficChannelPoolSize.createStandardLabels( 10, 10 ) );
|
mTrafficChannelPoolSize.setLabelTable( mTrafficChannelPoolSize.createStandardLabels( 10, 10 ) );
|
||||||
mTrafficChannelPoolSize.setPaintLabels( true );
|
mTrafficChannelPoolSize.setPaintLabels( true );
|
||||||
|
|
||||||
mTrafficChannelPoolSizeLabel = new JLabel( "Traffic Channel Pool Size: " + mTrafficChannelPoolSize.getValue() + " " );
|
mTrafficChannelPoolSizeLabel = new JLabel( "Traffic Channel Pool: " + mTrafficChannelPoolSize.getValue() + " " );
|
||||||
|
|
||||||
mTrafficChannelPoolSize.addChangeListener( new ChangeListener()
|
mTrafficChannelPoolSize.addChangeListener( new ChangeListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void stateChanged( ChangeEvent e )
|
public void stateChanged( ChangeEvent e )
|
||||||
{
|
{
|
||||||
mTrafficChannelPoolSizeLabel.setText( "Traffic Channel Pool Size: " + mTrafficChannelPoolSize.getValue() );
|
mTrafficChannelPoolSizeLabel.setText( "Traffic Channel Pool: " + mTrafficChannelPoolSize.getValue() );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class TrafficChannelManager extends Module
|
|||||||
private String mAliasListName;
|
private String mAliasListName;
|
||||||
private long mTrafficChannelTimeout;
|
private long mTrafficChannelTimeout;
|
||||||
private CallEvent mPreviousDoNotMonitorCallEvent;
|
private CallEvent mPreviousDoNotMonitorCallEvent;
|
||||||
|
private boolean mShuttingDown = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitors call events and allocates traffic decoder channels in response
|
* Monitors call events and allocates traffic decoder channels in response
|
||||||
@@ -157,55 +158,66 @@ public class TrafficChannelManager extends Module
|
|||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes the event and creates a traffic channel is resources are
|
||||||
|
* available
|
||||||
|
*/
|
||||||
private void process( TrafficChannelAllocationEvent event )
|
private void process( TrafficChannelAllocationEvent event )
|
||||||
{
|
{
|
||||||
if( mCallEventListener != null )
|
if( mCallEventListener != null )
|
||||||
{
|
{
|
||||||
CallEvent callEvent = event.getCallEvent();
|
synchronized( mCallEventListener )
|
||||||
|
|
||||||
/* Check for duplicate events and suppress */
|
|
||||||
if( mTrafficChannelsInUse.containsKey( callEvent.getChannel() ) )
|
|
||||||
{
|
{
|
||||||
return;
|
CallEvent callEvent = event.getCallEvent();
|
||||||
}
|
|
||||||
|
|
||||||
long frequency = callEvent.getFrequency();
|
/* Check for duplicate events and suppress */
|
||||||
|
if( mTrafficChannelsInUse.containsKey( callEvent.getChannel() ) )
|
||||||
/* Check the from/to aliases for do not monitor priority */
|
|
||||||
if( isDoNotMonitor( callEvent ) )
|
|
||||||
{
|
|
||||||
callEvent.setCallEventType( CallEventType.CALL_DO_NOT_MONITOR );
|
|
||||||
|
|
||||||
if( isSameCallEvent( mPreviousDoNotMonitorCallEvent, callEvent ) )
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
mPreviousDoNotMonitorCallEvent = callEvent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( frequency > 0 )
|
|
||||||
{
|
|
||||||
Channel channel = getChannel( callEvent.getChannel(),
|
|
||||||
new TunerChannel( Type.TRAFFIC, frequency,
|
|
||||||
mDecodeConfiguration.getDecoderType()
|
|
||||||
.getChannelBandwidth() ) );
|
|
||||||
|
|
||||||
if( channel != null )
|
long frequency = callEvent.getFrequency();
|
||||||
|
|
||||||
|
/* Check the from/to aliases for do not monitor priority */
|
||||||
|
if( isDoNotMonitor( callEvent ) )
|
||||||
{
|
{
|
||||||
if( channel.isProcessing() )
|
callEvent.setCallEventType( CallEventType.CALL_DO_NOT_MONITOR );
|
||||||
|
|
||||||
|
if( isSameCallEvent( mPreviousDoNotMonitorCallEvent, callEvent ) )
|
||||||
{
|
{
|
||||||
ChannelState state = channel.getChannelState();
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mPreviousDoNotMonitorCallEvent = callEvent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( frequency > 0 )
|
||||||
|
{
|
||||||
|
Channel channel = getChannel( callEvent.getChannel(),
|
||||||
|
new TunerChannel( Type.TRAFFIC, frequency,
|
||||||
|
mDecodeConfiguration.getDecoderType()
|
||||||
|
.getChannelBandwidth() ) );
|
||||||
|
|
||||||
/* Register as a listener to be notified when the call
|
if( channel != null )
|
||||||
* is completed */
|
{
|
||||||
state.configureAsTrafficChannel(
|
if( channel.isProcessing() )
|
||||||
new TrafficChannelStatusListener( this,
|
{
|
||||||
callEvent.getChannel() ), event );
|
ChannelState state = channel.getChannelState();
|
||||||
|
|
||||||
/* Set state to call so that audio squelch state is correct */
|
/* Register as a listener to be notified when the call
|
||||||
state.setState( State.CALL );
|
* is completed */
|
||||||
|
state.configureAsTrafficChannel(
|
||||||
|
new TrafficChannelStatusListener( this,
|
||||||
|
callEvent.getChannel() ), event );
|
||||||
|
|
||||||
|
/* Set state to call so that audio squelch state is correct */
|
||||||
|
state.setState( State.CALL );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
callEvent.setCallEventType( CallEventType.CALL_DETECT );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -216,13 +228,9 @@ public class TrafficChannelManager extends Module
|
|||||||
{
|
{
|
||||||
callEvent.setCallEventType( CallEventType.CALL_DETECT );
|
callEvent.setCallEventType( CallEventType.CALL_DETECT );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
callEvent.setCallEventType( CallEventType.CALL_DETECT );
|
|
||||||
}
|
|
||||||
|
|
||||||
mCallEventListener.receive( callEvent );
|
mCallEventListener.receive( callEvent );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -446,16 +446,22 @@ public class OverlayPanel extends JPanel
|
|||||||
*/
|
*/
|
||||||
private double getAxisFromFrequency( long frequency )
|
private double getAxisFromFrequency( long frequency )
|
||||||
{
|
{
|
||||||
//Determine frequency offset from middle
|
double screenWidth = (double)getSize().getWidth();
|
||||||
double frequencyOffset = frequency - getMinDisplayFrequency();
|
|
||||||
|
|
||||||
//Determine ratio of offset to bandwidth
|
double pixelsPerBin = screenWidth / (double)mDFTSize.getSize();
|
||||||
|
|
||||||
|
double pixelOffsetToMinDisplayFrequency = pixelsPerBin * 2.0d;
|
||||||
|
|
||||||
|
//Calculate frequency offset from the min frequency
|
||||||
|
double frequencyOffset = (double)( frequency - getMinDisplayFrequency() );
|
||||||
|
|
||||||
|
//Determine ratio of frequency offset to overall bandwidth
|
||||||
double ratio = frequencyOffset / (double)getDisplayBandwidth();
|
double ratio = frequencyOffset / (double)getDisplayBandwidth();
|
||||||
|
|
||||||
//Calculate offset against the total width
|
//Apply the ratio to the screen width minus 1 bin width
|
||||||
double xOffset = (double)getSize().getWidth() * ratio;
|
double screenOffset = screenWidth * ratio;
|
||||||
|
|
||||||
return xOffset;
|
return pixelOffsetToMinDisplayFrequency + screenOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -749,9 +755,9 @@ public class OverlayPanel extends JPanel
|
|||||||
|
|
||||||
private long getMinDisplayFrequency()
|
private long getMinDisplayFrequency()
|
||||||
{
|
{
|
||||||
double bandwidthPerBin = (double)mBandwidth / (double)( mDFTSize.getSize() - 1 );
|
double bandwidthPerBin = (double)mBandwidth / (double)( mDFTSize.getSize() );
|
||||||
|
|
||||||
return getMinFrequency() + (int)( mDFTZoomWindowOffset * bandwidthPerBin );
|
return getMinFrequency() + (int)( ( mDFTZoomWindowOffset ) * bandwidthPerBin );
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMaxDisplayFrequency()
|
private long getMaxDisplayFrequency()
|
||||||
|
|||||||
@@ -215,13 +215,11 @@ public class SpectrumPanel extends JPanel
|
|||||||
|
|
||||||
float scalor = insideHeight / -mDBScale;
|
float scalor = insideHeight / -mDBScale;
|
||||||
|
|
||||||
float insideWidth = size.width;
|
/* Calculate based on bin size - 1, since bin 0 is rendered at zero
|
||||||
|
* and the last bin is rendered at the width */
|
||||||
|
float binSize = (float)size.width / ( (float)( bins.length ) );
|
||||||
|
|
||||||
int binCount = bins.length;
|
for( int x = 0; x < bins.length; x++ )
|
||||||
|
|
||||||
float binSize = insideWidth / ( binCount );
|
|
||||||
|
|
||||||
for( int x = 0; x < binCount; x++ )
|
|
||||||
{
|
{
|
||||||
float height;
|
float height;
|
||||||
|
|
||||||
@@ -237,7 +235,9 @@ public class SpectrumPanel extends JPanel
|
|||||||
height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
spectrumShape.lineTo( ( x * binSize ), height );
|
float xAxis = (float)x * binSize;
|
||||||
|
|
||||||
|
spectrumShape.lineTo( xAxis, height );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Otherwise show an empty spectrum
|
//Otherwise show an empty spectrum
|
||||||
|
|||||||
@@ -261,21 +261,25 @@ public class WaterfallPanel extends JPanel implements DFTResultsListener,
|
|||||||
* @param multiplier - current zoom multiplier
|
* @param multiplier - current zoom multiplier
|
||||||
* @return x-axis pixel offset
|
* @return x-axis pixel offset
|
||||||
*/
|
*/
|
||||||
private int getPixelOffset( int multiplier )
|
private double getPixelOffset( int multiplier )
|
||||||
{
|
{
|
||||||
int offset = 0;
|
double offset = 0;
|
||||||
|
|
||||||
if( mZoom != 0 )
|
if( mZoom != 0 )
|
||||||
{
|
{
|
||||||
int zoomWidth = getWidth() * multiplier;
|
double binPixelWidth = getBinPixelWidth( multiplier );
|
||||||
|
|
||||||
offset = -(int)( (double)zoomWidth / (double)mDFTSize *
|
offset = -binPixelWidth * (double)( mDFTZoomWindowOffset );
|
||||||
(double)( mDFTZoomWindowOffset ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double getBinPixelWidth( int multiplier )
|
||||||
|
{
|
||||||
|
return ( (double)getWidth() * (double)multiplier ) / (double)mDFTSize;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the screen at each refresh
|
* Renders the screen at each refresh
|
||||||
*/
|
*/
|
||||||
@@ -283,15 +287,20 @@ public class WaterfallPanel extends JPanel implements DFTResultsListener,
|
|||||||
{
|
{
|
||||||
int multiplier = getZoomMultiplier();
|
int multiplier = getZoomMultiplier();
|
||||||
|
|
||||||
int offset = getPixelOffset( multiplier );
|
double binPixelWidth = getBinPixelWidth( multiplier );
|
||||||
|
|
||||||
|
int offset = (int)( getPixelOffset( multiplier ) - binPixelWidth );
|
||||||
|
|
||||||
|
// mLog.debug( "Offset:" + offset + " Pixel Offset:" + getPixelOffset( multiplier ) + " bin pixel width:" + binPixelWidth );
|
||||||
|
|
||||||
g.drawImage( mWaterfallImage,
|
g.drawImage( mWaterfallImage,
|
||||||
offset,
|
offset,
|
||||||
0,
|
0,
|
||||||
getWidth() * multiplier,
|
( getWidth() * multiplier ) + (int)binPixelWidth,
|
||||||
mImageHeight,
|
mImageHeight,
|
||||||
this );
|
this );
|
||||||
|
|
||||||
|
|
||||||
Graphics2D graphics = (Graphics2D) g;
|
Graphics2D graphics = (Graphics2D) g;
|
||||||
|
|
||||||
graphics.setColor( mColorSpectrumCursor );
|
graphics.setColor( mColorSpectrumCursor );
|
||||||
|
|||||||
Reference in New Issue
Block a user