Closed ajmas closed 3 years ago
So there seems to be some API changes. I am taking a look to see what changes need to be made, but not really that versed in the V8 API and I am rusting in C++. I'll make notes on some observed changes that to be made (partly with reference to https://github.com/bcoin-org/bcrypto/issues/7), as I see what they are:
Error 1:
usleep(info[0]->Int32Value() * 1000);
Needs to be replaced with:
usleep(info[0]->Int32Value(Nan::GetCurrentContext()).FromJust() * 1000);
Error 2:
v8::String::Utf8Value value(stripType->ToString())
Need to be replaced with (using this as reference):
v8::String::Utf8Value value(v8::Isolate::GetCurrent(), Nan::To<v8::String>(stripType).ToLocalChecked());
True, Int32Value() is obsolete I think. Data type conversions in V8 is a mess. Open for suggestions.
These changes seem to work. Running the following now fills half the matrix with LEDs in red:
sudo node examples/fill-with-color.js
Ah there is another possible replacement for Int32Value(), which I'll try:
int32_t arg = info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value();
Confirms this works too. I'll make a PR a bit late, if welcome.
OK, error 2?
Resolved as well, using this alternative:
v8::String::Utf8Value value(v8::Isolate::GetCurrent(), Nan::To<v8::String>(stripType).ToLocalChecked());
Make a pull request and I will publish a new version on npm. Thank you!
Will be watching to give this a test, when published. Thanks very much, ajmas, been struggling to get an upto date library for neo pixel in node. Cheers.
I may need to make a new PR later, based on some new information provided to me on Stack Overflow, though if anyone has time they are welcome to do so as well.
No worries, just let me know and I will publish a new version on npm...
I am running into an install failure, which seems related to the node-gyp version being used.
What's going wrong
When I run
npm install rpi-ws281x
I get the following output (full output here):Environment
lsb_release -a
:Linux bluepenguin 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux
BTW Just saw issue #6. I'll see if this is the same issue, but would be good to see this updated to support more recent version of NodeJS, if this is the case.