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

Capabilities query parsing #51

Open
setnicka opened this issue Dec 13, 2016 · 2 comments
Open

Capabilities query parsing #51

setnicka opened this issue Dec 13, 2016 · 2 comments

Comments

@setnicka
Copy link

In util.py in function pin_list_to_board_dict there are some assumptions which may not be always true:

  • for digital pin order [0,1,1,1] is assumpted, but Firmata protocol does not specifiy order of modes (so [1,1,0,1] may appear too and it is correct format)
  • for analog, pwm and servo pins resolution is hardcoded and expected as 10, 8 and 14 bytes, but it may varry depending to a hardware

For example I have some board, which returns this byte array of capabilities for some pin: [0, 1, 11, 1, 1, 1, 4, 14]
I think we need to save capabilities for the pins in more general way.

@tino have you any idea how do you want to implement these features? I am ready to implement them and send a pull request (and other pull request to add pin state queries).

@setnicka
Copy link
Author

Hmm I think this would need bigger rewrite - there is problem that the same pin is capable of analog input and digital output, but there is two instances of pin in that case (one in analog list and one in digital list).

I will prepare some patch and send a pull request, but this will lead to some changes in API to correct this bug. Boards definitions should contain real pin numbers for analog inputs (or some mapping of them), or auto configuration should be used.

setnicka added a commit to setnicka/pyFirmata that referenced this issue Dec 15, 2016
* Enhanced autoconfig, which handles capabilities query with mixed modes
  (fixes issue tino#51)
* Pins can be both digital and analog pin (analog pins could be often
  used as digital pins)
* All pins are saved into global board.pins list, each pins exists in
  one instance and in board.digital/board.analog are references to the
  same objects
setnicka added a commit to setnicka/pyFirmata that referenced this issue Dec 15, 2016
* Enhanced autoconfig, which handles capabilities query with mixed modes
  (fixes issue tino#51)
* Pins can be both digital and analog pin (analog pins could be often
  used as digital pins)
* All pins are saved into global board.pins list, each pins exists in
  one instance and in board.digital/board.analog are references to the
  same objects
setnicka added a commit to setnicka/pyFirmata that referenced this issue Dec 15, 2016
* Enhanced autoconfig, which handles capabilities query with mixed modes
  (fixes issue tino#51)
* Pins can be both digital and analog pin (analog pins could be often
  used as digital pins)
* All pins are saved into global board.pins list, each pins exists in
  one instance and in board.digital/board.analog are references to the
  same objects
setnicka added a commit to setnicka/pyFirmata that referenced this issue Dec 15, 2016
* Enhanced autoconfig, which handles capabilities query with mixed modes
  (fixes issue tino#51)
* Pins can be both digital and analog pin (analog pins could be often
  used as digital pins)
* All pins are saved into global board.pins list, each pins exists in
  one instance and in board.digital/board.analog are references to the
  same objects
setnicka added a commit to setnicka/pyFirmata that referenced this issue Dec 15, 2016
* Enhanced autoconfig, which handles capabilities query with mixed modes
  (fixes issue tino#51)
* Pins can be both digital and analog pin (analog pins could be often
  used as digital pins)
* All pins are saved into global board.pins list, each pins exists in
  one instance and in board.digital/board.analog are references to the
  same objects
@setnicka
Copy link
Author

Prepared for merge in #52. After this will be merged I am ready to sent more pull requests with new features based on this rewrite :-)

setnicka added a commit to setnicka/pyFirmata that referenced this issue Jan 12, 2017
* Enhanced autoconfig, which handles capabilities query with mixed modes
  (fixes issue tino#51)
* Pins can be both digital and analog pin (analog pins could be often
  used as digital pins)
* All pins are saved into global board.pins list, each pins exists in
  one instance and in board.digital/board.analog are references to the
  same objects
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

1 participant