wip #34 - resolved issue with airspy correctly loading stored tuner

configuration values.  Updated remaining tuner editors to set loading
flag when loading tuner configuration and turn off after loading is
complete.
This commit is contained in:
denny
2016-03-27 07:25:17 -04:00
parent 3caadf0c90
commit 55443b42f3
6 changed files with 75 additions and 27 deletions

View File

@@ -432,6 +432,8 @@ public class AirspyTunerEditor extends TunerConfigurationEditor
try try
{ {
mController.setMixerAGC( mMixerAGC.isSelected() ); mController.setMixerAGC( mMixerAGC.isSelected() );
mMixerGain.setEnabled( !mMixerAGC.isSelected() );
save(); save();
} }
catch ( Exception e1 ) catch ( Exception e1 )
@@ -452,6 +454,8 @@ public class AirspyTunerEditor extends TunerConfigurationEditor
try try
{ {
mController.setLNAAGC( mLNAAGC.isSelected() ); mController.setLNAAGC( mLNAAGC.isSelected() );
mLNAGain.setEnabled( !mLNAAGC.isSelected() );
save(); save();
} }
catch ( Exception e1 ) catch ( Exception e1 )
@@ -563,15 +567,16 @@ public class AirspyTunerEditor extends TunerConfigurationEditor
double value = ((SpinnerNumberModel)mFrequencyCorrection.getModel()).getNumber().doubleValue(); double value = ((SpinnerNumberModel)mFrequencyCorrection.getModel()).getNumber().doubleValue();
config.setFrequencyCorrection( value ); config.setFrequencyCorrection( value );
config.setGain( Gain.getGain( (GainMode)mGainModeCombo.getSelectedItem(), mMasterGain.getValue() ) ); Gain gain = Gain.getGain( (GainMode)mGainModeCombo.getSelectedItem(), mMasterGain.getValue() );
config.setGain( gain );
config.setIFGain( mIFGain.getValue() ); config.setIFGain( mIFGain.getValue() );
config.setMixerGain( mMixerGain.getValue() ); config.setMixerGain( mMixerGain.getValue() );
config.setLNAGain( mLNAGain.getValue() ); config.setLNAGain( mLNAGain.getValue() );
config.setMixerAGC( mMixerAGC.isSelected() ); config.setMixerAGC( mMixerAGC.isSelected() );
config.setLNAAGC( mLNAAGC.isSelected() ); config.setLNAAGC( mLNAAGC.isSelected() );
getTunerConfigurationModel().broadcast( getTunerConfigurationModel().broadcast( new TunerConfigurationEvent( config, Event.CHANGE ) );
new TunerConfigurationEvent( getConfiguration(), Event.CHANGE ) );
} }
} }
@@ -665,6 +670,8 @@ public class AirspyTunerEditor extends TunerConfigurationEditor
{ {
super.setItem( config ); super.setItem( config );
mLoading = true;
if( hasItem() && getItem().isAssigned() ) if( hasItem() && getItem().isAssigned() )
{ {
AirspyTunerConfiguration airspy = getConfiguration(); AirspyTunerConfiguration airspy = getConfiguration();
@@ -686,12 +693,52 @@ public class AirspyTunerEditor extends TunerConfigurationEditor
//This will set the master, IF, Mixer, LNA and AGC controls //This will set the master, IF, Mixer, LNA and AGC controls
mGainModeCombo.setSelectedItem( mode ); mGainModeCombo.setSelectedItem( mode );
if( mode == GainMode.CUSTOM )
{
mMasterGain.setValue( airspy.getGain().getValue() );
mIFGain.setValue( airspy.getIFGain() );
if( airspy.isMixerAGC() )
{
mMixerAGC.setSelected( airspy.isMixerAGC() );
mMixerGain.setEnabled( false );
}
else
{
mMixerGain.setValue( airspy.getMixerGain() );
}
if( airspy.isLNAAGC() )
{
mLNAAGC.setSelected( airspy.isLNAAGC() );
mLNAGain.setEnabled( false );
}
else
{
mLNAGain.setValue( airspy.getLNAGain() );
}
}
else
{
mMixerAGC.setSelected( false );
mLNAAGC.setSelected( false );
Gain gain = airspy.getGain();
mMasterGain.setValue( gain.getValue() );
mIFGain.setValue( gain.getIF() );
mMixerGain.setValue( gain.getMixer() );
mLNAGain.setValue( gain.getLNA() );
}
} }
else else
{ {
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( hasItem() ? getItem().getName() : "" ); mConfigurationName.setText( hasItem() ? getItem().getName() : "" );
} }
mLoading = false;
} }
private String getTunerInfo() private String getTunerInfo()

View File

@@ -425,13 +425,13 @@ public class FCD1TunerEditor extends TunerConfigurationEditor
{ {
super.setItem( tunerConfiguration ); super.setItem( tunerConfiguration );
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( hasItem() ) if( hasItem() )
{ {
FCD1TunerConfiguration config = getConfiguration(); FCD1TunerConfiguration config = getConfiguration();
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( tunerConfiguration.isAssigned() ) if( tunerConfiguration.isAssigned() )
{ {
setControlsEnabled( true ); setControlsEnabled( true );
@@ -450,14 +450,14 @@ public class FCD1TunerEditor extends TunerConfigurationEditor
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( config.getName() ); mConfigurationName.setText( config.getName() );
} }
mLoading = false;
} }
else else
{ {
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( "" ); mConfigurationName.setText( "" );
} }
mLoading = false;
} }
public enum Correction { GAIN, PHASE, DC_INPHASE, DC_QUADRATURE }; public enum Correction { GAIN, PHASE, DC_INPHASE, DC_QUADRATURE };

View File

@@ -295,12 +295,13 @@ public class FCD2TunerEditor extends TunerConfigurationEditor
{ {
super.setItem( tunerConfiguration ); super.setItem( tunerConfiguration );
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( hasItem() ) if( hasItem() )
{ {
FCD2TunerConfiguration config = getConfiguration(); FCD2TunerConfiguration config = getConfiguration();
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( tunerConfiguration.isAssigned() ) if( tunerConfiguration.isAssigned() )
{ {
@@ -315,13 +316,13 @@ public class FCD2TunerEditor extends TunerConfigurationEditor
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( config.getName() ); mConfigurationName.setText( config.getName() );
} }
mLoading = false;
} }
else else
{ {
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( "" ); mConfigurationName.setText( "" );
} }
mLoading = false;
} }
} }

View File

@@ -407,13 +407,13 @@ public class HackRFTunerEditor extends TunerConfigurationEditor
{ {
super.setItem( tunerConfiguration ); super.setItem( tunerConfiguration );
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( hasItem() ) if( hasItem() )
{ {
HackRFTunerConfiguration config = getConfiguration(); HackRFTunerConfiguration config = getConfiguration();
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( tunerConfiguration.isAssigned() ) if( tunerConfiguration.isAssigned() )
{ {
setControlsEnabled( true ); setControlsEnabled( true );
@@ -430,14 +430,14 @@ public class HackRFTunerEditor extends TunerConfigurationEditor
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( config.getName() ); mConfigurationName.setText( config.getName() );
} }
mLoading = false;
} }
else else
{ {
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( "" ); mConfigurationName.setText( "" );
} }
mLoading = false;
} }
@Override @Override

View File

@@ -463,13 +463,13 @@ public class E4KTunerEditor extends TunerConfigurationEditor
{ {
super.setItem( tunerConfiguration ); super.setItem( tunerConfiguration );
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( hasItem() ) if( hasItem() )
{ {
E4KTunerConfiguration config = getConfiguration(); E4KTunerConfiguration config = getConfiguration();
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( tunerConfiguration.isAssigned() ) if( tunerConfiguration.isAssigned() )
{ {
setControlsEnabled( true ); setControlsEnabled( true );
@@ -487,13 +487,13 @@ public class E4KTunerEditor extends TunerConfigurationEditor
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( config.getName() ); mConfigurationName.setText( config.getName() );
} }
mLoading = false;
} }
else else
{ {
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( "" ); mConfigurationName.setText( "" );
} }
mLoading = false;
} }
} }

View File

@@ -524,13 +524,13 @@ public class R820TTunerEditor extends TunerConfigurationEditor
{ {
super.setItem( tunerConfiguration ); super.setItem( tunerConfiguration );
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( hasItem() ) if( hasItem() )
{ {
R820TTunerConfiguration config = getConfiguration(); R820TTunerConfiguration config = getConfiguration();
//Toggle loading so that we don't fire a change event and schedule a settings file save
mLoading = true;
if( tunerConfiguration.isAssigned() ) if( tunerConfiguration.isAssigned() )
{ {
setControlsEnabled( true ); setControlsEnabled( true );
@@ -547,13 +547,13 @@ public class R820TTunerEditor extends TunerConfigurationEditor
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( config.getName() ); mConfigurationName.setText( config.getName() );
} }
mLoading = false;
} }
else else
{ {
setControlsEnabled( false ); setControlsEnabled( false );
mConfigurationName.setText( "" ); mConfigurationName.setText( "" );
} }
mLoading = false;
} }
} }