Closed devrim-oguz closed 3 years ago
Edit: I have just seen the commit to resolve the issue, I guess it is caused by the npm package coming from behind. Can you update the npm repo?
hey @devrim-oguz can you check 2.1.3. an report back?
thx for reporting
Tristan
I cleared the node modules, removed the libray from the package.json file and installed the v2.1.3, issue seems to be still there, code doesn't seem to be changed.
Thanks for the quick response.
Ok, my bad I'm so sorry. The commited code of "AhmedBHameed" #17 is on the line 202, whereas the electron gives the error on "line 32" of the index.js file. Can this issue be fixed by replacing it with something else?
// Hold RESET pin low for 50ms to hard reset the reader
rpio.open(this.reset_pin, rpio.OUTPUT, rpio.LOW);
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 50); //<- This line gives the error (Line 32 of index.js)
rpio.write(this.reset_pin, rpio.HIGH);
return this;
can you report back if this works?
setResetPin(pin = 22) {
if (!pin) {
throw new Error(
"Invalid parameter! reset pin parameter is invalid or not provided!"
);
}
this.reset_pin = pin;
// Hold RESET pin low for 50ms to hard reset the reader
rpio.open(this.reset_pin, rpio.OUTPUT, rpio.LOW);
setTimeout(function() {
rpio.write(this.reset_pin, rpio.HIGH);
}, 50);
return this;
}
or if you know a better way.
feel free to create a pull-request to fix this issue! i will release a new version.
Thanks for quick response again, I've tried the code
setResetPin(pin = 22) {
if (!pin) {
throw new Error(
"Invalid parameter! reset pin parameter is invalid or not provided!"
);
}
this.reset_pin = pin;
// Hold RESET pin low for 50ms to hard reset the reader
rpio.open(this.reset_pin, rpio.OUTPUT, rpio.LOW);
setTimeout(function() {
rpio.write(this.reset_pin, rpio.HIGH);
}, 50);
return this;
}
and it gives an error of the pin not being defined, but I figured that it is caused by this.reset_pin since the reset pin belongs to the parent function, so changed the code like this:
setResetPin(pin = 22) {
if (!pin) {
throw new Error(
"Invalid parameter! reset pin parameter is invalid or not provided!"
);
}
this.reset_pin = pin;
// Hold RESET pin low for 50ms to hard reset the reader
rpio.open(this.reset_pin, rpio.OUTPUT, rpio.LOW);
setTimeout(function() {
rpio.write(this.reset_pin, rpio.HIGH);
}.bind(this), 50);
return this;
}
and this time it worked. Thanks for the help, I will create a pull request in a few minutes after testing it again.
I created a pull request in #21 but only changed the package.json file to update the version number. Is this enough or more changes neededed for a version update? Can you update the required parts before updating the npm package please?
Created a new pull-request by changing both the package.json file and the package-lock.json file. Can you please review the changes before merging it?
Also, what does the new Int32Array(new SharedArrayBuffer(4))
do in the Atomics.wait function?
Hey, did you forgot about the pull request? 😊
Issue resolved in #22. Closing the issue.
My electron build on Raspberry Pi 4 B gives this error:
It is shown to be caused by the line 32 of index.js -> Atomics.wait( new Int32Array(new SharedArrayBuffer(4)), 0, 0, 50);
can't we replace these Atomics.wait with something else for electron compatibility?