Bugfixing und erste Unit Tests erstellt.

This commit is contained in:
Lucas Pleß 2012-03-06 01:31:38 +01:00
parent 2aeb088b6b
commit 6a977de482
4 changed files with 10 additions and 5 deletions

View File

@ -69,6 +69,11 @@
<artifactId>spring-webmvc</artifactId> <artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version> <version>${org.springframework.version}</version>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -2,9 +2,9 @@ package de.ctdo.bunti.dmx;
public final class DMX { public final class DMX {
public static final int DMX_CHANNELS_MAX = (byte) 511; public static final int DMX_CHANNELS_MAX = 511;
public static final int DMX_CHANNELS_MIN = 0; public static final int DMX_CHANNELS_MIN = 0;
public static final int DMX_CHANNEL_VALUE_MAX = (byte) 255; public static final int DMX_CHANNEL_VALUE_MAX = 255;
public static final int DMX_CHANNEL_VALUE_MIN = 0; public static final int DMX_CHANNEL_VALUE_MIN = 0;
/** /**

View File

@ -111,7 +111,7 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
Map<Integer,Integer> map = new HashMap<Integer, Integer>(); Map<Integer,Integer> map = new HashMap<Integer, Integer>();
for (DMXChannel channel : dmxChannels.getAllChannels()) { for (DMXChannel channel : dmxChannels.getAllChannels()) {
int index = channel.getOffset() + (startAddress - DMX.DMX_STARTADDRESS_OFFSET); int index = channel.getOffset() + startAddress + DMX.DMX_STARTADDRESS_OFFSET;
if(index >= DMX.DMX_CHANNELS_MIN && index <= DMX.DMX_CHANNELS_MAX){ if(index >= DMX.DMX_CHANNELS_MIN && index <= DMX.DMX_CHANNELS_MAX){
map.put(index, channel.getValue()); map.put(index, channel.getValue());
@ -130,7 +130,7 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
if(channel != null) { if(channel != null) {
try { try {
byte value = Byte.parseByte(opt.getValue().toString()); int value = Integer.parseInt(opt.getValue().toString());
setChannelValueByName(channel.getName(), value); setChannelValueByName(channel.getName(), value);

View File

@ -16,7 +16,7 @@ public class Par56Spot extends BuntiDMXDevice {
addChannel(new DMXChannel(0, CHANNEL_MODE)); addChannel(new DMXChannel(0, CHANNEL_MODE));
addChannel(new DMXChannel(1, "red")); addChannel(new DMXChannel(1, CHANNEL_RED));
addChannel(new DMXChannel(2, CHANNEL_GREEN)); addChannel(new DMXChannel(2, CHANNEL_GREEN));
addChannel(new DMXChannel(3, CHANNEL_BLUE)); addChannel(new DMXChannel(3, CHANNEL_BLUE));
addChannel(new DMXChannel(4, CHANNEL_SPEED)); addChannel(new DMXChannel(4, CHANNEL_SPEED));