From aadcaadeb4106f40583b9e94fb299d23c97f7089 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 15 Sep 2011 15:04:39 +0100 Subject: More docs and the start of a readme. --- .../src/uk/ac/open/punchingbag/PunchingBag.java | 135 +++++++++++++++++++-- README | 6 + 2 files changed, 128 insertions(+), 13 deletions(-) create mode 100644 README diff --git a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java index b597cbc..70da436 100644 --- a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java +++ b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java @@ -25,6 +25,86 @@ import java.util.Iterator; * @author Christopher Baines * @author Adam Martindale */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ public class PunchingBag implements Runnable { /** * Used by the run method to decide if to call the LEDListeners @@ -202,12 +282,15 @@ public class PunchingBag implements Runnable { } /** - * Used by methods in the PunchingBag class to change the led's array. To simplify things it will accept any Color object, - * but if it's not one of the supported (red,green,yellow), then it will just set it to white (the none colour). + * Used by methods in the PunchingBag class to change the led's array. To simplify things it will accept any Color + * object, but if it's not one of the supported (red,green,yellow), then it will just set it to white (the none colour). * - * @param x The x coordinate of the led - * @param y The y coordinate of the led - * @param colour The desired colour of the led, as either Color.red, Color.yellow, Color.green or Color,white. + * @param x + * The x coordinate of the led + * @param y + * The y coordinate of the led + * @param colour + * The desired colour of the led, as either Color.red, Color.yellow, Color.green or Color,white. * @return true if something was changed, false if not */ private boolean setLEDInternal(int x, int y, Color colour) { @@ -232,7 +315,8 @@ public class PunchingBag implements Runnable { } /** - * Sets a LED on the grid to the specified colour, either use + * Sets a LED on the grid to the specified colour, either use this command again to change it, or use the + * clearLEDS() function to clear the entire grid. * * @param x * @param y @@ -242,14 +326,39 @@ public class PunchingBag implements Runnable { runningEffects.add(new Point(x, y, colour)); } + /** + * Starts an expanding circle at x and y. + * + * @param x The x coordinate of the centre of the circle. + * @param y The y coordinate of the centre of the circle. + * @param intensity This controls the intensity of the circle, including colour and (but not yet) weight. + */ public void circleExpand(int x, int y, int intensity) { runningEffects.add(new CircleExpand(x, y, 100)); } + /** + * This controls the intensity of the circle, including colour and (but not yet) weight. + * + * @param x The x coordinate of the centre of the square + * @param y The y coordinate of the centre of the square + * @param intensity AFAIK, this does nothing yet + * @param colour The colour of the square + */ public void squareExpand(int x, int y, int intensity, Color colour) { runningEffects.add(new SquareExpand(x, y, intensity, colour)); } - + + /** + * This should fill in a rectangle + * + * @param x The x coordinate of the top right of the rectangle + * @param y The y coordinate of the top right of the + * @param width + * @param height + * @param colour + * @param time + */ public void fillRect(int x, int y, int width, int height, Color colour, long time) { runningEffects.add(new FillRect(x, y, width, height, colour, time)); } @@ -894,13 +1003,13 @@ public class PunchingBag implements Runnable { System.out.println("Button: " + (System.currentTimeMillis() - beginTimeButtonIn)); calculateRawLeds(); - //String str; - //for (int i = 0; i < (6 * 8); i++) { - // printByte(rawLeds[i]); - //} - //System.out.println(""); + // String str; + // 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(); diff --git a/README b/README new file mode 100644 index 0000000..44c28b2 --- /dev/null +++ b/README @@ -0,0 +1,6 @@ +TODO: + +Finish writing javadocs in all the api classes. +Improve the serial with the LED arduino, allow the intensity data to be transmited. +Complete the calculateRawLeds function, adding the wierd column. +Allow the program to decide which COM port is which. -- cgit v1.2.3