eroak / rpi-433

Simple NodeJS module to send and receive decimal codes through 433Mhz device on RaspberryPI 2
46 stars 23 forks source link

Allow to setup pin num #1

Closed scsirdx closed 9 years ago

scsirdx commented 9 years ago

I changed code, so it now allow to setup input and output pin like:

    var rfSniffer = rpi433.sniffer(1);
    .....
    rfSend(1234, function() {}, 0);

Sorry for tab changes, linter changed it, and i noticed only while creating pull request.

eroak commented 9 years ago

I planned these changes to a new version but thank you :)

But i think the callback parameter should be at the end (it's always the last param) and the pinNumber should be optional

I think i will use promises in the next version

There is a problem with pin = pin || 2;. If you pass a 0 it would never be 0 but 2. This line should work better : pin = typeof pin !== 'undefined' ? pin : 2

scsirdx commented 9 years ago

Fixed pin num and moved callback param. But this is a breaking change. This is a reason, why i leaved callback as a 2nd argument.

eroak commented 9 years ago

This this not a breaking change if you check the number/type of parameters. I'm working on it.