Closed samturner3 closed 5 years ago
scroll is a feature from the original that we never used, but I can look into it
👍 great that would be useful. On the rpi I got segmentation fault
when attempting to run it. Looks like in https://github.com/zeitungen/node-rpi-rgb-led-matrix/blob/d873f412f8db311f4992580466bb02ea53f0b586/src/ledmatrix.cc#L288 we need a callback as first arg then the rest can be unset as they will be default.
Would be great to get all the features of the node-red working and documented here (image to matrix etc) plus scroll 👍 👍
Planning on using this repo for integration to other products such as home automation
Currently got these functions working in my fork:
The scroll features is probably broken, i also implemented the scroll feature with just a while and .drawText, it's very easy to implement. But i suggest you to try to implement the scrolling with .draw because with image it's better and you don't have problem with fonts.
A tip for scroll the images that could be also applied to text. (the var "imageBuff" must be a buffer that contains just the pixel not the header of the images then i suggest you to use format like .ppm that can be easly converted with ImageMagick )
var x1= 256, x = 0;
matrix.setImageBuffer(imageBuff, width, height)// set image buffer
while(x1!=0){ //to let it appear from right
matrix.clear();
matrix.draw(x1, 0, 256, 32, 0, 0, false, false);
matrix.update();
x1--;
delay(tDelay);
}
while (x<width) { //to let it disappear at left
matrix.clear();
matrix.draw(0, 0, 256, 32, x, 0, false, false);
matrix.update();
x++;
delay(tDelay);
}
I hope that i helped you. (sorry for the english)
Ok, how to use .draw and .setImageBuffer ? It is not in the LedMatrix API readme.
.draw and .setImageBuffer are legacy functions that probably don't do anything in their current state
I see on a commit you added a scoll feature. Can you please provide an example on how to use?
matrix.scroll(callback, startx, starty, width, height, direction, speed, loop)
?matrix.drawText(32, 0, 'text!', font, 255, 255, 255.scroll({}, 0, 0, 20, 20, left??, 30, true ? 1)
???From the code I can see something like
.scroll(callback, startx, starty, width, height, direction, speed, loop)
I haven't been able to reverse engineer and figure out how to use it. I tried a few times and got a segmentation fault a few times