gobot icon indicating copy to clipboard operation
gobot copied to clipboard

Added ability to select a joystick by name

Open theunkn0wn1 opened this issue 5 years ago • 6 comments

Tihs PR adds a new Adaptor constructor for creating a joystick by implementation-specific name.

relates to #564

theunkn0wn1 avatar Mar 07 '20 22:03 theunkn0wn1

Hello @theunkn0wn1 thank you for the contribution.

How does the naming work if you have 2 of the same joysticks connected?

Could you please add an example of how you would use this with 2 joysticks? Ideally this would be in the godocs comments for the new constructor.

deadprogram avatar Mar 17 '20 11:03 deadprogram

To my understanding, this implementation has the same inherent flaw as the constructor it replaces, this implementation will always return the first of the two same-model joysticks as the underlying SDL2 library reports them. As I don't have two of the same joystick to compare against, im not sure what other identifiers on a joystick may be more unique we could base the constructor on.

I will happily provide godoc formatted examples, though I appear to be having a hard time finding the relevant documentation. :man_facepalming: Can you provide me a link for working with godoc?

theunkn0wn1 avatar Mar 18 '20 23:03 theunkn0wn1

@theunkn0wn1 because there is no answer yet by @deadprogram, I will try to give some help.

IMO there is no specific format for the first raw documentation needed. Just have a look at some other documentation of constructors in gobot. If there any developer/user is unsure about the correct use he will have a look into some test code or even an example (e.g. gobot/examples/*). Unit tests in general are very helpful.

gen2thomas avatar Sep 19 '22 12:09 gen2thomas

thanks @gen2thomas for a reply. The lack of activity on this PR caused me to completely forget it hadn't been seen to. I have long since moved on from golang in general, so this PR is now offered as-is.

theunkn0wn1 avatar Sep 19 '22 22:09 theunkn0wn1

@theunkn0wn1 thanks for the reply. So I will set it to draft as a reference.

gen2thomas avatar Nov 09 '22 17:11 gen2thomas

accidentally closed - now reopen

gen2thomas avatar May 23 '23 16:05 gen2thomas