-
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
Implement new feature DeviceFirmata. #52
base: master
Are you sure you want to change the base?
Conversation
…e-firmata # Conflicts: (versioning conflicts, resolved) # library.properties # src/ConfigurableFirmata.h
src/ConfigurableFirmata.h
…ad-write' into v0.8-j5-servo
Jeff: I've been using 2 Leonardos and an Arduino Micro for testing. I'll get you some memory numbers. Experience wise, I've generally been able to run 2 drivers when I leave out most of the configurable features. Despite the long list of commits there are only changes to five files in ConfigurableFirmata: DeviceFirmata<.cpp, .h>, the .ino, the associated SelectedDevices.h, and the change to ConfigurableFirmata.h to add the Sysex codes. A good review is definitely in order! The devil is in the details. |
Here are the results of some memory testing. |
Jeff: FYI. I find that because of the way that Arduino does the build process, there is a fair amount of junk left behind by the files that are compiled, linked, then removed. So I did an experiment:
|
|
||
#include "DeviceFirmata.h" | ||
#include "utility/Boards.h" | ||
#include <Base64.h> |
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 is the advantage of using Base64 encoding rather than 7-bit encoding with the existing Encoder7Bit class?
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.
My assumption is availability of Base64 libraries for client applications, but wanted to understand if there are other reasons/advantages.
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.
Client availability.
Documentation and knowledge widely available.
No embedded Firmata calls. I'm trying to make sure that Luni can be used
totally standalone, or perhaps with other comms protocols, and I didn't
want anything that assumed the Firmata environment.
On Sun, 19 Jun 2016 23:07:42 -0700, Jeff Hoefs [email protected]
wrote:
In src/DeviceFirmata.cpp:
@@ -0,0 +1,264 @@
+/*
- DeviceFirmata.cpp - Firmata library
+*/
+#include "DeviceFirmata.h"
+#include "utility/Boards.h"
+#include <Base64.h>My assumption is availability of Base64 libraries for client
applications, but wanted to understand if there are other
reasons/advantages.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Using Opera's mail client: http://www.opera.com/mail/
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.
Jeff:
I wanted to clearly separate the comms codec and make sure that nothing
related to it leaked out into the Luni code or the user client code.
Using a standard codec and applying it right at the point of send and
receive seemed like a good way to achieve that.
I wrote a Firmata client library in Java to support the early design and
testing, and it was a one-line task to do the Base64 work, and later I had
the same experience in Javascript. So I left the redundancy of the codecs
in the design.
Doug
Client availability.
Documentation and knowledge widely available.
No embedded Firmata calls. I'm trying to make sure that Luni can be used
totally standalone, or perhaps with other comms protocols, and I didn't
want anything that assumed the Firmata environment.
On Sun, 19 Jun 2016 23:07:42 -0700, Jeff Hoefs [email protected]
wrote:
In src/DeviceFirmata.cpp:
@@ -0,0 +1,264 @@
+/*
- DeviceFirmata.cpp - Firmata library
+*/
+#include "DeviceFirmata.h"
+#include "utility/Boards.h"
+#include <Base64.h>My assumption is availability of Base64 libraries for client
applications, but wanted to understand if there are other
reasons/advantages.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Using Opera's mail client: http://www.opera.com/mail/
Is it necessary that an old version of Boards.h is included with the Luni library? |
Looking over the Planned and Deferred changes in LuniLib it appears that the longer term strategy is to provided general control over the microcontroller (GPIO, Wire, SPI, OneWire). How does this map out against Firmata or is ConfigurableFirmata a temporary stepping stone on a larger roadmap (which is fine by me BTW, just looking for clarity into how long lived Firmata integration would be). |
I'm assuming the src-drivers are either not included (or the compiler optimizes them away) if LuniLib is included but those particular drivers (Servo, MCP9808, etc) are not used, correct? |
Edited to add: This conversation about boards.h became issue finson/Luni#6. No, in fact I'd like a simpler way to access Boards.h without having to |
Regarding Boards.h, I'd have to look over the macros from that file you are using and whether or not all supported boards already provide equivalent macros and constants in their respective pin variant definitions. It may be possible to avoid the dependency. There are a number of macros that could be removed from Boards.h because standard definitions exist for all Arduino boards (this was not the case years ago, but has improved). |
Right, they are not compiled at all, and therefore don't contribute On Sun, 19 Jun 2016 23:57:39 -0700, Jeff Hoefs [email protected]
Using Opera's mail client: http://www.opera.com/mail/ |
I didn't use the boards.h macros at first. Partly because there was just It might be worth thinking about a way to separate pin modes and available On Mon, 20 Jun 2016 00:10:31 -0700, Jeff Hoefs [email protected]
Using Opera's mail client: http://www.opera.com/mail/ |
My intention is that the integration with Firmata be long lasting. If I I have a PING sensor sitting right next to me, waiting for the moment when In the list you quote, GPIO is in fact a device driver (now named SPI and OneWire in my mind are more in the mold of the I2E code in the On Sun, 19 Jun 2016 23:34:06 -0700, Jeff Hoefs [email protected]
Using Opera's mail client: http://www.opera.com/mail/ |
I'm having issues compiling the ConfigurableFirmataDeviceDriver example. I'll have more input tonight when I'm home from work and can look into it further, but I believe part of the issue is that Arduino doesn't compile anything that isn't in the |
Jeff: I intentionally moved all the unused features (ConfigFirmata) and all the unused device drivers (Luni) out of the src directories because it saves memory at runtime to not have them compiled, linked, and removed. The easiest solution (at the cost of a little dynamic memory) is to drag all the feature files back to the src dir and all the Luni driver directories back to the Luni src dir. Everything should compile then. Doug
|
Edited to add: The description below is how it’s supposed to work. However, when I moved everything back just now to confirm it, I realized that I had changed the way the driver subclasses interact with the DeviceDriver base class while writing DDSensor and so it is the only one that still compiles in the current 0.10 branch. So I’ll fix that this afternoon when I can and push a commit for it. In the meantime, I think that if you move all the Config Firmata features back to src/ and just use DDSensor from Luni, everything should compile again. Fix coming this evening or tonight, depending on how my afternoon shapes up! Jeff: I intentionally moved all the unused features (ConfigFirmata) and all the unused device drivers (Luni) out of the src directories because it saves memory at runtime to not have them compiled, linked, and removed. The easiest solution (at the cost of a little dynamic memory) is to drag all the feature files back to the src dir and all the Luni driver directories back to the Luni src dir. Everything should compile then. Doug
|
Edited to add: DDSignal, not DDSensor. Edited to add: The description below is how it’s supposed to work. However, when I moved everything back just now to confirm it, I realized that I had changed the way the driver subclasses interact with the DeviceDriver base class while writing DDSensor and so it is the only one that still compiles in the current 0.10 branch. So I’ll fix that this afternoon when I can and push a commit for it. In the meantime, I think that if you move all the Config Firmata features back to src/ and just use DDSensor from Luni, everything should compile again. Fix coming this evening or tonight, depending on how my afternoon shapes up! Jeff: I intentionally moved all the unused features (ConfigFirmata) and all the unused device drivers (Luni) out of the src directories because it saves memory at runtime to not have them compiled, linked, and removed. The easiest solution (at the cost of a little dynamic memory) is to drag all the feature files back to the src dir and all the Luni driver directories back to the Luni src dir. Everything should compile then. Doug
|
Which Base64 library are you using? There are more than one in the Arduino library manager. |
name=base64 On Mon, 20 Jun 2016 16:19:23 -0700, Jeff Hoefs [email protected]
Using Opera's mail client: http://www.opera.com/mail/ |
I have no idea how this is possible, but your fork of ConfigurableFirmata seems to have superseded ConfigurableFirmata in the Arduino Library manager. Anyone who updates apparently gets ConfigurableFirmata v2.9.0, which obviously I've never published. This is a really bad bug on Arduino's part. I'll file an issue with Arduino. |
Update: bug filed: arduino/Arduino#5058 |
Suggestions? I guess I could delete the entire repo from Github. It's On Mon, 20 Jun 2016 20:42:57 -0700, Jeff Hoefs [email protected]
Using Opera's mail client: http://www.opera.com/mail/ |
According to the library manager FAQ a library can be unpublished by deleting the tag (so 2.9.0) in this case. However I'm not sure which version of your fork caused the issue, if it's the finson one or the finson-release one. Both have release tags. I think it's worth leaving things as is for another day or so hoping that we'll get a response from someone on the Arduino team tomorrow. That will enable them to inspect the current state. I assume the algorithm that identifies changes in libraries (via an update tag) is not properly factoring in the url of the repo (which would be a unique identifier). There may have been a point when your fork was tagged and in the library.properties file the name wasn't changed yet, then you later submitted a request to have your updated version of the renamed library added to the library manager and that started tracking and the Arduino hourly job picked up the tag somehow and made the unfortunate association based on tag and project name alone. That's my hunch at least. |
Jeff: If you think leaving it open for a day or two is okay for debugging I saw the "delete the tag" comment too, but you'll notice that the removal I requested that they add the repo in arduino/Arduino issue #5039. The Doug On Mon, 20 Jun 2016 22:06:58 -0700, Jeff Hoefs [email protected]
Using Opera's mail client: http://www.opera.com/mail/ |
Arduino Zero (SAMD architecture) defines an enum named |
@@ -0,0 +1,264 @@ | |||
/* |
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.
All of DeviceFirmata.cpp needs to be moved to DeviceFirmata.h or Luni and Bas64 will become hard dependencies of ConfigurableFirmata whether or not the user chooses to use DeviceFirmata.
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 comment became issue finson/issues/9 and was closed with the introduction of Optional Features.
This comment on global name space conflict became issue finson/Luni/issues/5. |
The changes in this pull request implement a new DeviceDriver feature for Configurable Firmata. In addition to these changes, there is a separate Arduino library named Luni, and a Javascript client library LuniJS. The repositories for these packages are available at finson-release.
There are specification documents in the Luni library repo that define the interface between Firmata and the device drivers.
The following drawing shows the relationship between the various classes and modules involved. This drawing is also available in the LuniJS repo.