Q1: In the VideoDisplay sketch found on the Arduino OctoWS2811 Examples menu, when the Teensy receives a frame of data, it puts it into the “drawingMemory” then shows the LEDs. How is that supposed to work? When does the data just sent get pushed onto the LEDs?
I am running one Teensy / octo and one data wire, btw so the frame sync stuff isn’t getting used.
From VideoDisplay sketch:
if (startChar == '*') {
// receive a "master" frame - we send the frame sync to other boards
// the sender is controlling the video pace. The 16 bit number is
// how far into this frame to send the sync to other boards.
unsigned int startAt = micros();
unsigned int usecUntilFrameSync = 0;
int count = Serial.readBytes((char *)&usecUntilFrameSync, 2);
if (count != 2) return;
count = Serial.readBytes((char *)drawingMemory, sizeof(drawingMemory));
if (count == sizeof(drawingMemory)) { //<<<< So we have the image date from Processing sketch
// image data is in the "drawingMemory" buffer
unsigned int endAt = micros();
unsigned int usToWaitBeforeSyncOutput = 100;
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(); // <<<<< "Showing" the LEDs here doesn't seem to do anything!!
digitalWrite(13, LOW);
}
Q2: Is there more detailed documentation on these "drawing operations" and the reason for setting aside memory here? If this is being used by the OctoWS2811 LED library, why are we using it for an I/O buffer?
Quoting from the brief documentation on https://www.pjrc.com/teensy/td_libs_OctoWS2811.html, "drawingMemory: The memory used for drawing operations. Use either an array of "int" 6 times ledsPerStrip, or NULL to perform all drawing directly to the display memory. "
Thanks Paul!
I am running one Teensy / octo and one data wire, btw so the frame sync stuff isn’t getting used.
From VideoDisplay sketch:
if (startChar == '*') {
// receive a "master" frame - we send the frame sync to other boards
// the sender is controlling the video pace. The 16 bit number is
// how far into this frame to send the sync to other boards.
unsigned int startAt = micros();
unsigned int usecUntilFrameSync = 0;
int count = Serial.readBytes((char *)&usecUntilFrameSync, 2);
if (count != 2) return;
count = Serial.readBytes((char *)drawingMemory, sizeof(drawingMemory));
if (count == sizeof(drawingMemory)) { //<<<< So we have the image date from Processing sketch
// image data is in the "drawingMemory" buffer
unsigned int endAt = micros();
unsigned int usToWaitBeforeSyncOutput = 100;
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(); // <<<<< "Showing" the LEDs here doesn't seem to do anything!!
digitalWrite(13, LOW);
}
Q2: Is there more detailed documentation on these "drawing operations" and the reason for setting aside memory here? If this is being used by the OctoWS2811 LED library, why are we using it for an I/O buffer?
Quoting from the brief documentation on https://www.pjrc.com/teensy/td_libs_OctoWS2811.html, "drawingMemory: The memory used for drawing operations. Use either an array of "int" 6 times ledsPerStrip, or NULL to perform all drawing directly to the display memory. "
Thanks Paul!