-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
SRV_Channel: use enumeration for servo input type #21396
base: master
Are you sure you want to change the base?
SRV_Channel: use enumeration for servo input type #21396
Conversation
900e002
to
3c570ed
Compare
AUX = 16, | ||
ANGLE = 17, | ||
RANGE = 18, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why start at 16?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better than zero :-) I'd usually wouldn't choose 16, but on this day I did. Since it's an internally-used enumeration the values don't matter, and if you're stepping through gdb and find the number 17 it's a lot easier to search for that value in the relevant header vs 0 or 1.
@@ -49,6 +49,12 @@ class SRV_Channel { | |||
public: | |||
friend class SRV_Channels; | |||
|
|||
enum class Type { | |||
AUX = 16, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to be RANGE=0 to be sure that the default is the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done this by setting the value in the constructor to Type::Range. Changing the enumeration values here wouldn't have helped.
094e932
to
5bb4ac1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, what output type is aux output?
Comes down to "whatever the library responsible for the pin wants it to be". For example, NeoPixel does digital stuff on the pins it owns ( Breaking this out into a distinct enumeration value is meant to help catch where we set things with the angle calls but haven't specified a range for the angles... |
5bb4ac1
to
e1f1958
Compare
98f03dd
to
ee3d9cf
Compare
ee3d9cf
to
061220e
Compare
No description provided.