#536 Add Bias-T support for Airspy, Airspy HF and Funcube Dongles. (#2599)

Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
Denny Sheirer
2026-11-08 04:05:58 -05:00
committed by GitHub
parent 07fd8c2923
commit ec7efa4d17
12 changed files with 439 additions and 3 deletions

View File

@@ -32,6 +32,7 @@ public class AirspyTunerConfiguration extends TunerConfiguration
private int mLNAGain = AirspyTunerController.LNA_GAIN_DEFAULT; private int mLNAGain = AirspyTunerController.LNA_GAIN_DEFAULT;
private boolean mMixerAGC = false; private boolean mMixerAGC = false;
private boolean mLNAAGC = false; private boolean mLNAAGC = false;
private boolean mBiasT = false;
/** /**
* Default constructor for JAXB * Default constructor for JAXB
@@ -129,4 +130,15 @@ public class AirspyTunerConfiguration extends TunerConfiguration
{ {
mLNAAGC = enabled; mLNAAGC = enabled;
} }
@JacksonXmlProperty(isAttribute = true, localName = "bias_t")
public boolean isBiasT()
{
return mBiasT;
}
public void setBiasT(boolean enabled)
{
mBiasT = enabled;
}
} }

View File

@@ -183,13 +183,22 @@ public class AirspyTunerController extends TunerController
} }
/** /**
* Closes the device, which also stops streaming. * Turns off the bias-T and closes the device, which also stops streaming.
* @param device to close, or null * @param device to close, or null
*/ */
private static void closeDevice(AirspyDevice device) private static void closeDevice(AirspyDevice device)
{ {
if(device != null) if(device != null)
{ {
try
{
device.setBiasTee(false);
}
catch(AirspyException | RuntimeException e)
{
mLog.warn("Error turning off Airspy bias-T before closing the device - " + e.getMessage());
}
try try
{ {
device.close(); device.close();
@@ -462,6 +471,7 @@ public class AirspyTunerController extends TunerController
setLNAGain(config.getLNAGain()); setLNAGain(config.getLNAGain());
setMixerAGC(config.isMixerAGC()); setMixerAGC(config.isMixerAGC());
setLNAAGC(config.isLNAAGC()); setLNAAGC(config.isLNAAGC());
setBiasT(config.isBiasT());
//Set the gain mode last, so custom values are already set, and linearity and sensitivity modes will //Set the gain mode last, so custom values are already set, and linearity and sensitivity modes will
//automatically override the custom values. //automatically override the custom values.
@@ -620,6 +630,17 @@ public class AirspyTunerController extends TunerController
execute(device -> device.setLnaAgc(enabled)); execute(device -> device.setLnaAgc(enabled));
} }
/**
* Enables/disables the Bias-T (RF bias tee) power output for active antennas
*
* @param enabled true to enable Bias-T, false to disable
* @throws SourceException on error
*/
public void setBiasT(boolean enabled) throws SourceException
{
execute(device -> device.setBiasTee(enabled));
}
public void setGain(Gain gain) throws SourceException public void setGain(Gain gain) throws SourceException
{ {
if(gain != Gain.CUSTOM) if(gain != Gain.CUSTOM)

View File

@@ -66,6 +66,7 @@ public class AirspyTunerEditor extends TunerEditor<AirspyTuner, AirspyTunerConfi
private JLabel mMixerGainValueLabel; private JLabel mMixerGainValueLabel;
private JCheckBox mLNAAGCCheckBox; private JCheckBox mLNAAGCCheckBox;
private JCheckBox mMixerAGCCheckBox; private JCheckBox mMixerAGCCheckBox;
private JCheckBox mBiasTCheckBox;
/** /**
* Constructs an instance * Constructs an instance
@@ -116,6 +117,8 @@ public class AirspyTunerEditor extends TunerEditor<AirspyTuner, AirspyTunerConfi
getFrequencyPanel().updateControls(); getFrequencyPanel().updateControls();
getSampleRateCombo().setEnabled(hasTuner() && !getTuner().getTunerController().isLockedSampleRate()); getSampleRateCombo().setEnabled(hasTuner() && !getTuner().getTunerController().isLockedSampleRate());
getTunerInfoButton().setEnabled(hasTuner()); getTunerInfoButton().setEnabled(hasTuner());
getBiasTCheckBox().setEnabled(hasTuner());
getBiasTCheckBox().setSelected(hasTuner() && hasConfiguration() && getConfiguration().isBiasT());
updateGainComponents((hasTuner() && hasConfiguration()) ? getConfiguration().getGain() : null); updateGainComponents((hasTuner() && hasConfiguration()) ? getConfiguration().getGain() : null);
if(hasTuner()) if(hasTuner())
@@ -159,6 +162,9 @@ public class AirspyTunerEditor extends TunerEditor<AirspyTuner, AirspyTunerConfi
add(new JLabel("Sample Rate:")); add(new JLabel("Sample Rate:"));
add(getSampleRateCombo(), "wrap"); add(getSampleRateCombo(), "wrap");
add(new JLabel(""));
add(getBiasTCheckBox(), "wrap");
add(new JSeparator(), "span,growx,push"); add(new JSeparator(), "span,growx,push");
add(new JLabel("Gain Control"), "wrap"); add(new JLabel("Gain Control"), "wrap");
@@ -182,6 +188,37 @@ public class AirspyTunerEditor extends TunerEditor<AirspyTuner, AirspyTunerConfi
add(getLNAGainValueLabel()); add(getLNAGainValueLabel());
} }
/**
* Checkbox to enable/disable Bias-T power for active antennas
*/
private JCheckBox getBiasTCheckBox()
{
if(mBiasTCheckBox == null)
{
mBiasTCheckBox = new JCheckBox("Bias-T");
mBiasTCheckBox.setEnabled(false);
mBiasTCheckBox.setToolTipText("Enable Bias-T power output for active antennas");
mBiasTCheckBox.addActionListener(e ->
{
if(hasTuner() && !isLoading())
{
try
{
getTuner().getController().setBiasT(mBiasTCheckBox.isSelected());
save();
}
catch(Exception e1)
{
mLog.error("Error setting Bias-T", e1);
JOptionPane.showMessageDialog(mBiasTCheckBox, "Couldn't set Bias-T: " + e1.getMessage());
}
}
});
}
return mBiasTCheckBox;
}
private JCheckBox getLNAAGCCheckBox() private JCheckBox getLNAAGCCheckBox()
{ {
if(mLNAAGCCheckBox == null) if(mLNAAGCCheckBox == null)
@@ -607,6 +644,7 @@ public class AirspyTunerEditor extends TunerEditor<AirspyTuner, AirspyTunerConfi
getConfiguration().setLNAGain(getLNAGainSlider().getValue()); getConfiguration().setLNAGain(getLNAGainSlider().getValue());
getConfiguration().setMixerAGC(getMixerAGCCheckBox().isSelected()); getConfiguration().setMixerAGC(getMixerAGCCheckBox().isSelected());
getConfiguration().setLNAAGC(getLNAAGCCheckBox().isSelected()); getConfiguration().setLNAAGC(getLNAAGCCheckBox().isSelected());
getConfiguration().setBiasT(getBiasTCheckBox().isSelected());
saveConfiguration(); saveConfiguration();
} }
} }

View File

@@ -32,6 +32,7 @@ public class AirspyHfTunerConfiguration extends TunerConfiguration
private boolean mAgc; private boolean mAgc;
private boolean mLna; private boolean mLna;
private int mAttenuation; private int mAttenuation;
private boolean mBiasT;
/** /**
* Default constructor for JAXB * Default constructor for JAXB
@@ -114,6 +115,25 @@ public class AirspyHfTunerConfiguration extends TunerConfiguration
mLna = lna; mLna = lna;
} }
/**
* Indicates if the Bias-T power output is enabled. Only applies to devices whose firmware supports a bias-T.
* @return bias-T enabled state
*/
@JacksonXmlProperty(isAttribute = true, localName = "bias_t")
public boolean isBiasT()
{
return mBiasT;
}
/**
* Sets the Bias-T power output enabled state
* @param enabled true to enable
*/
public void setBiasT(boolean enabled)
{
mBiasT = enabled;
}
/** /**
* Attenuation setting. * Attenuation setting.
* @return attenuation setting index value. * @return attenuation setting index value.

View File

@@ -73,6 +73,8 @@ public class AirspyHfTunerController extends TunerController
private Attenuation mAttenuation = Attenuation.A0; private Attenuation mAttenuation = Attenuation.A0;
private boolean mAgcEnabled; private boolean mAgcEnabled;
private boolean mLnaEnabled; private boolean mLnaEnabled;
private boolean mBiasTSupported;
private boolean mBiasTEnabled;
private volatile float mSamplesPerMillisecond = DEFAULT_SAMPLE_RATE.getSampleRate() / 1000.0f; private volatile float mSamplesPerMillisecond = DEFAULT_SAMPLE_RATE.getSampleRate() / 1000.0f;
private volatile int mBufferSampleCount = DEFAULT_BUFFER_SAMPLE_COUNT; private volatile int mBufferSampleCount = DEFAULT_BUFFER_SAMPLE_COUNT;
private boolean mStreaming = false; private boolean mStreaming = false;
@@ -116,6 +118,8 @@ public class AirspyHfTunerController extends TunerController
try try
{ {
mBiasTSupported = false;
mBiasTEnabled = false;
mDevice = AirspyHf.open(serialNumber); mDevice = AirspyHf.open(serialNumber);
BoardInfo boardInfo = mDevice.boardInfo(); BoardInfo boardInfo = mDevice.boardInfo();
@@ -139,6 +143,8 @@ public class AirspyHfTunerController extends TunerController
} }
mAvailableSampleRates = Collections.unmodifiableList(sampleRates); mAvailableSampleRates = Collections.unmodifiableList(sampleRates);
mBiasTSupported = detectBiasTSupport(mDevice);
mBiasTEnabled = false;
//Force the sample rate to be applied, since the rate discovery leaves the device at the last rate. //Force the sample rate to be applied, since the rate discovery leaves the device at the last rate.
mCurrentSampleRate = null; mCurrentSampleRate = null;
@@ -161,6 +167,7 @@ public class AirspyHfTunerController extends TunerController
public void stop() public void stop()
{ {
AirspyHfDevice device; AirspyHfDevice device;
boolean biasTEnabled;
getLock().lock(); getLock().lock();
@@ -169,6 +176,8 @@ public class AirspyHfTunerController extends TunerController
device = mDevice; device = mDevice;
mDevice = null; mDevice = null;
mStreaming = false; mStreaming = false;
biasTEnabled = mBiasTEnabled;
mBiasTEnabled = false;
} }
finally finally
{ {
@@ -176,9 +185,58 @@ public class AirspyHfTunerController extends TunerController
} }
mNativeBufferBroadcaster.clear(); mNativeBufferBroadcaster.clear();
if(device != null && biasTEnabled)
{
try
{
device.setBiasTee(0);
}
catch(AirspyHfException | RuntimeException e)
{
mLog.warn("Error turning off Airspy HF bias-T before closing the device - " + e.getMessage());
}
}
closeDevice(device); closeDevice(device);
} }
/**
* Detects if the device firmware supports a bias-T. Firmware without bias-T support rejects the bias-T commands.
* Some firmware (HF+ Discovery R5.0.1) rejects the bias-T count request, so this falls back to turning the bias-T
* off, which is a safe probe since the bias-T should be off at startup anyway.
* @param device to probe
* @return true if the device accepts bias-T commands
*/
private static boolean detectBiasTSupport(AirspyHfDevice device)
{
try
{
if(device.biasTeeCount() > 0)
{
device.setBiasTee(0);
return true;
}
return false;
}
catch(AirspyHfException | RuntimeException e)
{
//Bias-T count not supported - fall through and probe with a bias-T off command.
}
try
{
device.setBiasTee(0);
return true;
}
catch(AirspyHfException | RuntimeException e)
{
mLog.debug("Airspy HF firmware doesn't support bias-T - " + e.getMessage());
return false;
}
}
/** /**
* Closes the device, which also stops streaming. * Closes the device, which also stops streaming.
* @param device to close, or null * @param device to close, or null
@@ -448,6 +506,11 @@ public class AirspyHfTunerController extends TunerController
setLna(airspyConfig.isLna()); setLna(airspyConfig.isLna());
setAttenuation(airspyConfig.getAttenuation()); setAttenuation(airspyConfig.getAttenuation());
setAgc(airspyConfig.isAgc()); setAgc(airspyConfig.isAgc());
if(isBiasTSupported())
{
setBiasT(airspyConfig.isBiasT());
}
} }
catch(SourceException se) catch(SourceException se)
{ {
@@ -670,4 +733,38 @@ public class AirspyHfTunerController extends TunerController
execute(device -> device.setAttenuationStep(attenuation.getValue())); execute(device -> device.setAttenuationStep(attenuation.getValue()));
mAttenuation = attenuation; mAttenuation = attenuation;
} }
/**
* Indicates if the device firmware supports a bias-T, available once the tuner is started.
* @return true if supported
*/
public boolean isBiasTSupported()
{
return mBiasTSupported;
}
/**
* Indicates if the Bias-T power output is enabled.
* @return enabled state
*/
public boolean getBiasT()
{
return mBiasTEnabled;
}
/**
* Enables/disables the Bias-T (RF bias tee) power output for active antennas
* @param enabled true to enable Bias-T, false to disable
* @throws SourceException if the device doesn't support a bias-T or there is an error
*/
public void setBiasT(boolean enabled) throws SourceException
{
if(!mBiasTSupported)
{
throw new SourceException("Airspy HF firmware doesn't support bias-T");
}
execute(device -> device.setBiasTee(enabled ? 1 : 0));
mBiasTEnabled = enabled;
}
} }

View File

@@ -46,6 +46,7 @@ public class AirspyHfTunerEditor extends TunerEditor<AirspyHfTuner,AirspyHfTuner
private JComboBox<Attenuation> mAttenuationCombo; private JComboBox<Attenuation> mAttenuationCombo;
private JToggleButton mAgcToggleButton; private JToggleButton mAgcToggleButton;
private JToggleButton mLnaToggleButton; private JToggleButton mLnaToggleButton;
private JToggleButton mBiasTToggleButton;
/** /**
* Constructs an instance * Constructs an instance
@@ -100,6 +101,7 @@ public class AirspyHfTunerEditor extends TunerEditor<AirspyHfTuner,AirspyHfTuner
buttonPanel.setLayout(new MigLayout("insets 0", "[left]", "")); buttonPanel.setLayout(new MigLayout("insets 0", "[left]", ""));
buttonPanel.add(getAgcToggleButton()); buttonPanel.add(getAgcToggleButton());
buttonPanel.add(getLnaToggleButton()); buttonPanel.add(getLnaToggleButton());
buttonPanel.add(getBiasTToggleButton());
add(new JLabel(" ")); add(new JLabel(" "));
add(buttonPanel, "wrap"); add(buttonPanel, "wrap");
@@ -125,6 +127,12 @@ public class AirspyHfTunerEditor extends TunerEditor<AirspyHfTuner,AirspyHfTuner
getConfiguration().setAgc(getAgcToggleButton().isSelected()); getConfiguration().setAgc(getAgcToggleButton().isSelected());
getConfiguration().setLna(getLnaToggleButton().isSelected()); getConfiguration().setLna(getLnaToggleButton().isSelected());
//Only update bias-T when the device supports it, so the saved setting isn't lost on unsupported firmware.
if(getTuner().getController().isBiasTSupported())
{
getConfiguration().setBiasT(getBiasTToggleButton().isSelected());
}
saveConfiguration(); saveConfiguration();
} }
} }
@@ -158,6 +166,11 @@ public class AirspyHfTunerEditor extends TunerEditor<AirspyHfTuner,AirspyHfTuner
getAgcToggleButton().setSelected(getTuner().getController().getAgc()); getAgcToggleButton().setSelected(getTuner().getController().getAgc());
getLnaToggleButton().setEnabled(true); getLnaToggleButton().setEnabled(true);
getLnaToggleButton().setSelected(getTuner().getController().getLna()); getLnaToggleButton().setSelected(getTuner().getController().getLna());
boolean biasTSupported = getTuner().getController().isBiasTSupported();
getBiasTToggleButton().setEnabled(biasTSupported);
getBiasTToggleButton().setSelected(biasTSupported && getTuner().getController().getBiasT());
getBiasTToggleButton().setToolTipText(biasTSupported ? "Enable Bias-T power output for active antennas" :
"Bias-T not supported by this device or firmware");
getSampleRateCombo().setSelectedItem(getTuner().getController().getCurrentAirspySampleRate()); getSampleRateCombo().setSelectedItem(getTuner().getController().getCurrentAirspySampleRate());
getAttenuationCombo().setEnabled(!getTuner().getController().getAgc()); getAttenuationCombo().setEnabled(!getTuner().getController().getAgc());
getAttenuationCombo().setSelectedItem(getTuner().getController().getAttenuation()); getAttenuationCombo().setSelectedItem(getTuner().getController().getAttenuation());
@@ -169,6 +182,9 @@ public class AirspyHfTunerEditor extends TunerEditor<AirspyHfTuner,AirspyHfTuner
getAgcToggleButton().setSelected(false); getAgcToggleButton().setSelected(false);
getLnaToggleButton().setEnabled(false); getLnaToggleButton().setEnabled(false);
getLnaToggleButton().setSelected(false); getLnaToggleButton().setSelected(false);
getBiasTToggleButton().setEnabled(false);
getBiasTToggleButton().setSelected(false);
getBiasTToggleButton().setToolTipText("No tuner available");
getSampleRateCombo().setEnabled(false); getSampleRateCombo().setEnabled(false);
getAttenuationCombo().setEnabled(false); getAttenuationCombo().setEnabled(false);
getAttenuationCombo().setSelectedItem(Attenuation.A0); getAttenuationCombo().setSelectedItem(Attenuation.A0);
@@ -344,4 +360,36 @@ public class AirspyHfTunerEditor extends TunerEditor<AirspyHfTuner,AirspyHfTuner
return mLnaToggleButton; return mLnaToggleButton;
} }
/**
* Bias-T toggle button, enabled only when the device firmware supports a bias-T.
*/
private JToggleButton getBiasTToggleButton()
{
if(mBiasTToggleButton == null)
{
mBiasTToggleButton = new JToggleButton("Bias-T");
mBiasTToggleButton.setToolTipText("Enable Bias-T power output for active antennas");
mBiasTToggleButton.setEnabled(false);
mBiasTToggleButton.addActionListener(e -> {
if(hasTuner() && !isLoading())
{
try
{
getTuner().getController().setBiasT(mBiasTToggleButton.isSelected());
save();
}
catch(SourceException se)
{
mLog.error("Error setting Airspy HF Bias-T", se);
mBiasTToggleButton.setSelected(getTuner().getController().getBiasT());
JOptionPane.showMessageDialog(AirspyHfTunerEditor.this,
"Airspy HF Tuner Controller - couldn't change Bias-T setting " + se.getLocalizedMessage());
}
}
});
}
return mBiasTToggleButton;
}
} }

