So I just spent quite a while configuring a new joystick in gobot.io. Its a magicsee r1 (Image below)
It wasn't terribly easy to achieve so I wanted to offer the following ideas for improving the code.
1. joystick.NewDriver method, not clear what the config parameter is supposed to be.
It wasn't until I dug into the code that it was apparent that the config parameter could be either
one of the special strings "dualshock3", "dualshock4", "tflightHotasX", "xbox360", "xbox360RockBandDrums"
OR
a path to the config file for the joystick. In my case i used a fully qualified path ""/home/pi/go/src/gobot.io/x/gobot/platforms/joystick/configs/magicseer1.json"
If there are special keys, they should be factored out as constants. Also, the documentation should state that the parameter has two possible forms.
In addition, it isn't clear where the path is evaluated from if a relative path is used.
2. handle event unknown button silent fail.
The code in handleEvent matches the button value against the config file. If there is a mismatch and the value isn't found, there's a silent fail.
This case should show up somewhere as an error to catch problems such as misspellings in the config file. Same goes for axis and hat mappings
3. loadFile silent failures.
There is a path here that should be caught and shown as errors. the call to json.Unmarshal returns an error but it is discarded. Having this returned as an error would catch cases where the config file was missing a comma or something (surprisingly easy to do)
I hope I've explained the problems clearly there and suggested worthwhile improvements.
CR