-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
534 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
public static final class ColorConverterClass | ||
{ | ||
|
||
public static int intColorLookupTable(int colorToConvert) | ||
{ | ||
|
||
System.out.println("intColorLookupTable method called with parameter " + colorToConvert); | ||
//-6908266 = red; | ||
|
||
//grey = 0 | ||
if ( colorToConvert == -6908266) | ||
{ | ||
System.out.println("recieved -6908266 or off"); | ||
return 0; | ||
} | ||
//red = 1 | ||
else if (colorToConvert == -65536) | ||
{ | ||
System.out.println("recieved -65536 or red"); | ||
return 1; | ||
} | ||
//green = 2 | ||
else if (colorToConvert == -16711936) | ||
{ | ||
return 2; | ||
} | ||
//blue = 3 | ||
else if (colorToConvert == -16776961) | ||
{ | ||
return 3; | ||
} | ||
//white = 4 | ||
else if (colorToConvert == -1) | ||
{ | ||
System.out.println("returning 4"); | ||
return 4; | ||
} | ||
//yellow = 5 | ||
else if (colorToConvert == -256) | ||
{ | ||
return 5; | ||
} | ||
//purple | ||
else if (colorToConvert == -65281) | ||
{ | ||
return 6; | ||
} | ||
else | ||
{ | ||
System.out.println(""); | ||
System.out.println("Color " + colorToConvert + " is not in lookup table"); | ||
return 0; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
public static class LedAbsoluteToConverterClass | ||
{ | ||
|
||
// static int xNumberOfLedsPerRow = 16; | ||
// static int yNumberOfRowsPerPanel = 16; | ||
// static int zNumberOfPanelsPerCube = 16; | ||
private LedAbsoluteToConverterClass(){} | ||
|
||
|
||
static int getLedNumberInRow(int absoluteLedNumber) | ||
{ | ||
int ledTotalRowNumber = (absoluteLedNumber / PresentationTest.xNumberOfLedsPerRow); // 48 would return 3rd row TODO:Consider renaming locationInY | ||
int ledPanelNumber = (absoluteLedNumber / PresentationTest.xNumberOfLedsPerRow / PresentationTest.yNumberOfRowsPerPanel); //4095 would return panel 15, 300 returns panel 1 TODO:Consider renaming to locationINZ | ||
int ledVerticalRowNumber = (ledTotalRowNumber - (PresentationTest.yNumberOfRowsPerPanel * ledPanelNumber)); //we need to know how high from the ground, not how many rows there are total | ||
int firstLedInRow = ((1 + ledVerticalRowNumber + ledPanelNumber * PresentationTest.zNumberOfPanelsPerCube ) * PresentationTest.yNumberOfRowsPerPanel - PresentationTest.xNumberOfLedsPerRow); | ||
return (absoluteLedNumber - firstLedInRow); | ||
} | ||
|
||
static int getLedRowNumberInPanel( int absoluteLedNumber ) | ||
{ | ||
|
||
int ledTotalRowNumber = (absoluteLedNumber / xNumberOfLedsPerRow); | ||
int ledPanelNumber = (absoluteLedNumber / xNumberOfLedsPerRow / yNumberOfRowsPerPanel); //4095 would return panel 15, 300 returns panel 1 TODO:Consider renaming to locationINZ | ||
int ledVerticalRowNumber = (ledTotalRowNumber - (yNumberOfRowsPerPanel * ledPanelNumber)); //we need to know how high from the ground, not how many rows there are total | ||
|
||
System.out.println("getLedNumberInRow was given " + absoluteLedNumber + " and is returning " + ledVerticalRowNumber); | ||
return ledVerticalRowNumber; | ||
|
||
} | ||
|
||
static int getPanelThatContainsLed ( int absoluteLedNumber ) | ||
{ | ||
int ledTotalRowNumber = (absoluteLedNumber / xNumberOfLedsPerRow); | ||
int ledPanelNumber = (absoluteLedNumber / xNumberOfLedsPerRow / yNumberOfRowsPerPanel); //4095 would return panel 15, 300 returns panel 1 TODO:Consider renaming to locationINZ | ||
System.out.println("getPanelThatContainsLed was given " + absoluteLedNumber + " and is returning " + ledPanelNumber); | ||
|
||
return ledPanelNumber; | ||
} | ||
|
||
|
||
}//end class ConverterClass |
Oops, something went wrong.