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

Corrected parsing of slowdown-gpio flag #14

Closed camow7 closed 3 years ago

camow7 commented 4 years ago

Fixes #13 I have modified the code to initialise the RGB matrix using the convenience function CreateMatrixFromFlags. I have put this after the io.Init() call as I believe this overwrites whatever parameter you send in using the --led-slowdown-gpio=x cli arg. Using the CreateMatrixFromFlags to create the RGB matrix object does all the parsing and application of options in one go. This correctly applied the the --led-slowdown-gpio arg when I tested.

You can now initialize using the following code without error.

matrix = new LedMatrix(32, 32, 1, 1, 100, 'adafruit-hat', 'RGB', ['--led-slowdown-gpio=4']);
]);
ryanmich251 commented 3 years ago

Fixed with commit 3f2e3de. I did basically the same thing you have here except I set the drop_privileges runtime option to be 0 by default as to not break existing code that relied on that behavior, and I removed some unused code from the function. Thanks for the PR.