-
Notifications
You must be signed in to change notification settings - Fork 72
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
Do not include <SoftwareSerial.h> unless the user wants it. #53
Comments
Do you have any ideas for a way around including SoftwareSerial.h? I'd probably have to split the serial feature into separate HW serial and SW serial versions. |
Oh... actually I see what the problem is. It can be fixed by moving the SerialFirmata implementation into the header file. I'm finding I have to do this for pretty much all classes to avoid conflicts. It's an unfortunate issue with the way Arduino links and builds libraries. |
Also, have you tried using the Firmata Quadrature encoder feature? https://github.com/firmata/FirmataEncoder |
Thanks for looking at this so quickly. I didn't try moving the code into the .h file. Anxious to try that out whenever you like. I like FirmataEncoder, but wish it weren't hard-coded to use the Encoder library. I'm using a Pololu A-Star Arduino board, which is Leonardo-compatible with a 32U4 chip. I'm using the UART (pins 0 and 1) to talk to a Raspberry Pi (ROS-based higher-level control for the robot), and I'd also like to keep pins 2 and 3 free for I2C. That only leaves pin 7 for hardware interrupts, hence I want to use the EnableInterrupt library to get the encoder interrupts myself. I guess I'd like to have some sort of base Encoder class like this:
Then derive from that to make, say MyEncoder. Then if FermataEncoder were a template class, you'd have:
(And it could include an implementation for hardware interrupts using the Encoder library, too, but you'd be able to avoid it if you wanted to use pin-change interrupts, as I do.) Right now I'm using the ideas in FermataEncoder to roll my own Firmata extension. |
New plan. SerialFirmata will be moved out of the src directory as explained here. This will prevent the Arduino IDE from trying to compile any of the non-core features. |
In SerialFirmata.h there is a #include of SoftwareSerial.h. This is problematic because the latter file defines an interrupt handler for the Port B interrupt (on Uno and Leonardo). This definition will conflict with an ISR defined by another library, such as the EnableInterrupt library, even when not using software serial for Firmata.
Specifically, I'd like to use ConfigurableFirmata together with the EnableInterrupt Arduino library to define my own Firmata feature for wheel encoders, using the pin-change interrupts exposed by EnableInterrupt. The only way to do that right now is to manually edit SerialFirmata.h to avoid including SoftwareSerial.h.
To reproduce:
into the Arduino IDE.
Expected result: Sketch compiles and links without problems.
Actual result: Error linking the sketch because of multiple definitions of "__vector_9". See error output below.
The text was updated successfully, but these errors were encountered: