-
Notifications
You must be signed in to change notification settings - Fork 73
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
Capability response does not report all pins for encoder #87
Comments
It looks like there is an inconsistency in the current implementation between restricting pins to only those that support pin change interrupts vs allowing any digital pin on the board. I assume you're using an Arduino Uno or other ATMega328p-based board if you're only seeing the capability query reporting pins 2 and 3. This is due to this line. |
Yes, I am working with Arduino Uno. |
I have just published my beta Lazarus client (Lazarus-client-for-Firmata-boards) if someone wants to try. |
Is there any body who could fix this issue? or can any body tell me how to do it? |
The first step is to determine if this is actually an issue or is WAI. An encoder will work best on pins 2 and 3 on an Arduino Uno because they use interrupts. Have you tested the encoder on other digital pins and do you feel its performance is acceptable in that case? |
I have not tested yet, I know (now after some research) arduino pin2 and 3 have interrupt capabilities but for most things you don't need that speed (a rotary encoder to adjust a level for example). |
I think I found another issue, I was working with an arduino nano , you know it has 2 more pins, but those pins are reported as analog pins only, so my client can't use them for other modes. Can you see now, how important is report capabilities? |
The two extra analog pins on the Arduino Nano can only be used for analog input. It is a limitation of the ATmega328p, not Firmata. |
If I were to completely rearchitect the way report capabilities works, I would only report capabilities of the microcontroller. So there would be no such thing as a Servo Pin, an Encoder pin, a OneWire pin, Stepper pin, etc because they are not capabilities of the board. This issue that occured is pins types were assigned as identifiers of types of peripherals that could be wired to the board rather than just the core pin functions such as digital I/O, analog I/O, I2C, SPI, UART, and also identifying things like which pins support interrupts. The ideal way to handle Encoder would be just to report which pins are interrupt capable. The user can then determine wether or not to use the Encoder with interrupt pins only, or with digital pins that are not interrupt driven. However at this point I'm not sure when or if I'll ever get around to making such an overhaul. I'm really looking to people in the community to step forward to drive the effort and I can provide guidance along the way. |
I am a newbie to arduino, and I didn't kown the extra pins only work in analog mode. Your point of view is right, but that involves a different approach solution and no firmata commands and a very very ... difficult task for me. Now I have a new question related, is there a way an arduino knows it is an arduino board and what type Uno, Due, Mega, etc.? |
This is not so simple. There is a way to identify the board architecture (e.g. |
Correction from my above statement. The Firmata client would NOT need to report the pin layout back to the board. That's already handled correctly in the firmware. However, the Firmata client would need to understand the pin layout. That's what capability response give you today. A board Id would just be a round about way to get the data you already get from the capability response. |
Testing my Lazarus client for firmata I found missing informatión when firmata reports encoder pin capability.
It only shows pin2 and pin3 and from my reseach all pins are encoder capable so report capability should include that information, because I get all pin resolutions and capabilities from this report.
The text was updated successfully, but these errors were encountered: