Skip to content

no version without query with Ethernet Firmata #280

Open
@jnsbyr

Description

@jnsbyr

Firmata.begin pushes the protocol and firmware version on the Stream regardless of its connected state. With USB powered devices using a serial host link this is no problem because booting Firmata and registering the USB driver on the host takes approximately the same time so the serial host typically receives the protocol and firmware versions without asking. With StandardFirmataEthernet this data gets lost because there is no connection when the data is written and you need to query the device explicitly for the versions.

At least with EthernetClient this can easily be amended by a simple change in the ino file by waiting for the initial connect:

void setup()
{
  ...
  // start up Network Firmata:
  while (!client.connected()) { // wait for connect to avoid loosing initial messages
    stream.flush(); 
  };  
  Firmata.begin(stream);
  systemResetCallback();  // reset to default config
}

This is a solution as long as the Firmata firmware has no custom code that needs to run regardless of the host connect.

Another way to do this would be a new "hostConnectedCallback" that could handle this regardless of the host connection type.

But with TCP Ethernet connections there is another aspect to consider: TCP connection can fail and can be reestablished completely independent of the Firmata device state. Some hosts would like to know if the Firmata device has been restarted or if the TCP connection has been reestablished. For this one could skip the automatic version transmit on reconnect or send a new telegram telling the host that this was just a reconnect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions