any way to use blur2d with the matrix library ?
it seams CledMatrix on the library is 16 bits and as blur is 8 bits, is almost totally incompatible …
any easy fix ? … tks
i will try , to make use of a buffer array, and transfer from one to the other ion order, with RenderMatrix() function to keep compatibility , will see…
it doesn’t work, because can’t use memmove() as both arrays are different structures … So most probably the easiest way is to change the matrix library functions
error during building process when i add the blur function .
tried to add it in different ways , but error persists.
last try was
blur2d((leds[0]), MATRIX_WIDTH, MATRIX_HEIGHT, 32);
where : leds is defined by
cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;
and : LEDS.addLeds<LED_TYPE, DATA_PIN, CLOCK_PIN, COLOR_ORDER>(leds[0], leds.Size()).setCorrection(TypicalSMD5050);;
colorutils.cpp.o: In function blurRows(CRGB*, unsigned char, unsigned char, unsigned char)
colorutils.cpp:404: undefined reference to XY(unsigned char, unsigned char)
any help appreciated…
ok , found the Error, and this is my learning to share :
a declaration of the XY() function is needed for it to work , and is very importan for this to match what fasted is expecting , uint16_t XY( uint8_t x, uint8_t y) . and this is only documented inside the library itself .
Since we’re all learning here might you share the section of code you “fixed” as I’ve wondered about this also. Thanks in advance.
my case was a problem on the XY() definition
it was defined as int8,
now it is
uint16_t XY(uint8_t x, uint8_t y) {
if (y > HEIGHT) {
y = HEIGHT;
}
if (y < 0) {
y = 0;
}
if (x > WIDTH) {
x = WIDTH;
}
if (x < 0) {
x = 0;
}
// for a serpentine layout reverse every 2nd column:
{
uint16_t i;
if (kMatrixSerpentineLayout == false) {
i = (x * HEIGHT) + y;
}
if (kMatrixSerpentineLayout == true) {
if (x & 0x01) {
// Odd rows run backwards
uint8_t reverseY = (HEIGHT - 1) - y;
i = (x * HEIGHT) + reverseY;
}
else {
// Even rows run forwards
i = (x * HEIGHT) + y;
}
}
return i;
}
}
But my point on this discovery is more general, we have to understand deeper the functions we are using, and its requirements , and for the Fastled library, that means go and look at the source code.