arduino
arduino copied to clipboard
[v3.0.0] version callbacks
Here is the motivation behind the pull-request, as fleshed out below...
- Originally, the parser was built into FirmataClass which serves the host/server.
- There was no notion of a callback for version, ever; it was tightly coupled.
REPORT_VERSIONwas used to query the version from the host/server, and it would subsequently report the version usingREPORT_VERSION.- The fact that
REPORT_VERSIONis a single byte operation in the protocol documentation is wrong, because the version is actually reported using three bytes. - Therefore,
REPORT_VERSIONshould always send three bytes and the server/host should be smart enough realize it is being queried and discard them. - An alternate approach would be to create a single byte
QUERY_VERSIONused to explicitly query the version from the server/host
should follow a similar approach to REPORT_FIRMWARE
This causes some conflict with the node sample on the ESP8266. I don't know node all that well, so I'm not confident that I can debug it.
Does firmata-js use FirmataParser? I changed it's callback signature to do this, but I didn't change the FirmataClass API, so I'm not sure why this is messing things up...
firmata.js doesn't use FirmataParser at all. It simply parses based on the way Firmata.cpp used to do things.
I have to admit I'm starting to get lost in all of these callbacks.
Does this codepath still run in some form? https://github.com/firmata/arduino/blob/2.5.4/Firmata.cpp#L240.
And this? https://github.com/firmata/arduino/blob/2.5.4/Firmata.cpp#L369
To answer your previous question. Yes those code paths get executed, but in the static callbacks of FirmataClass.h.
https://github.com/firmata/arduino/blob/master/Firmata.h#L153 https://github.com/firmata/arduino/blob/master/Firmata.h#L154
I have rebased this branch on top of the recent FIRMWARE_VERSION update. Thus, resolving any obvious, or known, merge conflicts and making it more "cherry-pick"-able when v3.0.0 comes around.