Skip to content

Made node.js hid example more friendly for new users #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2019

Conversation

timonsku
Copy link

Hi, tried to make the example a bit more user friendly for someone who may have never used node.js before.
It now send a string that the user can define and change.
I also annotated anything that might be ambiguous to someone new to node.js or node-hid, to make it clear what is happening and why.

I also started a convention to define supported boards (as there will be A LOT when SAMD21 and SAMD51 support comes along) to make it easy to switch between them. Instead of manually changing the vid and pid you can just pass f.e. 'Feather_nRF52840' into the find() function.

@timonsku
Copy link
Author

I kept the change that @todbot made for OSX to keep the buffer size the same. Its just done a little different as the array is now created very differently.

@hathach
Copy link
Owner

hathach commented May 27, 2019

superb!! Thank you very much, it looks a lot better and easier to understand now even to me :)

@hathach hathach merged commit dc601ab into hathach:master May 27, 2019
@hathach
Copy link
Owner

hathach commented May 27, 2019

@PTS93 one question, instead of choosing the device metro/feather can we loop through an list containing known vid/pid and or by vendor only (since adafruit has a tons of samd21/samd15 board with different PID). User can of course manually add more to the list ( and submit PR), if they use a custom board.

@timonsku
Copy link
Author

I was about to do it like that and we could certainly still do it that way.
My idea was that you might not want it to randomly select the first board it finds if you got multiple attached but can define the specific board type.
But I could actually have it both, simply by having a list of the objects instead of pids and vids.
I will test something this evening and if it woks nicely code wise I would add a "any_supported_board" option.

@hathach
Copy link
Owner

hathach commented May 27, 2019

@PTS93 multiple board connected with HID device is not very common for most users. Though, manually changing nodejs is very headache. It is true for me, since I typically testing multiple boards making sure all ports are still working after some major changes :). Please make a list of vid/pid if possible, thank you in advance :)

@timonsku
Copy link
Author

Yea, you're right. The more I think about it the less it makes sense for most users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants