diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerEditor.java index 2fe1763ac..6921d37b1 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerEditor.java @@ -52,7 +52,7 @@ public abstract class RspTunerEditor extends Tu private JToggleButton mAgcButton; private JLabel mGainValueLabel; private LnaSlider mLNASlider; - private GainReductionSlider mBasebandSlider; + private IfGainSlider mIfGainSlider; private JButton mGainOverloadButton; private JPanel mGainPanel; private AtomicBoolean mGainOverloadAlert = new AtomicBoolean(); @@ -131,6 +131,8 @@ protected JToggleButton getAgcButton() save(); } + getIfGainSlider().setEnabled(!getAgcButton().isSelected()); + if(mAgcButton.isSelected()) { getAgcButton().setText(AUTOMATIC); @@ -198,12 +200,11 @@ else if(!alert && mGainOverloadAlert.compareAndSet(true, false)) getGainOverloadButton().setForeground(getForeground()); getGainOverloadButton().setBackground(getBackground()); } - else - { - mLog.info("Ignoring duplicate gain alerting - alert[" + alert + "] atomic [" + mGainOverloadAlert.get() + "]"); - } } + /** + * Updates the LNA slider with the number of LNA states available for the current frequency. + */ protected void updateLnaSlider() { if(hasTuner()) @@ -253,7 +254,7 @@ protected LnaSlider getLNASlider() private void updateGain() { int lna = getLNASlider().getLNA(); - int gr = getBasebandSlider().getGR(); + int gr = getIfGainSlider().getGR(); if(hasTuner() && !isLoading()) { @@ -266,7 +267,7 @@ private void updateGain() catch(Exception e) { mLog.error("Couldn't set RSP gain to LNA:" + lna + " Gain Reduction:" + gr, e); - JOptionPane.showMessageDialog(mBasebandSlider, "Couldn't set RSP gain value to LNA:" + lna + " Gain Reduction:" + gr); + JOptionPane.showMessageDialog(mIfGainSlider, "Couldn't set RSP gain value to LNA:" + lna + " Gain Reduction:" + gr); } } } @@ -285,17 +286,17 @@ protected void updateGainLabel() } /** - * Baseband Gain Reduction Slider + * IF Gain Slider */ - protected GainReductionSlider getBasebandSlider() + protected IfGainSlider getIfGainSlider() { - if(mBasebandSlider == null) + if(mIfGainSlider == null) { - mBasebandSlider = new GainReductionSlider(); - mBasebandSlider.setEnabled(true); - mBasebandSlider.setMajorTickSpacing(1); - mBasebandSlider.setPaintTicks(true); - mBasebandSlider.addChangeListener(event -> + mIfGainSlider = new IfGainSlider(); + mIfGainSlider.setEnabled(true); + mIfGainSlider.setMajorTickSpacing(1); + mIfGainSlider.setPaintTicks(true); + mIfGainSlider.addChangeListener(event -> { JSlider source = (JSlider)event.getSource(); @@ -306,7 +307,7 @@ protected GainReductionSlider getBasebandSlider() }); } - return mBasebandSlider; + return mIfGainSlider; } /** @@ -342,14 +343,14 @@ public void setLNA(int lna) } /** - * JSlider implementation that inverts the scale to support Gain Reduction values. + * JSlider implementation that inverts the scale to support IF Gain (aka Gain Reduction) values. */ - public class GainReductionSlider extends JSlider + public class IfGainSlider extends JSlider { /** * Constructs an instance */ - public GainReductionSlider() + public IfGainSlider() { super(JSlider.HORIZONTAL, 0, 39, 30); } @@ -360,7 +361,7 @@ public GainReductionSlider() */ public int getGR() { - return getBasebandSlider().getMaximum() - getBasebandSlider().getValue() + 20; + return getIfGainSlider().getMaximum() - getIfGainSlider().getValue() + 20; } /** diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerEditor.java index 2aedc1ed5..ea3a5093a 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerEditor.java @@ -82,8 +82,8 @@ private void init() add(getGainPanel(), "wrap"); add(new JLabel("LNA:")); add(getLNASlider(), "wrap"); - add(new JLabel("Baseband:")); - add(getBasebandSlider(), "wrap"); + add(new JLabel("IF:")); + add(getIfGainSlider(), "wrap"); add(new JSeparator(), "span,growx,push"); } @@ -136,7 +136,7 @@ protected void tunerStatusUpdated() getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); - getBasebandSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); + getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); //Register to receive gain overload notifications getTunerController().getControlRsp().setGainOverloadListener(this); @@ -144,7 +144,7 @@ protected void tunerStatusUpdated() } getLNASlider().setEnabled(hasTuner()); - getBasebandSlider().setEnabled(hasTuner()); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); setLoading(false); @@ -161,7 +161,7 @@ public void save() getConfiguration().setAutoPPMCorrectionEnabled(getAutoPPMCheckBox().isSelected()); getConfiguration().setSampleRate((RspSampleRate)getSampleRateCombo().getSelectedItem()); getConfiguration().setLNA(getLNASlider().getLNA()); - getConfiguration().setBasebandGainReduction(getBasebandSlider().getGR()); + getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); saveConfiguration(); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerEditor.java index dc75cae9c..4650c13a2 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerEditor.java @@ -86,8 +86,8 @@ private void init() add(getGainPanel(), "wrap"); add(new JLabel("LNA:")); add(getLNASlider(), "wrap"); - add(new JLabel("Baseband:")); - add(getBasebandSlider(), "wrap"); + add(new JLabel("IF:")); + add(getIfGainSlider(), "wrap"); add(new JSeparator(), "span,growx,push"); @@ -147,7 +147,7 @@ protected void tunerStatusUpdated() getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); - getBasebandSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); + getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); //Register to receive gain overload notifications getTunerController().getControlRsp().setGainOverloadListener(this); @@ -155,7 +155,7 @@ protected void tunerStatusUpdated() } getLNASlider().setEnabled(hasTuner()); - getBasebandSlider().setEnabled(hasTuner()); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getBiasTCheckBox().setEnabled(hasTuner()); @@ -205,7 +205,7 @@ public void save() getConfiguration().setRfNotch(getRfNotchCheckBox().isSelected()); getConfiguration().setRfDabNotch(getRfDabNotchCheckBox().isSelected()); getConfiguration().setLNA(getLNASlider().getLNA()); - getConfiguration().setBasebandGainReduction(getBasebandSlider().getGR()); + getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); saveConfiguration(); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerEditor.java index 978fe9d86..5150db63e 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerEditor.java @@ -86,8 +86,8 @@ private void init() add(getGainPanel(), "wrap"); add(new JLabel("LNA:")); add(getLNASlider(), "wrap"); - add(new JLabel("Baseband:")); - add(getBasebandSlider(), "wrap"); + add(new JLabel("IF:")); + add(getIfGainSlider(), "wrap"); add(new JSeparator(), "span,growx,push"); @@ -147,7 +147,7 @@ protected void tunerStatusUpdated() getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); - getBasebandSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); + getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); //Register to receive gain overload notifications getTunerController().getControlRsp().setGainOverloadListener(this); @@ -155,7 +155,7 @@ protected void tunerStatusUpdated() } getLNASlider().setEnabled(hasTuner()); - getBasebandSlider().setEnabled(hasTuner()); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getBiasTCheckBox().setEnabled(hasTuner()); try @@ -204,7 +204,7 @@ public void save() getConfiguration().setRfNotch(getRfNotchCheckBox().isSelected()); getConfiguration().setRfDabNotch(getRfDabNotchCheckBox().isSelected()); getConfiguration().setLNA(getLNASlider().getLNA()); - getConfiguration().setBasebandGainReduction(getBasebandSlider().getGR()); + getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); saveConfiguration(); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerEditor.java index 4403d20d9..2b483df0c 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerEditor.java @@ -88,8 +88,8 @@ private void init() add(getGainPanel(), "wrap"); add(new JLabel("LNA:")); add(getLNASlider(), "wrap"); - add(new JLabel("Baseband:")); - add(getBasebandSlider(), "wrap"); + add(new JLabel("IF:")); + add(getIfGainSlider(), "wrap"); add(new JSeparator(), "span,growx,push"); @@ -151,7 +151,7 @@ protected void tunerStatusUpdated() getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); - getBasebandSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); + getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); //Register to receive gain overload notifications getTunerController().getControlRsp().setGainOverloadListener(this); @@ -159,7 +159,7 @@ protected void tunerStatusUpdated() } getLNASlider().setEnabled(hasTuner()); - getBasebandSlider().setEnabled(hasTuner()); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getBiasTCheckBox().setEnabled(hasTuner()); @@ -219,7 +219,7 @@ public void save() getConfiguration().setRfNotch(getRfNotchCheckBox().isSelected()); getConfiguration().setAntennaSelection((Rsp2AntennaSelection)getAntennaSelectionCombo().getSelectedItem()); getConfiguration().setLNA(getLNASlider().getLNA()); - getConfiguration().setBasebandGainReduction(getBasebandSlider().getGR()); + getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); saveConfiguration(); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/RspDuoTuner1Editor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/RspDuoTuner1Editor.java index 607adc77f..a4a757015 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/RspDuoTuner1Editor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/RspDuoTuner1Editor.java @@ -98,8 +98,8 @@ private void init() add(getGainPanel(), "wrap"); add(new JLabel("LNA:")); add(getLNASlider(), "wrap"); - add(new JLabel("Baseband:")); - add(getBasebandSlider(), "wrap"); + add(new JLabel("IF:")); + add(getIfGainSlider(), "wrap"); add(new JSeparator(), "span,growx,push"); @@ -168,7 +168,7 @@ protected void tunerStatusUpdated() getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); - getBasebandSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); + getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); //Register to receive gain overload notifications getTunerController().getControlRsp().setGainOverloadListener(this); @@ -176,7 +176,7 @@ protected void tunerStatusUpdated() } getLNASlider().setEnabled(hasTuner()); - getBasebandSlider().setEnabled(hasTuner()); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getAmPortCombo().setEnabled(hasTuner() && !getTuner().getTunerController().isLockedSampleRate()); @@ -249,7 +249,7 @@ public void save() getConfiguration().setRfDabNotch(getRfDabNotchCheckBox().isSelected()); getConfiguration().setRfNotch(getRfNotchCheckBox().isSelected()); getConfiguration().setLNA(getLNASlider().getLNA()); - getConfiguration().setBasebandGainReduction(getBasebandSlider().getGR()); + getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); saveConfiguration(); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/RspDuoTuner2Editor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/RspDuoTuner2Editor.java index 7001df1ee..f6dc89ad3 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/RspDuoTuner2Editor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/RspDuoTuner2Editor.java @@ -96,8 +96,8 @@ private void init() add(getGainPanel(), "wrap"); add(new JLabel("LNA:")); add(getLNASlider(), "wrap"); - add(new JLabel("Baseband:")); - add(getBasebandSlider(), "wrap"); + add(new JLabel("IF:")); + add(getIfGainSlider(), "wrap"); add(new JSeparator(), "span,growx,push"); @@ -185,7 +185,7 @@ protected void tunerStatusUpdated() getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); - getBasebandSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); + getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); //Register to receive gain overload notifications getTunerController().getControlRsp().setGainOverloadListener(this); @@ -193,7 +193,7 @@ protected void tunerStatusUpdated() } getLNASlider().setEnabled(hasTuner()); - getBasebandSlider().setEnabled(hasTuner()); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getRfDabNotchCheckBox().setEnabled(hasTuner()); @@ -261,7 +261,7 @@ public void save() getConfiguration().setRfDabNotch(getRfDabNotchCheckBox().isSelected()); getConfiguration().setRfNotch(getRfNotchCheckBox().isSelected()); getConfiguration().setLNA(getLNASlider().getLNA()); - getConfiguration().setBasebandGainReduction(getBasebandSlider().getGR()); + getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); saveConfiguration(); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerEditor.java index 87f078205..f36d725c1 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerEditor.java @@ -91,8 +91,8 @@ private void init() add(getGainPanel(), "wrap"); add(new JLabel("LNA:")); add(getLNASlider(), "wrap"); - add(new JLabel("Baseband:")); - add(getBasebandSlider(), "wrap"); + add(new JLabel("IF:")); + add(getIfGainSlider(), "wrap"); add(new JSeparator(), "span,growx,push"); @@ -160,7 +160,7 @@ protected void tunerStatusUpdated() getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); - getBasebandSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); + getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); //Register to receive gain overload notifications getTunerController().getControlRsp().setGainOverloadListener(this); @@ -168,7 +168,7 @@ protected void tunerStatusUpdated() } getLNASlider().setEnabled(hasTuner()); - getBasebandSlider().setEnabled(hasTuner()); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getBiasTCheckBox().setEnabled(hasTuner()); @@ -240,7 +240,7 @@ public void save() getConfiguration().setRfNotch(getRfNotchCheckBox().isSelected()); getConfiguration().setAntenna((RspDxAntenna) getAntennaCombo().getSelectedItem()); getConfiguration().setLNA(getLNASlider().getLNA()); - getConfiguration().setBasebandGainReduction(getBasebandSlider().getGR()); + getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); saveConfiguration();