easybotics / node-rpi-rgb-led-matrix

Pilot your rgb led matrix with Nodejs ! Nodejs binding of rpi-rgb-led-matrix library https://github.com/hzeller/rpi-rgb-led-matrix - Actively Maintained!
Do What The F*ck You Want To Public License
57 stars 17 forks source link

Seems --led-slowdown-gpio is not supported? #13

Closed jannikkeye closed 3 years ago

jannikkeye commented 4 years ago

I have to use --led-slowdown-gpio option for my panels to not be glitchy but passing it in cli flags like "--led-slowdown-gpio=4" doesn't work. It works when using the c++ lib directly. The lib even complains when I set an invalid value.

Any idea why?

keptan commented 4 years ago

checking this out now

keptan commented 4 years ago

Just tested it locally and they seemed to work as a reminder, they have to passed as an array of strings like this var matrix = new LedMatrix(64, 64 , 1, 2, 100, 'adafruit-hat-pwm' ,'rgb', ['--led-slowdown-gpio=4'])

let me know if it still doesn't work

keptan commented 4 years ago

https://github.com/jannikkeye/led-matrix-apps/blob/master/nodejs-led-matrix-apps/src/flocking/run.ts var matrix = new LedMatrix(32, 64, 1, 2, 75, "adafruit-hat", "RGB", [ "--led-slowdown-gpio=4", "--led-show-refresh", "--led-pixel-mapper=U-mapper;Rotate:270", ]); seems like you were calling it correctly, so ill investigate more unless its the extra comma, sending a null string at the end of that array

testing with your arguments seems to work though

jannikkeye commented 4 years ago

Hey @keptan thanks for the quick response and sorry for my delay in responding. You are right everything is called correctly. Let me provide you with two images and their respective commands. I'll collect the data now,

jannikkeye commented 4 years ago

Using C++ library directly:

No --led-slowdown-gpio (note the obvious glitches on one half of every panel: sudo ./demo -D0 --led-rows=32 --led-cols=64 --led-chain=2 --led-pixel-mapper="U-mapper;Rotate:270" glitch_c++

With --led-slowdown-gpio:

sudo ./demo -D0 --led-rows=32 --led-cols=64 --led-chain=2 --led-pixel-mapper="U-mapper;Rotate:270" --led-slowdown-gpio=4 no_glitch_c++

Nodejs bindings (note same glitchiness):

var matrix = new LedMatrix(32, 64, 1, 2, 75, "adafruit-hat", "RGB", [
    "--led-slowdown-gpio=4",
    "--led-show-refresh",
    "--led-pixel-mapper=U-mapper;Rotate:270",
]);

glitch_nodejs_bindings

Maybe its not exactly the same, but how come using the bindings I get the similar glitch then. 🤷‍♂ Edit: I checked its indeed the same glitches that affect half matrix each.

Giphy Link: https://giphy.com/channel/db674672ca684e2c9b0b118b1a042fd6

keptan commented 4 years ago

When you use 'show-refresh' does it start printing the refresh rate info in the node output? trying to work out if the flags are working at all for you

on my hardware, the 'show-refresh' one definitely works for example

jannikkeye commented 4 years ago

Yes, show refresh and --led-pixel-mapper work as intended. Not sure about others as some aren't immediately apparent.

keptan commented 4 years ago

I'll check on monday if it's getting all the arguments or leaving one out, feels like an off-by-one error.

clowrey commented 4 years ago

I wonder if this has something to do with other config parameters being wrong and not the "--led-slowdown-gpio=4"

Your Node example image looks way worse than either of the C++ examples, not like the top one without the "--led-slowdown-gpio=4" flag which would be expected if that was the only issue.

jannikkeye commented 4 years ago

I wonder if this has something to do with other config parameters being wrong and not the "--led-slowdown-gpio=4"

Your Node example image looks way worse than either of the C++ examples, not like the top one without the "--led-slowdown-gpio=4" flag which would be expected if that was the only issue.

That may be just due to the nature of my node demo. I'm trying to get the same code as the c++ demo running in node for better comparison.

jannikkeye commented 4 years ago

giphy

I adapted the c++ demo for node and its the exact same visual glitch as when omitting --led-slowdown-gpio in the c++ examples. So it definitely seems like the option isn't picked up properly.

Please see this GIF on Giphy:

https://media.giphy.com/media/cjEQOow8lr0an8ymoO/giphy.gif

camow7 commented 4 years ago

Any chance this is going to be fixed?

camow7 commented 4 years ago

I hard coded the default to 4 (as I'm using rpi 4) in the opitions-initialize.cc and rebuilt the library using npm rebuild. This fixed the issue for me. image

clowrey commented 4 years ago

Thanks for posting that fix! I wonder if there is no easy way to change that setting at runtime only before like you have done? We don't have much extra time to work on this right now but happy to review pull requests to fix this issue in a configurable way preferably if anyone is interested.

camow7 commented 4 years ago

I'll have a crack at a fork and fix and then submit a PR.

arash1221 commented 4 years ago

Hello @keptan , thanks for the code, but I have 64*128 led panel with IC FM6126A, and this package is not working, I search a lot and found in 1 issue here below https://github.com/hzeller/rpi-rgb-led-matrix/issues/823 for hzeller c language that he fix it also for this kind of led panels, can you pls update your code, I think after he made changes you didnt change the library for nodejs, thanks a lot, appreciate

arash1221 commented 4 years ago

Also my led panel is worked with hzeller c library, my probledm is with the nodejs package and also i pass some flag like this var matrix = new LedMatrix(64, 128, [ "--led-slowdown-gpio=5", "--led-cols=128", "--led-rows=64", "--led-panel-type=FM6126A", "--led-row-addr-type=3", ]);

but still no result :( !!!!!!!!!

camow7 commented 4 years ago

@arash1221 can you try my fork and see if that solves your problems? Also you shouldn’t need to use the cli flags for setting row and column as that is set in the first two arguments if the constructor. Can you post any errors you get.

arash1221 commented 4 years ago

Hello @camow7 thanks for response, I try also this fork and can you send me your fork link because i dont know that i try write repository or not pls! https://github.com/zeitungen/node-rpi-rgb-led-matrix

no result, the other repository this one https://github.com/easybotics/node-red-contrib-easybotics-led-matrix at least show some wrong pixel but this fork, https://github.com/zeitungen/node-rpi-rgb-led-matrix I tried no result at all with no error and this is my code :

var LedMatrix = require("node-rpi-rgb-led-matrix"); var matrix = new LedMatrix(64, 128 ); matrix.fill(255, 50, 100); matrix.setPixel(10, 10, 0, 50, 255);

the other repository easybotics return 1 but this one nothing happend!!

camow7 commented 4 years ago

@arash1221 https://github.com/easybotics/node-rpi-rgb-led-matrix/pull/14

camow7 commented 4 years ago

@clowrey I have been using my fork for a few weeks and it seems to be good. Should be right to merge in the pr.

chollan commented 3 years ago

hey guys, i hate to beat a dead horse, but i'm using the rpi3 and applying the gpio-slowdown of 4 doesn't work with this library, but when i clone hzeller/rpi-rgb-led-matrix and apply a slowdown of 4, it works.

Also, I had this working 3 weeks ago, had to reinstall because of datacorruption and all of the sudden it stopped working

is there someting i'm missing?

EDIT: I got it working by changing the slowdown value within node_modules/easybotics-rpi-rgb-led-matrix/external/matrix/lib/gpio.cc

image

ryanmich251 commented 3 years ago

My latest commit should fix this. The hzeller library treats the --led-slowdown-gpio option (as well as a few other options) as "runtime options". We essentially just weren't dealing with any of the runtime options before, since most of the command-line flags aren't runtime options, so that's why this issue popped up.

PR #14 fixed this, but had the side effect of dropping root privileges (that's the default behavior in the hzeller library but not in our nodejs binding). This would break some pre-existing code that relies on this (including our node red binding of this). This may not be a great default to have in terms of security, but for now it should prevent existing code from breaking. Can be overridden with the --led-drop-privs flag.