diff --git a/v2/backend/arduino/TODO b/v2/backend/arduino/TODO index e380574..79b6a12 100644 --- a/v2/backend/arduino/TODO +++ b/v2/backend/arduino/TODO @@ -1,5 +1,2 @@ -* More cleanup: the only required is the nb of leds/strip, not H/W -* Process as fast as possible (no frame sync required) * Get the OctoWS2811 out, try to go upstream * There will be 2 Serial ports used, the startChar will not be used anymore (Serial1 will *only* get LED data) -* remove commented/debug code diff --git a/v2/backend/arduino/VideoDisplayTeensy31/VideoDisplayTeensy31.ino b/v2/backend/arduino/VideoDisplayTeensy31/VideoDisplayTeensy31.ino index 89dec5b..feefec5 100644 --- a/v2/backend/arduino/VideoDisplayTeensy31/VideoDisplayTeensy31.ino +++ b/v2/backend/arduino/VideoDisplayTeensy31/VideoDisplayTeensy31.ino @@ -60,8 +60,6 @@ #include "OctoWS2811.h" -int height = 0; -int width = 0; int ledsPerStrip = 0; int count = 0; @@ -77,15 +75,10 @@ void setup() { pinMode(13, OUTPUT); digitalWrite(13, HIGH); Serial.setTimeout(5000); - //delay(1000); - Serial.readBytes((char *)&height, sizeof(height)); - Serial.write((char *)&height, sizeof(height)); - Serial.readBytes((char *)&width, sizeof(width)); - Serial.write((char *)&width, sizeof(width)); + Serial.readBytes((char *)&ledsPerStrip, sizeof(ledsPerStrip)); + Serial.write((char *)&ledsPerStrip, sizeof(ledsPerStrip)); digitalWrite(13, LOW); - //pinMode(12, INPUT_PULLUP); // Frame Sync Serial.setTimeout(50); - ledsPerStrip = width * height; displayMemory = new int[ledsPerStrip*6]; drawingMemory = new int[ledsPerStrip*6]; leds.attach(ledsPerStrip, displayMemory, drawingMemory, config); @@ -100,28 +93,12 @@ void loop() { unsigned int startAt = micros(); unsigned int usecUntilFrameSync = 0; count = Serial.readBytes((char *)drawingMemory, sizeof(int) * ledsPerStrip*6); - //Serial.write((char *)drawingMemory, sizeof(int) * ledsPerStrip*6); if (count >= sizeof(int) * ledsPerStrip*6) { - unsigned int endAt = micros(); - unsigned int usToWaitBeforeSyncOutput = 1000; - if (endAt - startAt < usecUntilFrameSync) { - usToWaitBeforeSyncOutput = usecUntilFrameSync - (endAt - startAt); - } - //digitalWrite(12, HIGH); - //pinMode(12, OUTPUT); - delayMicroseconds(usToWaitBeforeSyncOutput); - //digitalWrite(12, LOW); - // WS2811 update begins immediately after falling edge of frame sync digitalWrite(13, HIGH); leds.show(); digitalWrite(13, LOW); } } else if (startChar >= 0) { - //Serial.write(startChar); - //Serial.flush() - //digitalWrite(13, HIGH); - //delay(100); - //digitalWrite(13, LOW); // discard unknown characters } } diff --git a/v2/backend/forwarding/TODO b/v2/backend/forwarding/TODO index e25f827..62146e6 100644 --- a/v2/backend/forwarding/TODO +++ b/v2/backend/forwarding/TODO @@ -3,7 +3,6 @@ Forwarder * Control framerate in send function * Define a max framerate and announce it in the config (redis) -* Only send the LED/strip value to the adruino code * Remove commented code Receiver diff --git a/v2/backend/forwarding/forward.py b/v2/backend/forwarding/forward.py index 73caa2f..294e678 100644 --- a/v2/backend/forwarding/forward.py +++ b/v2/backend/forwarding/forward.py @@ -38,12 +38,10 @@ def serialConfigure(port_name, baudrate=9600): sys.stderr.write("Could not open serial port %s: %s\n" % (ser.portstr, e)) return - print(height, width) - ser.write(height.to_bytes(4, byteorder='little')) - data = ser.read(4) - print(data, int.from_bytes(data, byteorder='little')) + ledsPerStrip = height * width + print(ledsPerStrip) + ser.write(ledsPerStrip.to_bytes(4, byteorder='little')) - ser.write(width.to_bytes(4, byteorder='little')) data = ser.read(4) print(data, int.from_bytes(data, byteorder='little'))