-
Notifications
You must be signed in to change notification settings - Fork 147
Expose bit resolution of ADC, PWM (and others as available) #149
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
Conversation
Signed-off-by: Rick Waldron <[email protected]>
@@ -505,6 +523,12 @@ function Board(port, options, callback) { | |||
RES_TX3: 0x07, | |||
}; | |||
|
|||
this.RESOLUTION = { | |||
ADC: null, |
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.
What happens if the user skips the configurationQuery? Do we need defaults values set here instead?
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 guess another way to think about this is do the default values live in firmata.js or in johnny-five (where the normalization of analog and pwm values takes place).
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.
This is the only place in firmata.js where there is a reference to the resolution: https://github.com/firmata/firmata.js/blob/master/lib/firmata.js#L740. If we set defaults in firmata.js that param description could change to something like:
"The data to write to the pin between 0 and this.RESOLUTION.PWM."
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.
What happens if the user skips the configurationQuery? Do we need defaults values set here instead?
That's reasonable, we should just use Arduino defaults. (update shortly)
If we set defaults in firmata.js that param description could change to something like:
"The data to write to the pin between 0 and this.RESOLUTION.PWM."
Sounds good
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 like this better than my stab at it :)
👍
61ae483
to
36b37c7
Compare
Signed-off-by: Rick Waldron <[email protected]>
36b37c7
to
6c1ec84
Compare
4 similar comments
LGTM |
@soundanalogous @monteslu thanks for reviewing |
Simplified mechanism for exposing resolution values from capabilities response. Intended to supersede #144
Signed-off-by: Rick Waldron [email protected]