arduino icon indicating copy to clipboard operation
arduino copied to clipboard

[v3.0.0] version callbacks

Open zfields opened this issue 8 years ago • 5 comments

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_VERSION was used to query the version from the host/server, and it would subsequently report the version using REPORT_VERSION.
  • The fact that REPORT_VERSION is a single byte operation in the protocol documentation is wrong, because the version is actually reported using three bytes.
  • Therefore, REPORT_VERSION should 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_VERSION used to explicitly query the version from the server/host

should follow a similar approach to REPORT_FIRMWARE

zfields avatar Mar 12 '17 21:03 zfields

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...

zfields avatar Mar 12 '17 21:03 zfields

firmata.js doesn't use FirmataParser at all. It simply parses based on the way Firmata.cpp used to do things.

soundanalogous avatar Mar 13 '17 00:03 soundanalogous

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

soundanalogous avatar Mar 13 '17 01:03 soundanalogous

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

zfields avatar Mar 13 '17 04:03 zfields

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.

zfields avatar Mar 15 '17 02:03 zfields