View File

@@ -35,6 +35,7 @@ public class FCD1TunerConfiguration extends TunerConfiguration
private LNAGain mLNAGain = LNAGain.LNA_GAIN_PLUS_20_0; private LNAGain mLNAGain = LNAGain.LNA_GAIN_PLUS_20_0;
private LNAEnhance mLNAEnhance = LNAEnhance.LNA_ENHANCE_OFF; private LNAEnhance mLNAEnhance = LNAEnhance.LNA_ENHANCE_OFF;
private MixerGain mMixerGain = MixerGain.MIXER_GAIN_PLUS_12_0; private MixerGain mMixerGain = MixerGain.MIXER_GAIN_PLUS_12_0;
private boolean mBiasT = false;
/** /**
* Default constructor for JAXB * Default constructor for JAXB
@@ -132,4 +133,15 @@ public class FCD1TunerConfiguration extends TunerConfiguration
{ {
mGainCorrection = value; mGainCorrection = value;
} }
@JacksonXmlProperty(isAttribute = true, localName = "bias_t")
public boolean isBiasT()
{
return mBiasT;
}
public void setBiasT(boolean enabled)
{
mBiasT = enabled;
}
} }

View File

@@ -49,6 +49,7 @@ public class FCD1TunerController extends FCDTunerController
private LNAGain mLNAGain; private LNAGain mLNAGain;
private LNAEnhance mLNAEnhance; private LNAEnhance mLNAEnhance;
private MixerGain mMixerGain; private MixerGain mMixerGain;
private boolean mBiasTEnabled = false;
/** /**
* Constructs an instance * Constructs an instance
@@ -123,9 +124,61 @@ public class FCD1TunerController extends FCDTunerController
//Re-cast any usb exceptions as source exceptions //Re-cast any usb exceptions as source exceptions
throw new SourceException("FCD 1 Controller error applying tuner config - " + e.getLocalizedMessage()); throw new SourceException("FCD 1 Controller error applying tuner config - " + e.getLocalizedMessage());
} }
//Apply the bias-T separately so that a bias-T error doesn't prevent the tuner from starting.
try
{
setBiasT(fcd1.isBiasT());
}
catch(SourceException se)
{
mLog.warn("FCD 1 Controller couldn't apply bias-T setting - " + se.getMessage());
}
} }
} }
/**
* Enables/disables the Bias-T (RF bias tee) power output for active antennas
*
* @param enabled true to enable Bias-T, false to disable
* @throws SourceException on error
*/
public void setBiasT(boolean enabled) throws SourceException
{
try
{
send(FCDCommand.APP_SET_BIAS_TEE, enabled ? 1 : 0);
mBiasTEnabled = enabled;
}
catch(Exception e)
{
throw new SourceException("Couldn't set FCD Pro bias-T", e);
}
}
/**
* Turns off the bias-T, when enabled, before closing the device.
*/
@Override
public void stop()
{
if(mBiasTEnabled)
{
try
{
setBiasT(false);
}
catch(Exception e)
{
mLog.warn("Error turning off FCD Pro bias-T before closing the device - " + e.getMessage());
}
mBiasTEnabled = false;
}
super.stop();
}
/** /**
* Gets the current LNA Gain value from the controller and stores it * Gets the current LNA Gain value from the controller and stores it
*/ */

View File

@@ -19,6 +19,7 @@
package io.github.dsheirer.source.tuner.fcd.proV1; package io.github.dsheirer.source.tuner.fcd.proV1;
import io.github.dsheirer.preference.UserPreferences; import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.source.SourceException;
import io.github.dsheirer.source.tuner.fcd.FCDTuner; import io.github.dsheirer.source.tuner.fcd.FCDTuner;
import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerController.LNAEnhance; import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerController.LNAEnhance;
import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerController.LNAGain; import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerController.LNAGain;
@@ -32,6 +33,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@@ -52,6 +54,7 @@ public class FCD1TunerEditor extends TunerEditor<FCDTuner,FCD1TunerConfiguration
private JComboBox<LNAGain> mLnaGainCombo; private JComboBox<LNAGain> mLnaGainCombo;
private JComboBox<LNAEnhance> mLnaEnhanceCombo; private JComboBox<LNAEnhance> mLnaEnhanceCombo;
private JComboBox<MixerGain> mMixerGainCombo; private JComboBox<MixerGain> mMixerGainCombo;
private JCheckBox mBiasTCheckBox;
private CorrectionSpinner mCorrectionDCI; private CorrectionSpinner mCorrectionDCI;
private CorrectionSpinner mCorrectionDCQ; private CorrectionSpinner mCorrectionDCQ;
private CorrectionSpinner mGainCorrectionSpinner; private CorrectionSpinner mGainCorrectionSpinner;
@@ -121,6 +124,7 @@ public class FCD1TunerEditor extends TunerEditor<FCDTuner,FCD1TunerConfiguration
getMixerGainCombo().setSelectedItem(getConfiguration().getMixerGain()); getMixerGainCombo().setSelectedItem(getConfiguration().getMixerGain());
getLnaEnhanceCombo().setSelectedItem(getConfiguration().getLNAEnhance()); getLnaEnhanceCombo().setSelectedItem(getConfiguration().getLNAEnhance());
getLnaGainCombo().setSelectedItem(getConfiguration().getLNAGain()); getLnaGainCombo().setSelectedItem(getConfiguration().getLNAGain());
getBiasTCheckBox().setSelected(getConfiguration().isBiasT());
getDcCorrectionSpinnerI().setValue(getConfiguration().getInphaseDCCorrection()); getDcCorrectionSpinnerI().setValue(getConfiguration().getInphaseDCCorrection());
getDcCorrectionSpinnerQ().setValue(getConfiguration().getQuadratureDCCorrection()); getDcCorrectionSpinnerQ().setValue(getConfiguration().getQuadratureDCCorrection());
getPhaseCorrectionSpinner().setValue(getConfiguration().getGainCorrection()); getPhaseCorrectionSpinner().setValue(getConfiguration().getGainCorrection());
@@ -130,6 +134,7 @@ public class FCD1TunerEditor extends TunerEditor<FCDTuner,FCD1TunerConfiguration
getMixerGainCombo().setEnabled(hasTuner()); getMixerGainCombo().setEnabled(hasTuner());
getLnaEnhanceCombo().setEnabled(hasTuner()); getLnaEnhanceCombo().setEnabled(hasTuner());
getLnaGainCombo().setEnabled(hasTuner()); getLnaGainCombo().setEnabled(hasTuner());
getBiasTCheckBox().setEnabled(hasTuner());
getDcCorrectionSpinnerI().setEnabled(hasTuner()); getDcCorrectionSpinnerI().setEnabled(hasTuner());
getDcCorrectionSpinnerQ().setEnabled(hasTuner()); getDcCorrectionSpinnerQ().setEnabled(hasTuner());
getPhaseCorrectionSpinner().setEnabled(hasTuner()); getPhaseCorrectionSpinner().setEnabled(hasTuner());
@@ -164,6 +169,8 @@ public class FCD1TunerEditor extends TunerEditor<FCDTuner,FCD1TunerConfiguration
add(getLnaEnhanceCombo(), "wrap"); add(getLnaEnhanceCombo(), "wrap");
add(new JLabel("Mixer:")); add(new JLabel("Mixer:"));
add(getMixerGainCombo(), "wrap"); add(getMixerGainCombo(), "wrap");
add(new JLabel(""));
add(getBiasTCheckBox(), "wrap");
add(new JSeparator(), "span,growx,push"); add(new JSeparator(), "span,growx,push");
add(new JLabel("Correction"), "span,align center"); add(new JLabel("Correction"), "span,align center");
@@ -209,6 +216,37 @@ public class FCD1TunerEditor extends TunerEditor<FCDTuner,FCD1TunerConfiguration
return mLnaGainCombo; return mLnaGainCombo;
} }
/**
* Checkbox to enable/disable Bias-T power for active antennas
*/
public JCheckBox getBiasTCheckBox()
{
if(mBiasTCheckBox == null)
{
mBiasTCheckBox = new JCheckBox("Bias-T");
mBiasTCheckBox.setEnabled(false);
mBiasTCheckBox.setToolTipText("Enable Bias-T power output for active antennas");
mBiasTCheckBox.addActionListener(event ->
{
if(hasTuner() && !isLoading())
{
try
{
getController().setBiasT(mBiasTCheckBox.isSelected());
save();
}
catch(SourceException e)
{
mLog.error("Couldn't set bias-T for FCD Pro", e);
JOptionPane.showMessageDialog(FCD1TunerEditor.this, "Couldn't set Bias-T: " + e.getMessage());
}
}
});
}
return mBiasTCheckBox;
}
public JComboBox getLnaEnhanceCombo() public JComboBox getLnaEnhanceCombo()
{ {
if(mLnaEnhanceCombo == null) if(mLnaEnhanceCombo == null)
@@ -386,6 +424,7 @@ public class FCD1TunerEditor extends TunerEditor<FCDTuner,FCD1TunerConfiguration
getConfiguration().setLNAEnhance((LNAEnhance) mLnaEnhanceCombo.getSelectedItem()); getConfiguration().setLNAEnhance((LNAEnhance) mLnaEnhanceCombo.getSelectedItem());
getConfiguration().setLNAGain((LNAGain) mLnaGainCombo.getSelectedItem()); getConfiguration().setLNAGain((LNAGain) mLnaGainCombo.getSelectedItem());
getConfiguration().setMixerGain((MixerGain) mMixerGainCombo.getSelectedItem()); getConfiguration().setMixerGain((MixerGain) mMixerGainCombo.getSelectedItem());
getConfiguration().setBiasT(getBiasTCheckBox().isSelected());
double dci = ((SpinnerNumberModel)mCorrectionDCI.getModel()).getNumber().doubleValue(); double dci = ((SpinnerNumberModel)mCorrectionDCI.getModel()).getNumber().doubleValue();
getConfiguration().setInphaseDCCorrection(dci); getConfiguration().setInphaseDCCorrection(dci);
double dcq = ((SpinnerNumberModel)mCorrectionDCQ.getModel()).getNumber().doubleValue(); double dcq = ((SpinnerNumberModel)mCorrectionDCQ.getModel()).getNumber().doubleValue();

View File

@@ -27,6 +27,7 @@ public class FCD2TunerConfiguration extends TunerConfiguration
{ {
private boolean mGainLNA = true; private boolean mGainLNA = true;
private boolean mGainMixer = true; private boolean mGainMixer = true;
private boolean mBiasT = false;
/** /**
* Default constructor for JAXB * Default constructor for JAXB
@@ -69,4 +70,15 @@ public class FCD2TunerConfiguration extends TunerConfiguration
{ {
mGainMixer = gain; mGainMixer = gain;
} }
@JacksonXmlProperty(isAttribute = true, localName = "bias_t")
public boolean isBiasT()
{
return mBiasT;
}
public void setBiasT(boolean enabled)
{
mBiasT = enabled;
}
} }

View File

@@ -43,6 +43,7 @@ public class FCD2TunerController extends FCDTunerController
public static final int MINIMUM_TUNABLE_FREQUENCY_HZ = 150000; public static final int MINIMUM_TUNABLE_FREQUENCY_HZ = 150000;
public static final int MAXIMUM_TUNABLE_FREQUENCY_HZ = 2050000000; public static final int MAXIMUM_TUNABLE_FREQUENCY_HZ = 2050000000;
public static final int SAMPLE_RATE = 192000; public static final int SAMPLE_RATE = 192000;
private boolean mBiasTEnabled = false;
/** /**
* Constructs an instance * Constructs an instance
@@ -98,6 +99,48 @@ public class FCD2TunerController extends FCDTunerController
send(FCDCommand.APP_SET_MIXER_GAIN, enabled ? 1 : 0); send(FCDCommand.APP_SET_MIXER_GAIN, enabled ? 1 : 0);
} }
/**
* Enables/disables the Bias-T (RF bias tee) power output for active antennas
*
* @param enabled true to enable Bias-T, false to disable
* @throws SourceException on error
*/
public void setBiasT(boolean enabled) throws SourceException
{
try
{
send(FCDCommand.APP_SET_BIAS_TEE, enabled ? 1 : 0);
mBiasTEnabled = enabled;
}
catch(Exception e)
{
throw new SourceException("Couldn't set FCD Pro Plus bias-T", e);
}
}
/**
* Turns off the bias-T, when enabled, before closing the device.
*/
@Override
public void stop()
{
if(mBiasTEnabled)
{
try
{
setBiasT(false);
}
catch(Exception e)
{
mLog.warn("Error turning off FCD Pro Plus bias-T before closing the device - " + e.getMessage());
}
mBiasTEnabled = false;
}
super.stop();
}
@Override @Override
public void apply(TunerConfiguration config) throws SourceException public void apply(TunerConfiguration config) throws SourceException
{ {
@@ -108,6 +151,7 @@ public class FCD2TunerController extends FCDTunerController
{ {
setLNAGain(fcd2.getGainLNA()); setLNAGain(fcd2.getGainLNA());
setMixerGain(fcd2.getGainMixer()); setMixerGain(fcd2.getGainMixer());
setBiasT(fcd2.isBiasT());
} }
} }

View File

@@ -32,6 +32,7 @@ import javax.swing.JButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import javax.swing.SpinnerNumberModel; import javax.swing.SpinnerNumberModel;
@@ -45,6 +46,7 @@ public class FCD2TunerEditor extends TunerEditor<FCDTuner, FCD2TunerConfiguratio
private JButton mTunerInfoButton; private JButton mTunerInfoButton;
private JCheckBox mLnaGainCheckBox; private JCheckBox mLnaGainCheckBox;
private JCheckBox mMixerGainCheckBox; private JCheckBox mMixerGainCheckBox;
private JCheckBox mBiasTCheckBox;
/** /**
* Constructs an instance * Constructs an instance
@@ -106,11 +108,13 @@ public class FCD2TunerEditor extends TunerEditor<FCDTuner, FCD2TunerConfiguratio
getTunerInfoButton().setEnabled(hasTuner()); getTunerInfoButton().setEnabled(hasTuner());
getLnaGainCheckBox().setEnabled(hasTuner()); getLnaGainCheckBox().setEnabled(hasTuner());
getMixerGainCheckBox().setEnabled(hasTuner()); getMixerGainCheckBox().setEnabled(hasTuner());
getBiasTCheckBox().setEnabled(hasTuner());
if(hasTuner() && hasConfiguration()) if(hasTuner() && hasConfiguration())
{ {
getLnaGainCheckBox().setSelected(getConfiguration().getGainLNA()); getLnaGainCheckBox().setSelected(getConfiguration().getGainLNA());
getMixerGainCheckBox().setSelected(getConfiguration().getGainMixer()); getMixerGainCheckBox().setSelected(getConfiguration().getGainMixer());
getBiasTCheckBox().setSelected(getConfiguration().isBiasT());
} }
setLoading(false); setLoading(false);
@@ -135,8 +139,12 @@ public class FCD2TunerEditor extends TunerEditor<FCDTuner, FCD2TunerConfiguratio
add(getFrequencyPanel(), "wrap"); add(getFrequencyPanel(), "wrap");
add(new JSeparator(), "span,growx,push"); add(new JSeparator(), "span,growx,push");
add(getLnaGainCheckBox()); JPanel checkBoxPanel = new JPanel();
add(getMixerGainCheckBox()); checkBoxPanel.setLayout(new MigLayout("insets 0", "[left][left][left]", ""));
checkBoxPanel.add(getLnaGainCheckBox());
checkBoxPanel.add(getMixerGainCheckBox());
checkBoxPanel.add(getBiasTCheckBox());
add(checkBoxPanel, "span,align left");
} }
public JButton getTunerInfoButton() public JButton getTunerInfoButton()
@@ -204,6 +212,37 @@ public class FCD2TunerEditor extends TunerEditor<FCDTuner, FCD2TunerConfiguratio
return mMixerGainCheckBox; return mMixerGainCheckBox;
} }
/**
* Checkbox to enable/disable Bias-T power for active antennas
*/
public JCheckBox getBiasTCheckBox()
{
if(mBiasTCheckBox == null)
{
mBiasTCheckBox = new JCheckBox("Bias-T");
mBiasTCheckBox.setEnabled(false);
mBiasTCheckBox.setToolTipText("Enable Bias-T power output for active antennas");
mBiasTCheckBox.addActionListener(event ->
{
if(hasTuner() && !isLoading())
{
try
{
getController().setBiasT(getBiasTCheckBox().isSelected());
save();
}
catch(SourceException e)
{
mLog.error("Couldn't set bias-T for FCD2", e);
JOptionPane.showMessageDialog(mBiasTCheckBox, "Couldn't set Bias-T: " + e.getMessage());
}
}
});
}
return mBiasTCheckBox;
}
@Override @Override
public void setTunerLockState(boolean locked) public void setTunerLockState(boolean locked)
{ {
@@ -255,6 +294,7 @@ public class FCD2TunerEditor extends TunerEditor<FCDTuner, FCD2TunerConfiguratio
getConfiguration().setAutoPPMCorrectionEnabled(getAutoPPMCheckBox().isSelected()); getConfiguration().setAutoPPMCorrectionEnabled(getAutoPPMCheckBox().isSelected());
getConfiguration().setGainLNA(getLnaGainCheckBox().isSelected()); getConfiguration().setGainLNA(getLnaGainCheckBox().isSelected());
getConfiguration().setGainMixer(getMixerGainCheckBox().isSelected()); getConfiguration().setGainMixer(getMixerGainCheckBox().isSelected());
getConfiguration().setBiasT(getBiasTCheckBox().isSelected());
saveConfiguration(); saveConfiguration();
} }
} }