repositories
/
SugarCubes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean up some stuff now that we know each pandaboard has fixed # of channels
[SugarCubes.git]
/
TestPatterns.pde
diff --git
a/TestPatterns.pde
b/TestPatterns.pde
index c4432ab0baa1d7cc976b5fcddecfcb43cce67529..733494541ec28d1c5e6fce48ea7612007c2b1530 100644
(file)
--- a/
TestPatterns.pde
+++ b/
TestPatterns.pde
@@
-136,8
+136,7
@@
class TestProjectionPattern extends SCPattern {
class TestCubePattern extends SCPattern {
class TestCubePattern extends SCPattern {
- private int POINTS_PER_CUBE = Cube.FACES_PER_CUBE * Face.STRIPS_PER_FACE * Strip.POINTS_PER_STRIP;
- private SawLFO index = new SawLFO(0, POINTS_PER_CUBE, POINTS_PER_CUBE*60);
+ private SawLFO index = new SawLFO(0, Cube.POINTS_PER_CUBE, Cube.POINTS_PER_CUBE*60);
TestCubePattern(GLucose glucose) {
super(glucose);
TestCubePattern(GLucose glucose) {
super(glucose);
@@
-179,30
+178,27
@@
class MappingTool extends SCPattern {
public boolean channelModeGreen = false;
public boolean channelModeBlue = false;
public boolean channelModeGreen = false;
public boolean channelModeBlue = false;
- private final
static int NUM_CHANNELS = 16
;
+ private final
int numChannels
;
- private final
int[][] frontChannel
s;
- private
final int[][] rearChannels
;
- private int
[] activeChannels
;
+ private final
PandaMapping[] pandaMapping
s;
+ private
PandaMapping activeMapping
;
+ private int
mappingChannelIndex
;
- MappingTool(GLucose glucose,
int[][]frontChannels, int[][]rearChannel
s) {
+ MappingTool(GLucose glucose,
PandaMapping[] pandaMapping
s) {
super(glucose);
super(glucose);
- this.
frontChannels = frontChannel
s;
-
this.rearChannels = rearChannels
;
+ this.
pandaMappings = pandaMapping
s;
+
numChannels = pandaMappings.length * PandaMapping.CHANNELS_PER_BOARD
;
setChannel();
}
private void setChannel() {
setChannel();
}
private void setChannel() {
- if (channelIndex < frontChannels.length) {
- activeChannels = frontChannels[channelIndex];
- } else {
- activeChannels = rearChannels[channelIndex - frontChannels.length];
- }
+ mappingChannelIndex = channelIndex % PandaMapping.CHANNELS_PER_BOARD;
+ activeMapping = pandaMappings[channelIndex / PandaMapping.CHANNELS_PER_BOARD];
}
private int cubeInChannel(Cube c) {
int i = 1;
}
private int cubeInChannel(Cube c) {
int i = 1;
- for (int index : active
Channels
) {
+ for (int index : active
Mapping.channelList[mappingChannelIndex]
) {
if (c == model.getCubeByRawIndex(index)) {
return i;
}
if (c == model.getCubeByRawIndex(index)) {
return i;
}
@@
-222,7
+218,7
@@
class MappingTool extends SCPattern {
}
public void strip(int delta) {
}
public void strip(int delta) {
- int len = Cube.
FACES_PER_CUBE * Face.STRIPS_PER_FAC
E;
+ int len = Cube.
STRIPS_PER_CUB
E;
stripIndex = (len + stripIndex + delta) % len;
printInfo();
}
stripIndex = (len + stripIndex + delta) % len;
printInfo();
}
@@
-300,14
+296,14
@@
class MappingTool extends SCPattern {
}
public void incChannel() {
}
public void incChannel() {
- channelIndex = (channelIndex + 1) %
NUM_CHANNELS
;
+ channelIndex = (channelIndex + 1) %
numChannels
;
setChannel();
}
public void decChannel() {
--channelIndex;
if (channelIndex < 0) {
setChannel();
}
public void decChannel() {
--channelIndex;
if (channelIndex < 0) {
- channelIndex +=
NUM_CHANNELS
;
+ channelIndex +=
numChannels
;
}
setChannel();
}
}
setChannel();
}