Skip to content
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

[v3.0.0] PIN_STATE_QUERY should also report current resolution #86

Open
zfields opened this issue Mar 22, 2017 · 6 comments
Open

[v3.0.0] PIN_STATE_QUERY should also report current resolution #86

zfields opened this issue Mar 22, 2017 · 6 comments

Comments

@zfields
Copy link
Contributor

zfields commented Mar 22, 2017

0  START_SYSEX              (0xF0)
1  pin state response       (0x6E)
2  pin                      (0-127)
3  pin mode (the currently configured mode)
?  pin resolution (the resolution to support the mode) <--------------------- PLEASE ADD THIS
4  pin state, bits 0-6
5  (optional) pin state, bits 7-13
6  (optional) pin state, bits 14-20
... additional optional bytes, as many as needed
N  END_SYSEX                (0xF7)
@soundanalogous
Copy link
Member

you can already get the resolution from the capability query

@soundanalogous
Copy link
Member

soundanalogous commented Mar 22, 2017

also, I could add it in a backwards compatible way by adding it after byte 6... although I'd have to make pin state a fixed length

@zfields
Copy link
Contributor Author

zfields commented Mar 22, 2017

I thought capability query would tell the maximum resolution of the pin. I am looking for the current resolution; similar to pin mode.

I would hesitate to add it after byte six. I thought the point to have as big of a value as you need. That would cap you at two bytes - as you said... :-) I didn't read thoroughly until after I typed.

@soundanalogous
Copy link
Member

Capability query is the current default resolution for the pin. There is currently no API in the protocol that enables changing the pin resolution (although I have had a proposal open for a number of years). This does get more complex as more boards now have DACs. PWM resolution may be able to change on a per pin basis (for non-Arduino boards). Analog input resolution can currently only be changed globally for Arduino, but perhaps for other platforms it can be changed on individual pins (although Firmata currently only supports Arduino and Particle).

@zfields
Copy link
Contributor Author

zfields commented Mar 22, 2017

Fair enough. I just thought I would float the idea. I don't really have a use for it now, but as I complete the wiring API, I can see that it will become necessary.

@soundanalogous
Copy link
Member

It's a worthwhile suggestion. I'm not sure yet whether it fits better into the pin state queryor if it make more sense as part of the proposed analog config message (which needs to be updated in general), in which case I'd add getters for the analog read and write resolutions (global per board rather than pin-based).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants