nicoverduin:
That other library is of course also on the Arduino (or other board?)
Same board. It's just an LED library, FastSPI to be specific. It passes values to an LED array prior to updating the string. So for the POV system, I'm counting columns and rows and sending each column to the string. On an image that has 200 columns and 48 rows (permanent), I do:
MAX_COLS = 200;
for (int col = 0; col < MAX_COLS; cols ++) {
for (int px = 0; px < NUM_LEDS; px++) { // NUM_LEDS is also 48, which is why all images are capped at 48 rows high
// get r,g,b values from wherever they're coming
leds[px] = CRGB(r, g, b);
}
LEDS.show(); // update string
_delay_us(STRETCH); // this varies for each image
}
nicoverduin:
Well that will be a challenge in such:
- Reading 48 sets should not be a problem. If the file by itself is just a long stream of rgb sets with no CR or LF after each row but just a big blob. Based on the row and column definition, you know how many there will be.
The real issue would be that you would like to use a multi tasking concept. But these boards do not, to my knowledge, support that. So it will be processing either one or the other.
Yeah, I know, it's a bottle neck. This may end up being a futile attempt but I would like to at least figure it out and see what can or can't be done. Right now I'm storing all the images in PROGMEM, and depending on the size of the image (as far as color information) I can upwards of 10-30 images (lower numbers on an UNO, higher numbers on a 2560.) However, I'm also only storing 64 levels for each color, packed down into 0b0rrggbb0 and stored. I can read PROGMEM on the fly as the POV is working:
unsigned char cur = (uint32_t)(pgm_read_byte_near(&image1[i + j * NUM_LEDS]));
unsigned char r = cur & Rmask;
unsigned char g = (cur & Gmask) << 2;
unsigned char b = (cur & Bmask) << 4;
leds1[i] = CRGB(r, g, b);
The problem is, being a performer (and also having a small group of performers), if I need to update the images during a particularly long day of performances, I would have to lug around my laptop and re-program the board every time. So that's why I would like to convert it to an SD system where the program remains the same and won't require redoing every time, but I can swap out SD cards with new images. But it means having to read the card and pushing data out. Oh, and I also want to go to full color.
nicoverduin:
An alternative could be to use 2 Arduino's and create a form of parallel processing in which one arduino reads the SD card and puts it in a buffer. Once it has a minimum amount of rows in it, it starts pumping it (through SPI) to the other Arduino. Once that has received it's 48 sets, it can start processing. While that is going on, the first arduino starts reading the next data until the buffer is full (or earlier pending the time the library needs to process the data). When the library has finished its work it tells the first Arduino to send some more data.
I thought about this as well, but I don't know if this will be any faster. I still need to send data from one to the other and when push comes to shove, I don't know if it's any faster than reading an open stream from an SD card.