From 6a977de482d942e29e5b6e8bb18238569d266461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Tue, 6 Mar 2012 01:31:38 +0100 Subject: [PATCH] Bugfixing und erste Unit Tests erstellt. --- pom.xml | 5 +++++ src/main/java/de/ctdo/bunti/dmx/DMX.java | 4 ++-- src/main/java/de/ctdo/bunti/model/BuntiDMXDevice.java | 4 ++-- src/main/java/de/ctdo/bunti/model/Par56Spot.java | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 6b69e31..088665d 100644 --- a/pom.xml +++ b/pom.xml @@ -69,6 +69,11 @@ spring-webmvc ${org.springframework.version} + + junit + junit + 4.10 + diff --git a/src/main/java/de/ctdo/bunti/dmx/DMX.java b/src/main/java/de/ctdo/bunti/dmx/DMX.java index 72b795a..5f72185 100644 --- a/src/main/java/de/ctdo/bunti/dmx/DMX.java +++ b/src/main/java/de/ctdo/bunti/dmx/DMX.java @@ -2,9 +2,9 @@ package de.ctdo.bunti.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_CHANNEL_VALUE_MAX = (byte) 255; + public static final int DMX_CHANNEL_VALUE_MAX = 255; public static final int DMX_CHANNEL_VALUE_MIN = 0; /** diff --git a/src/main/java/de/ctdo/bunti/model/BuntiDMXDevice.java b/src/main/java/de/ctdo/bunti/model/BuntiDMXDevice.java index b5ddaed..12359f1 100644 --- a/src/main/java/de/ctdo/bunti/model/BuntiDMXDevice.java +++ b/src/main/java/de/ctdo/bunti/model/BuntiDMXDevice.java @@ -111,7 +111,7 @@ public abstract class BuntiDMXDevice extends BuntiDevice { Map map = new HashMap(); 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){ map.put(index, channel.getValue()); @@ -130,7 +130,7 @@ public abstract class BuntiDMXDevice extends BuntiDevice { if(channel != null) { try { - byte value = Byte.parseByte(opt.getValue().toString()); + int value = Integer.parseInt(opt.getValue().toString()); setChannelValueByName(channel.getName(), value); diff --git a/src/main/java/de/ctdo/bunti/model/Par56Spot.java b/src/main/java/de/ctdo/bunti/model/Par56Spot.java index 784757e..c5162b9 100644 --- a/src/main/java/de/ctdo/bunti/model/Par56Spot.java +++ b/src/main/java/de/ctdo/bunti/model/Par56Spot.java @@ -16,7 +16,7 @@ public class Par56Spot extends BuntiDMXDevice { 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(3, CHANNEL_BLUE)); addChannel(new DMXChannel(4, CHANNEL_SPEED));