ludiazv / node-nrf24

nRF24 (nrf24l01/nrfl24l01+) radios in the nodejs way
MIT License
40 stars 15 forks source link

print_details not working for config() function #7

Closed ngfelixl closed 6 years ago

ngfelixl commented 6 years ago

Hey, this seems to be a great library, thanks! While the lib successfully and correctly prints true for .begin(), .present() and .isP(), calling config with the print_details flag enabled like follows

radio.config({
  PALevel: nrf24.RF24_PA_MIN,
  [...]
}, true);

The code in a try catch environment prints the following error with the line number pointing to the config function

SyntaxError: Unknown error

Also the JS code stops without terminating or printing any errors after using useWritePipe(pipe) and addReadPipe(pipe).

console.log('[Nrf] start test');
radio.useWritePipe(pipe);
console.log('[Nrf] set up pipes'); // Does not execute this line

Running a simple c++ test program using rf24 class works. Platform is Raspberry Pi Zero W. Connection as you suggest

NRF24L01+ RPi Zero W (GPIO) Pin Number
VCC 3.3V 17
GND GND 20
CE GPIO 22 15
CSN GPIO 8 24
MISO GPIO 9 21
MOSI GPIO 10 19
SCK GPIO 11 23
IRQ GPIO 25 22

Any suggestions?

ngfelixl commented 6 years ago

Also the GettingStartet.js works only if I use config(config) without print_details. And breaks at line 41 (sender) or 27 (receiver) at

radio.addReadPipe(Pipes[0]);

The related error is

readline.js:1021 < throw err;

SyntaxError: Unknown error
  at snd (/home/pi/GettingsStarted.js:41:9)                     # sender @41:9, receiver@27:19
  at rl.question (/home/pi/GettingsStarted.js:83:31)
ludiazv commented 6 years ago

I think your are using the previous version that is on npm repository. Use master branch to use this API call.

Regards,

ludiazv commented 6 years ago

I think your are using the previous version that is on npm repository. Use master branch to use this API call.

Regards,

ngfelixl commented 6 years ago

You are totally right, it was the npm version. Latest master works fantastically. Thank you so much, for your help and for this lib!