Closed mic159 closed 5 years ago
@ladyada the show()
function only sends the SEESAW_NEOPIXEL_SHOW
command to the NeoTrellis/Seesaw, but the buffer on the NeoTrellis/Seesaw still has the original pixel data, so the LEDs stay lit up as they were.
Simple reproduce case:
#include "Adafruit_NeoTrellis.h"
Adafruit_NeoTrellis pad;
void setup() {
pad.begin();
}
void loop() {
pad.pixels.setPixelColor(0, 255, 0, 0);
pad.pixels.setPixelColor(15, 255, 0, 0);
pad.pixels.show();
delay(1000);
pad.pixels.clear();
pad.pixels.show();
delay(1000);
}
This should blink the pixels, but it just stays solid.
ooooooooooooooh - yeah thats a bug. sorry no fix at this time because the firmware is pre-burned :( you have to write to each pixel!
wanna try adding a
this->write(SEESAW_NEOPIXEL_BASE, SEESAW_NEOPIXEL_BUF, writeBuf, len + 2 );
type call after the memset in clear()? that should then send that data buffer off, may need adjustment for variable names n such - i dont have a seesaw on hand right now to test
@ladyada yes, it looks like we can use SEESAW_NEOPIXEL_BUF
a few times to clear the buffer on the remote end. Unfortunately the buffer is larger than the 32 byte maximum of TwoWire, so it has to be called in a loop.
Check #21
It only clears the local state, not the buffer on the seesaw.
The code only memsets the local buffer: https://github.com/adafruit/Adafruit_Seesaw/blob/ddd69568db4389ad735df1088d27507a48548d3e/seesaw_neopixel.cpp#L287
And there does not appear to be any command on the seesaw to actually clear it either: https://github.com/adafruit/seesaw/blob/ad471bd26fd5ddb4b320dafd0275e58e5f052714/include/event.h#L118
What is the best way to clear all pixels? Looping all pixels and calling
setPixelColor
seems inefficient. Can we useNEOPIXEL_SET_BUFFER_REQ
to set all pixels to 0 at once?