-
Notifications
You must be signed in to change notification settings - Fork 411
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
Added return value to sendState() #86
base: master
Are you sure you want to change the base?
Conversation
The return value can be useful to detect, if USB host is active, or if it only supply power to the device.
I like the idea! In reviewing the
Having the If we modify Do you want to modify your Pull Request as indicated above (and also update the README.md documentation accordingly) or you would prefer for me to make the change (after I decide what should be done with all of the functions that call Thanks again for your contribution, |
Hello,
Thank you for the email!
It is a good question about return values from other methods. My opinion is
that is not necessarily. This is I think more advanced usage of the
library, and the programmer who needs that feature can initialize the
object with "false" parameter and call the sendState() when he needs it -
and then check the return value. Also, it is possible that in the future
other methods will need functionality to return different parameters, so
the status of the USB communication will be not specific to them.
I have small experience with the Github, so it would be better if you could
make that commit, especially that you make better implementation.
Best Regards,
Aleksander Kawęczyński
tel. +48 508 076 187
śr., 9 maj 2018, 03:49 użytkownik Matthew Heironimus <
[email protected]> napisał:
… I like the idea!
In reviewing the USB_Send function defined in the USBCore.cpp
<https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/USBCore.cpp>
module, it appears it returns the following:
- -1 if an error occurs
- length of the buffer if the buffer was successfully sent
Having the Joystick.sendState() function return the length of the
internal _hidReportSize variable exposes some implementation details I
might want to modify in a future version, but I do like the idea of the
function returning a bool to indicate if the function worked correctly or
not.
If we modify Joystick.sendState() function, should we modify the other
functions that call sendState() internally as well? For example, if
initAutoSendState is set to true, functions like setXAxis, pressButton,
etc. all call sendState. These functions could be modified to return the
result of the sendState() (or true if initAutoSendState is set to false).
Thoughts?
Do you want to modify your Pull Request as indicated above (and also
update the README.md documentation accordingly) or you would prefer for me
to make the change (after I decide what should be done with all of the
functions that call sendState)?
Thanks again for your contribution,
Matt
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#86 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AD4U2UZJPi42g_g-xa1MObNOytoMyWIfks5twksggaJpZM4T0i0k>
.
|
I agree with your reasoning on only updating the Thanks again for your contribution, |
The return value can be useful to detect, if USB host is active, or if
it only supply power to the device.
Fixes # or Enhancement #
Changes proposed in this pull request:
Contributors: