mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Fixed listening for device setup changes
Former-commit-id: c1580486bb123fe6c457610225ca46f3063b94c4
This commit is contained in:
parent
e5395951a5
commit
8d8c4bdfad
@ -1 +1 @@
|
||||
6f2aab422e3d1b03080de92c3e3aea9b270a3e9b
|
||||
56543287f8f9c84993d0578339da66f81efe6bdb
|
@ -21,6 +21,7 @@ public class LedString {
|
||||
|
||||
/** THe configuration of the 'physical' led frame */
|
||||
public LedFrameConstruction mLedFrameConfig = new LedFrameConstruction();
|
||||
|
||||
/** The configuration of the image processing */
|
||||
public ImageProcessConfig mProcessConfig = new ImageProcessConfig();
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class ConfigPanel extends JPanel {
|
||||
mSpecificationPanel = new JPanel();
|
||||
mSpecificationPanel.setLayout(new BoxLayout(mSpecificationPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
mConstructionPanel = new LedFramePanel(ledString.mLedFrameConfig);
|
||||
mConstructionPanel = new LedFramePanel(ledString.mLedFrameConfig, ledString.mDeviceConfig);
|
||||
mConstructionPanel.setBorder(BorderFactory.createTitledBorder("Construction"));
|
||||
mSpecificationPanel.add(mConstructionPanel);
|
||||
|
||||
|
@ -12,12 +12,14 @@ import javax.swing.SpinnerNumberModel;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import org.hyperion.hypercon.spec.DeviceConfig;
|
||||
import org.hyperion.hypercon.spec.DeviceType;
|
||||
import org.hyperion.hypercon.spec.LedFrameConstruction;
|
||||
|
||||
public class LedFramePanel extends JPanel {
|
||||
|
||||
private final LedFrameConstruction mLedFrameSpec;
|
||||
private final DeviceConfig mDeviceConfig;
|
||||
|
||||
private JLabel mTypeLabel;
|
||||
private JComboBox<DeviceType> mTypeCombo;
|
||||
@ -41,10 +43,11 @@ public class LedFramePanel extends JPanel {
|
||||
private JLabel mOffsetLabel;
|
||||
private JSpinner mOffsetSpinner;
|
||||
|
||||
public LedFramePanel(LedFrameConstruction ledFrameSpec) {
|
||||
public LedFramePanel(LedFrameConstruction ledFrameSpec, DeviceConfig deviceConfig) {
|
||||
super();
|
||||
|
||||
mLedFrameSpec = ledFrameSpec;
|
||||
mDeviceConfig = deviceConfig;
|
||||
|
||||
initialise();
|
||||
}
|
||||
@ -151,6 +154,10 @@ public class LedFramePanel extends JPanel {
|
||||
}
|
||||
|
||||
void updateLedConstruction() {
|
||||
mDeviceConfig.mType = (DeviceType) mTypeCombo.getSelectedItem();
|
||||
mDeviceConfig.setChanged();
|
||||
mDeviceConfig.notifyObservers();
|
||||
|
||||
mLedFrameSpec.topLeftCorner = (Boolean)mTopCornerCombo.getSelectedItem();
|
||||
mLedFrameSpec.topRightCorner = (Boolean)mTopCornerCombo.getSelectedItem();
|
||||
mLedFrameSpec.bottomLeftCorner = (Boolean)mBottomCornerCombo.getSelectedItem();
|
||||
|
@ -1,20 +1,22 @@
|
||||
package org.hyperion.hypercon.spec;
|
||||
|
||||
import java.util.Observable;
|
||||
|
||||
/**
|
||||
* The device specific configuration
|
||||
*/
|
||||
public class DeviceConfig {
|
||||
public class DeviceConfig extends Observable {
|
||||
|
||||
/** The name of the device */
|
||||
String mName = "MyPi";
|
||||
public String mName = "MyPi";
|
||||
/** The type specification of the device */
|
||||
DeviceType mType = DeviceType.ws2801;
|
||||
public DeviceType mType = DeviceType.ws2801;
|
||||
/** The device 'file' name */
|
||||
String mOutput = "/dev/spidev0.0";
|
||||
public String mOutput = "/dev/spidev0.0";
|
||||
/** The baudrate of the device */
|
||||
int mBaudrate = 1000000;
|
||||
public int mBaudrate = 1000000;
|
||||
/** Flag indicating if the red and blue should be reversed */
|
||||
boolean mBgrOutput = false;
|
||||
public boolean mBgrOutput = false;
|
||||
|
||||
/**
|
||||
* Creates the JSON string of the configuration as used in the Hyperion daemon configfile
|
||||
@ -47,4 +49,8 @@ public class DeviceConfig {
|
||||
return strBuf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChanged() {
|
||||
super.setChanged();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user