From f9c1cfa97d8783f776891a02d25494c11e92ab04 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 15 Sep 2011 10:53:55 +0100 Subject: More comments and a fix for the SetLedInternal method. --- .../src/uk/ac/open/punchingbag/PunchingBag.java | 32 +++++++--------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java index 265cbdc..d815ec3 100644 --- a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java +++ b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java @@ -23,19 +23,7 @@ import java.util.Iterator; * controlling the led's and reading the state of the accelerometers and buttons. * * @author Christopher Baines - * @author Adam Martindale - */ -/** - * @author cb24367 - * - */ -/** - * @author cb24367 - * - */ -/** - * @author cb24367 - * + * @author Adam Martindale */ public class PunchingBag implements Runnable { /** @@ -225,7 +213,7 @@ public class PunchingBag implements Runnable { private boolean setLEDInternal(int x, int y, Color colour) { if (x >= 0 && x < ledWidth && y >= 0 && y < ledHeight) { if (leds[x][y] != colour) { - if (colour != Color.red || colour != Color.green || colour != Color.yellow) { + if (!colour.equals(Color.red) && !colour.equals(Color.green) && !colour.equals(Color.yellow)) { if (leds[x][y] != Color.white) { leds[x][y] = Color.white; ledsChanged = true; @@ -251,7 +239,7 @@ public class PunchingBag implements Runnable { runningEffects.add(new CircleExpand(x, y, 100)); } - void squareExpand(int x, int y, int intensity, Color colour) { + public void squareExpand(int x, int y, int intensity, Color colour) { runningEffects.add(new SquareExpand(x, y, intensity, colour)); } @@ -259,11 +247,11 @@ public class PunchingBag implements Runnable { runningEffects.add(new FillRect(x, y, width, height, colour, time)); } - void rect(int x, int y, int width, int height, Color colour) { + public void rect(int x, int y, int width, int height, Color colour) { runningEffects.add(new Rect(x, y, width, height, colour)); } - void noise(Rectangle rect, long time) { + public void noise(Rectangle rect, long time) { runningEffects.add(new Noise(rect, System.currentTimeMillis() + time)); } @@ -900,12 +888,12 @@ public class PunchingBag implements Runnable { calculateRawLeds(); String str; - for (int i = 0; i < (6 * 8); i++) { - // printByte(rawLeds[i]); - } - // System.out.println(""); + //for (int i = 0; i < (6 * 8); i++) { + // printByte(rawLeds[i]); + //} + //System.out.println(""); - // Arrays.fill(rawLeds, (byte) -42); + //Arrays.fill(rawLeds, (byte) -42); long beginTimeLedOut = System.currentTimeMillis(); if (ledArduino.out != null) { // calculateRawLeds(); -- cgit v1.2.3