From 3063cae2f07f1d87878f4d4171a2af9f99501ade Mon Sep 17 00:00:00 2001 From: Justin Day Date: Sat, 19 May 2012 13:05:12 -0400 Subject: [PATCH] Remerged in proper Dacwes handling. Changed addressing mode to ADDRESSING_HORIZONTAL_NORMAL. --- CrawlTest.pde | 6 ++++-- Dacwes.pde | 32 +++++++++++++++++++++++++++++++- domeTransmitter.pde | 2 +- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/CrawlTest.pde b/CrawlTest.pde index 3059d3e..e59c123 100644 --- a/CrawlTest.pde +++ b/CrawlTest.pde @@ -9,8 +9,10 @@ class CrawlTest extends Routine { void draw() { background(0); - - x++; + + if (frameCount % 4 == 0) { + x++; + } if (x>width) { x=0; y++; diff --git a/Dacwes.pde b/Dacwes.pde index dcf9572..2f4588d 100644 --- a/Dacwes.pde +++ b/Dacwes.pde @@ -81,10 +81,40 @@ public class Dacwes { private int getAddress(int x, int y) { 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); } + 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; - } + } public void sendMode(String modeName) { byte modeBuffer[] = new byte[modeName.length()+1]; diff --git a/domeTransmitter.pde b/domeTransmitter.pde index 2f557df..0b53ed8 100644 --- a/domeTransmitter.pde +++ b/domeTransmitter.pde @@ -57,7 +57,7 @@ void setup() { dacwes = new Dacwes(this, WIDTH, HEIGHT); dacwes.setAddress(hostname); - dacwes.setAddressingMode(Dacwes.ADDRESSING_VERTICAL_NORMAL); + dacwes.setAddressingMode(Dacwes.ADDRESSING_HORIZONTAL_NORMAL); setMode(0);