-
-
Notifications
You must be signed in to change notification settings - Fork 420
Description
Hi, not sure if this project is still actively maintained but, I've found an issue when using the Single-Reporting version of the Game pad API.
When connecting an Arduino Pro Micro using Gamepad1::begin()
, it will register as 3 controllers, each one labelled "Arduino Micro" in the Windows 10 "Set Up USB Game Controllers" panel.
Findings and Recommendation
In SingleGamepad.cpp
, the declaration of each individual SingleGamepad_
instance causes them to be constructed, and when each one is constructed, they call PluggableUSB().plug(this);
, which causes them to register as devices, up to the limit of the MCU or until all 4 controllers are "connected". This, of course, does not make sense if I only want to program the MCU as one gamepad instance. Removing the other declarations of SingleGamepad_
fixes the issue.
One way to fix this, I believe, is to override the begin()
function in GamepadAPI
to make the call to plug the gamepad instance into the system for any SingleGamepad_
instance.
Another way, which, IMO, might be better, is to remove the pre-declared instances entirely and allow users to declare their own SingleGamepad_
instance in their source file. This goes against the rest of the library's workings, but I think this brings it more in line with the way other libraries expect their users to construct class instances through variable declaration.