From 91f09eceb04ab536da02c606584d35025038ac20 Mon Sep 17 00:00:00 2001 From: "T. van der Zwan" Date: Thu, 12 Dec 2013 22:54:14 +0100 Subject: [PATCH] Updated the device selection with specific sub panels per device type. Former-commit-id: 312ffdb3213c4e3698477f117adb739cbcc6a941 --- deploy/HyperCon.jar.REMOVED.git-id | 2 +- .../hyperion/hypercon/JsonStringBuffer.java | 8 +- .../hypercon/gui/ColorTransformPanel.java | 22 +++- .../hypercon/gui/device/DeviceTypePanel.java | 24 ++++ .../hypercon/gui/device/LightPackPanel.java | 63 +++++++++++ .../hypercon/gui/device/SerialPanel.java | 104 ++++++++++++++++++ .../hypercon/gui/device/TestDevicePanel.java | 63 +++++++++++ .../hypercon/gui/device/Ws2801Panel.java | 104 ++++++++++++++++++ .../hyperion/hypercon/spec/ColorConfig.java | 4 +- .../hyperion/hypercon/spec/DeviceConfig.java | 2 +- .../hyperion/hypercon/spec/EffectConfig.java | 76 ------------- .../hyperion/hypercon/spec/MiscConfig.java | 4 +- 12 files changed, 389 insertions(+), 87 deletions(-) create mode 100644 src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/DeviceTypePanel.java create mode 100644 src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/LightPackPanel.java create mode 100644 src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/SerialPanel.java create mode 100644 src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/TestDevicePanel.java create mode 100644 src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/Ws2801Panel.java delete mode 100644 src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectConfig.java diff --git a/deploy/HyperCon.jar.REMOVED.git-id b/deploy/HyperCon.jar.REMOVED.git-id index 90278ffd..2ea5f8fc 100644 --- a/deploy/HyperCon.jar.REMOVED.git-id +++ b/deploy/HyperCon.jar.REMOVED.git-id @@ -1 +1 @@ -a63791e2794fa0c76a2a5da3d0ce7b3e4f4089ff \ No newline at end of file +ada8097cb71b680dd6fa48cf190ff66c8814ad0b \ No newline at end of file diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/JsonStringBuffer.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/JsonStringBuffer.java index 58b2aa17..853423d2 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/JsonStringBuffer.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/JsonStringBuffer.java @@ -104,11 +104,15 @@ public class JsonStringBuffer { ++mIndentLevel; } - public void stopArray() { + public void stopArray(boolean lastValue) { --mIndentLevel; startLine(); - mStrBuf.append("],\n"); + if (lastValue) { + mStrBuf.append("]\n"); + } else { + mStrBuf.append("],\n"); + } } diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ColorTransformPanel.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ColorTransformPanel.java index e7dd3278..31e5bc73 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ColorTransformPanel.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ColorTransformPanel.java @@ -28,6 +28,8 @@ import org.hyperion.hypercon.spec.TransformConfig; */ public class ColorTransformPanel extends JPanel { + private final Dimension maxDim = new Dimension(1024, 20); + private final TransformConfig mColorConfig; private JPanel mIndexPanel; @@ -131,45 +133,57 @@ public class ColorTransformPanel extends JPanel { mRedTransformLabel = new JLabel("RED"); mRgbTransformPanel.add(mRedTransformLabel); mRedThresholdSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mRedThreshold, 0.0, 1.0, 0.1)); + mRedThresholdSpinner.setMaximumSize(maxDim); mRedThresholdSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mRedThresholdSpinner); mRedGammaSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mRedGamma, 0.0, 100.0, 0.1)); - mRedThresholdSpinner.addChangeListener(mChangeListener); + mRedGammaSpinner.setMaximumSize(maxDim); + mRedGammaSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mRedGammaSpinner); mRedBlacklevelSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mRedBlacklevel, 0.0, 1.0, 0.1)); - mRedThresholdSpinner.addChangeListener(mChangeListener); + mRedBlacklevelSpinner.setMaximumSize(maxDim); + mRedBlacklevelSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mRedBlacklevelSpinner); mRedWhitelevelSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mRedWhitelevel, 0.0, 1.0, 0.1)); - mRedThresholdSpinner.addChangeListener(mChangeListener); + mRedWhitelevelSpinner.setMaximumSize(maxDim); + mRedWhitelevelSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mRedWhitelevelSpinner); mGreenTransformLabel = new JLabel("GREEN"); mRgbTransformPanel.add(mGreenTransformLabel); mGreenThresholdSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mGreenThreshold, 0.0, 1.0, 0.1)); + mGreenThresholdSpinner.setMaximumSize(maxDim); mGreenThresholdSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mGreenThresholdSpinner); mGreenGammaSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mGreenGamma, 0.0, 100.0, 0.1)); + mGreenGammaSpinner.setMaximumSize(maxDim); mGreenGammaSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mGreenGammaSpinner); mGreenBlacklevelSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mGreenBlacklevel, 0.0, 1.0, 0.1)); + mGreenBlacklevelSpinner.setMaximumSize(maxDim); mGreenBlacklevelSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mGreenBlacklevelSpinner); mGreenWhitelevelSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mGreenWhitelevel, 0.0, 1.0, 0.1)); + mGreenWhitelevelSpinner.setMaximumSize(maxDim); mGreenWhitelevelSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mGreenWhitelevelSpinner); mBlueTransformLabel = new JLabel("BLUE"); mRgbTransformPanel.add(mBlueTransformLabel); mBlueThresholdSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mBlueThreshold, 0.0, 1.0, 0.1)); + mBlueThresholdSpinner.setMaximumSize(maxDim); mBlueThresholdSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mBlueThresholdSpinner); mBlueGammaSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mBlueGamma, 0.0, 100.0, 0.1)); + mBlueGammaSpinner.setMaximumSize(maxDim); mBlueGammaSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mBlueGammaSpinner); mBlueBlacklevelSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mBlueBlacklevel, 0.0, 1.0, 0.1)); + mBlueBlacklevelSpinner.setMaximumSize(maxDim); mBlueBlacklevelSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mBlueBlacklevelSpinner); mBlueWhitelevelSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mBlueWhitelevel, 0.0, 1.0, 0.1)); + mBlueWhitelevelSpinner.setMaximumSize(maxDim); mBlueWhitelevelSpinner.addChangeListener(mChangeListener); mRgbTransformPanel.add(mBlueWhitelevelSpinner); } @@ -187,6 +201,7 @@ public class ColorTransformPanel extends JPanel { mHsvTransformPanel.add(mSaturationAdjustLabel); mSaturationAdjustSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mSaturationGain, 0.0, 1024.0, 0.01)); + mSaturationAdjustSpinner.setMaximumSize(maxDim); mSaturationAdjustSpinner.addChangeListener(mChangeListener); mHsvTransformPanel.add(mSaturationAdjustSpinner); @@ -194,6 +209,7 @@ public class ColorTransformPanel extends JPanel { mHsvTransformPanel.add(mValueAdjustLabel); mValueAdjustSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mValueGain, 0.0, 1024.0, 0.01)); + mValueAdjustSpinner.setMaximumSize(maxDim); mValueAdjustSpinner.addChangeListener(mChangeListener); mHsvTransformPanel.add(mValueAdjustSpinner); diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/DeviceTypePanel.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/DeviceTypePanel.java new file mode 100644 index 00000000..09e75dd2 --- /dev/null +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/DeviceTypePanel.java @@ -0,0 +1,24 @@ +package org.hyperion.hypercon.gui.device; + +import java.awt.Dimension; + +import javax.swing.JPanel; + +import org.hyperion.hypercon.spec.DeviceConfig; + +public abstract class DeviceTypePanel extends JPanel { + + protected final Dimension firstColMinDim = new Dimension(80, 10); + protected final Dimension maxDim = new Dimension(1024, 20); + + protected DeviceConfig mDeviceConfig = null; + + public DeviceTypePanel() { + super(); + } + + public void setDeviceConfig(DeviceConfig pDeviceConfig) { + mDeviceConfig = pDeviceConfig; + } + +} diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/LightPackPanel.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/LightPackPanel.java new file mode 100644 index 00000000..05b015ab --- /dev/null +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/LightPackPanel.java @@ -0,0 +1,63 @@ +package org.hyperion.hypercon.gui.device; + +import javax.swing.GroupLayout; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; + +import org.hyperion.hypercon.spec.DeviceConfig; + +public class LightPackPanel extends DeviceTypePanel { + + private JLabel mSerialNoLabel; + private JTextField mSerialNoField; + + public LightPackPanel() { + super(); + + initialise(); + } + + @Override + public void setDeviceConfig(DeviceConfig pDeviceConfig) { + super.setDeviceConfig(pDeviceConfig); + + mSerialNoField.setText(mDeviceConfig.mOutput); + } + + private void initialise() { + mSerialNoLabel = new JLabel("Serial #: "); + mSerialNoLabel.setMinimumSize(firstColMinDim); + add(mSerialNoLabel); + + mSerialNoField = new JTextField(); + mSerialNoField.setMaximumSize(maxDim); + mSerialNoField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + mDeviceConfig.mOutput = mSerialNoField.getText(); + } + @Override + public void insertUpdate(DocumentEvent e) { + mDeviceConfig.mOutput = mSerialNoField.getText(); + } + @Override + public void changedUpdate(DocumentEvent e) { + mDeviceConfig.mOutput = mSerialNoField.getText(); + } + }); + add(mSerialNoField); + + GroupLayout layout = new GroupLayout(this); + setLayout(layout); + + layout.setHorizontalGroup(layout.createSequentialGroup() + .addComponent(mSerialNoLabel) + .addComponent(mSerialNoField)); + layout.setVerticalGroup(layout.createParallelGroup() + .addComponent(mSerialNoLabel) + .addComponent(mSerialNoField)); + } + +} diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/SerialPanel.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/SerialPanel.java new file mode 100644 index 00000000..204a6bf9 --- /dev/null +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/SerialPanel.java @@ -0,0 +1,104 @@ +package org.hyperion.hypercon.gui.device; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.GroupLayout; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import org.hyperion.hypercon.spec.DeviceConfig; + +/** + * Panel for configuring Ws2801 specific settings + */ +public class SerialPanel extends DeviceTypePanel { + + public static final String[] KnownOutputs = { "/dev/ttyS0", "/dev/ttyUSB0", "/dev/ttyAMA0", "/dev/null"}; + + private JLabel mOutputLabel; + private JComboBox mOutputCombo; + + private JLabel mBaudrateLabel; + private JSpinner mBaudrateSpinner; + + + public SerialPanel() { + super(); + + initialise(); + } + + @Override + public void setDeviceConfig(DeviceConfig pDeviceConfig) { + super.setDeviceConfig(pDeviceConfig); + + mOutputCombo.setSelectedItem(mDeviceConfig.mOutput); + ((SpinnerNumberModel)mBaudrateSpinner.getModel()).setValue(mDeviceConfig.mBaudrate); + } + + private void initialise() { + mOutputLabel = new JLabel("Output: "); + mOutputLabel.setMinimumSize(firstColMinDim); + add(mOutputLabel); + + mOutputCombo = new JComboBox<>(KnownOutputs); + mOutputCombo.setMaximumSize(maxDim); + mOutputCombo.setEditable(true); + mOutputCombo.addActionListener(mActionListener); + add(mOutputCombo); + + mBaudrateLabel = new JLabel("Baudrate: "); + mBaudrateLabel.setMinimumSize(firstColMinDim); + add(mBaudrateLabel); + + mBaudrateSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 1000000, 128)); + mBaudrateSpinner .setMaximumSize(maxDim); + mBaudrateSpinner.addChangeListener(mChangeListener); + add(mBaudrateSpinner); + + + GroupLayout layout = new GroupLayout(this); + layout.setAutoCreateGaps(true); + setLayout(layout); + + layout.setHorizontalGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup() + .addComponent(mOutputLabel) + .addComponent(mBaudrateLabel)) + .addGroup(layout.createParallelGroup() + .addComponent(mOutputCombo) + .addComponent(mBaudrateSpinner)) + ); + layout.setVerticalGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup() + .addComponent(mOutputLabel) + .addComponent(mOutputCombo)) + .addGroup(layout.createParallelGroup() + .addComponent(mBaudrateLabel) + .addComponent(mBaudrateSpinner)) + ); + } + + private ActionListener mActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (e.getSource() == mOutputCombo) { + mDeviceConfig.mOutput = (String)mOutputCombo.getSelectedItem(); + } else if (e.getSource() == mBaudrateSpinner) { + mDeviceConfig.mBaudrate = (Integer)mBaudrateSpinner.getValue(); + } + } + }; + + private ChangeListener mChangeListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + mDeviceConfig.mBaudrate = (Integer)mBaudrateSpinner.getValue(); + } + }; +} diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/TestDevicePanel.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/TestDevicePanel.java new file mode 100644 index 00000000..edf2487e --- /dev/null +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/TestDevicePanel.java @@ -0,0 +1,63 @@ +package org.hyperion.hypercon.gui.device; + +import javax.swing.GroupLayout; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; + +import org.hyperion.hypercon.spec.DeviceConfig; + +public class TestDevicePanel extends DeviceTypePanel { + + private JLabel mFilenameLabel; + private JTextField mFilenameField; + + public TestDevicePanel() { + super(); + + initialise(); + } + + @Override + public void setDeviceConfig(DeviceConfig pDeviceConfig) { + super.setDeviceConfig(pDeviceConfig); + + mFilenameField.setText(mDeviceConfig.mOutput); + } + + private void initialise() { + mFilenameLabel = new JLabel("Filename: "); + mFilenameLabel.setMinimumSize(firstColMinDim); + add(mFilenameLabel); + + mFilenameField = new JTextField(); + mFilenameField.setMaximumSize(maxDim); + mFilenameField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + mDeviceConfig.mOutput = mFilenameField.getText(); + } + @Override + public void insertUpdate(DocumentEvent e) { + mDeviceConfig.mOutput = mFilenameField.getText(); + } + @Override + public void changedUpdate(DocumentEvent e) { + mDeviceConfig.mOutput = mFilenameField.getText(); + } + }); + add(mFilenameField); + + GroupLayout layout = new GroupLayout(this); + setLayout(layout); + + layout.setHorizontalGroup(layout.createSequentialGroup() + .addComponent(mFilenameLabel) + .addComponent(mFilenameField)); + layout.setVerticalGroup(layout.createParallelGroup() + .addComponent(mFilenameLabel) + .addComponent(mFilenameField)); + } + +} diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/Ws2801Panel.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/Ws2801Panel.java new file mode 100644 index 00000000..ffea3a46 --- /dev/null +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/device/Ws2801Panel.java @@ -0,0 +1,104 @@ +package org.hyperion.hypercon.gui.device; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.GroupLayout; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import org.hyperion.hypercon.spec.DeviceConfig; + +/** + * Panel for configuring Ws2801 specific settings + */ +public class Ws2801Panel extends DeviceTypePanel { + + public static final String[] KnownOutputs = {"/dev/spidev0.0", "/dev/spidev0.1", "/dev/null"}; + + private JLabel mOutputLabel; + private JComboBox mOutputCombo; + + private JLabel mBaudrateLabel; + private JSpinner mBaudrateSpinner; + + + public Ws2801Panel() { + super(); + + initialise(); + } + + @Override + public void setDeviceConfig(DeviceConfig pDeviceConfig) { + super.setDeviceConfig(pDeviceConfig); + + mOutputCombo.setSelectedItem(mDeviceConfig.mOutput); + ((SpinnerNumberModel)mBaudrateSpinner.getModel()).setValue(mDeviceConfig.mBaudrate); + } + + private void initialise() { + mOutputLabel = new JLabel("Output: "); + mOutputLabel.setMinimumSize(firstColMinDim); + add(mOutputLabel); + + mOutputCombo = new JComboBox<>(KnownOutputs); + mOutputCombo.setMaximumSize(maxDim); + mOutputCombo.setEditable(true); + mOutputCombo.addActionListener(mActionListener); + add(mOutputCombo); + + mBaudrateLabel = new JLabel("Baudrate: "); + mBaudrateLabel.setMinimumSize(firstColMinDim); + add(mBaudrateLabel); + + mBaudrateSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 1000000, 128)); + mBaudrateSpinner.setMaximumSize(maxDim); + mBaudrateSpinner.addChangeListener(mChangeListener); + add(mBaudrateSpinner); + + + GroupLayout layout = new GroupLayout(this); + layout.setAutoCreateGaps(true); + setLayout(layout); + + layout.setHorizontalGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup() + .addComponent(mOutputLabel) + .addComponent(mBaudrateLabel)) + .addGroup(layout.createParallelGroup() + .addComponent(mOutputCombo) + .addComponent(mBaudrateSpinner)) + ); + layout.setVerticalGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup() + .addComponent(mOutputLabel) + .addComponent(mOutputCombo)) + .addGroup(layout.createParallelGroup() + .addComponent(mBaudrateLabel) + .addComponent(mBaudrateSpinner)) + ); + } + + private ActionListener mActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (e.getSource() == mOutputCombo) { + mDeviceConfig.mOutput = (String)mOutputCombo.getSelectedItem(); + } else if (e.getSource() == mBaudrateSpinner) { + mDeviceConfig.mBaudrate = (Integer)mBaudrateSpinner.getValue(); + } + } + }; + + private ChangeListener mChangeListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + mDeviceConfig.mBaudrate = (Integer)mBaudrateSpinner.getValue(); + } + }; +} diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/ColorConfig.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/ColorConfig.java index 824c3f1d..e55a76cf 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/ColorConfig.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/ColorConfig.java @@ -47,8 +47,8 @@ public class ColorConfig { strBuf.append("\t/// - 'gamma' The gamma-curve correction factor\n"); strBuf.append("\t/// - 'blacklevel' The lowest possible value (when the channel is black)\n"); strBuf.append("\t/// - 'whitelevel' The highest possible value (when the channel is white)\n"); - strBuf.append("\t///"); - strBuf.append("\t/// Next to the list with color transforms there is also a smoothing option."); + strBuf.append("\t///\n"); + strBuf.append("\t/// Next to the list with color transforms there is also a smoothing option.\n"); strBuf.append("\t/// * 'smoothing' : Smoothing of the colors in the time-domain with the following tuning \n"); strBuf.append("\t/// parameters:\n"); strBuf.append("\t/// - 'type' The type of smoothing algorithm ('linear' or 'none')\n"); diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/DeviceConfig.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/DeviceConfig.java index 7be938f7..ec07096b 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/DeviceConfig.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/DeviceConfig.java @@ -12,7 +12,7 @@ public class DeviceConfig { /** The device 'file' name */ public String mOutput = "/dev/spidev0.0"; /** The baudrate of the device */ - public int mBaudrate = 1000000; + public int mBaudrate = 250000; /** The order of the color bytes */ public ColorByteOrder mColorByteOrder = ColorByteOrder.RGB; diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectConfig.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectConfig.java deleted file mode 100644 index 3d348525..00000000 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectConfig.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.hyperion.hypercon.spec; - -import java.util.Vector; - -import org.hyperion.hypercon.JsonStringBuffer; - -/** - * The configuration structure for a single 'effect'. - */ -public class EffectConfig { - - /** The identifier of the effect */ - public String mId; - - /** The python-script used to generate the effect */ - public String mScript; - - /** The arguments (key-value) of the python-script */ - public final Vector mArgs = new Vector<>(); - - /** - * The effect argument contains a key-value combination that holds a single argument of an - * effect - */ - static public class EffectArg { - /** The key of the effect argument */ - public String key; - /** The value of the effect argument */ - public Object value; - - /** - * Constructs an new effect argument with empty key and value - */ - public EffectArg() { - this("", ""); - } - - /** - * Constructs an effect argument with the given key and value - * - * @param pKey The key of the new argument - * @param pValue The value of the new argument - */ - public EffectArg(String pKey, Object pValue) { - key = pKey; - value = pValue; - } - } - - public void append(JsonStringBuffer pJsonBuf, boolean endOfEffects) { - pJsonBuf.startObject(mId); - pJsonBuf.addValue("script", mScript, false); - - //pJsonBuf.addRawValue("args", String.format(Locale.ENGLISH, "{\n%s\n}", mArgs), true); - - pJsonBuf.stopObject(endOfEffects); - } - - @Override - public String toString() { - return mId; - } - - @Override - public EffectConfig clone() { - EffectConfig thisClone = new EffectConfig(); - thisClone.mId = mId; - thisClone.mScript = mScript; - - for (EffectArg arg : mArgs) { - thisClone.mArgs.add(new EffectArg(arg.key, arg.value)); - } - - return thisClone; - } -} diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java index 86ec65f5..21e5971e 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java @@ -13,7 +13,7 @@ public class MiscConfig { /** Flag indicating that the boot sequence is enabled(true) or not(false) */ public boolean mBootSequenceEnabled = true; /** The effect selected for the boot sequence */ - public String mBootSequenceEffect = "Rainbow Swirl (fast)"; + public String mBootSequenceEffect = "Rainbow swirl fast"; /** Flag indicating that the Frame Grabber is enabled */ public boolean mFrameGrabberEnabled = true; @@ -68,7 +68,7 @@ public class MiscConfig { for (String effectPath : effectPaths) { strBuf.addArrayElement(effectPath, effectPath == effectPaths[effectPaths.length-1]); } - strBuf.stopArray(); + strBuf.stopArray(!mBootSequenceEnabled); strBuf.toggleComment(!mBootSequenceEnabled); strBuf.addValue("bootsequence", mBootSequenceEffect, true); strBuf.toggleComment(false);