Skip to content

Commit

Permalink
Remerged in proper Dacwes handling.
Browse files Browse the repository at this point in the history
Changed addressing mode to ADDRESSING_HORIZONTAL_NORMAL.
  • Loading branch information
potatono committed May 19, 2012
1 parent 7ea74da commit 3063cae
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
6 changes: 4 additions & 2 deletions CrawlTest.pde
Expand Up @@ -9,8 +9,10 @@ class CrawlTest extends Routine {


void draw() { void draw() {
background(0); background(0);


x++; if (frameCount % 4 == 0) {
x++;
}
if (x>width) { if (x>width) {
x=0; x=0;
y++; y++;
Expand Down
32 changes: 31 additions & 1 deletion Dacwes.pde
Expand Up @@ -81,10 +81,40 @@ public class Dacwes {


private int getAddress(int x, int y) { private int getAddress(int x, int y) {
if (addressingMode == ADDRESSING_VERTICAL_NORMAL) { if (addressingMode == ADDRESSING_VERTICAL_NORMAL) {
return (x * h + y);
}
else if (addressingMode == ADDRESSING_VERTICAL_HALF) {
return ((y % pixelsPerChannel) + floor(y / pixelsPerChannel)*pixelsPerChannel*w + x*pixelsPerChannel);
}
else if (addressingMode == ADDRESSING_VERTICAL_FLIPFLOP) {
if (y>=pixelsPerChannel) {
int endAddress = (x+1) * h - 1;
int address = endAddress - (y % pixelsPerChannel);
return address;
}
else {
return (x * h + y);
}
}
else if (addressingMode == ADDRESSING_HORIZONTAL_NORMAL) {
return (y * w + x); return (y * w + x);
} }
else if (addressingMode == ADDRESSING_HORIZONTAL_HALF) {
return ((x % pixelsPerChannel) + floor(x / pixelsPerChannel)*pixelsPerChannel*h + y*pixelsPerChannel);
}
else if (addressingMode == ADDRESSING_HORIZONTAL_FLIPFLOP) {
if (x>=pixelsPerChannel) {
int endAddress = (y+1) * w - 1;
int address = endAddress - (x % pixelsPerChannel);
return address;
}
else {
return (y * h + x);
}
}

return 0; return 0;
} }


public void sendMode(String modeName) { public void sendMode(String modeName) {
byte modeBuffer[] = new byte[modeName.length()+1]; byte modeBuffer[] = new byte[modeName.length()+1];
Expand Down
2 changes: 1 addition & 1 deletion domeTransmitter.pde
Expand Up @@ -57,7 +57,7 @@ void setup() {


dacwes = new Dacwes(this, WIDTH, HEIGHT); dacwes = new Dacwes(this, WIDTH, HEIGHT);
dacwes.setAddress(hostname); dacwes.setAddress(hostname);
dacwes.setAddressingMode(Dacwes.ADDRESSING_VERTICAL_NORMAL); dacwes.setAddressingMode(Dacwes.ADDRESSING_HORIZONTAL_NORMAL);


setMode(0); setMode(0);


Expand Down

0 comments on commit 3063cae

Please sign in to comment.