Skip to content

add a way to query supported features and version #41

@soundanalogous

Description

@soundanalogous

We currently have the capability query to return pin-based capabilities that sorta serves this function. An improvement however would be to add a separate query that returns the features supported by the firmware. This would open up the ability to version features separately.

Of the existing pin modes, I'd consider the following as "features" since they require multiple pins in some cases and/or represent a feature that is not integral to the microcontroller HW:

  • SERVO
  • I2C
  • ONEWIRE
  • STEPPER
  • ENCODER
  • MODE_SERIAL
  • SHIFT (even though it has never been implemented)

And the following as "pin modes" since the represent supported modes of a given pin:

  • INPUT
  • MODE_INPUT_PULLUP (new)
  • OUTPUT
  • ANALOG
  • PWM

Adding the ability to version features separately would enable updating features without requiring a bump to the protocol version. For example if the Firmata I2C implementation needed to change in a backwards compatible way (to support multiple I2C ports for example). Otherwise the protocol major version would need to be incremented each time a feature is changed in a non-backwards compatible way. It would also enable adding new features that are sysex-based without needing to update the protocol version since the new features would report their own versions. This creates a separation from the higher level Firmata core protocol and the extended feature-level protocols.

A major change (Firmata 3.0) would be to create a separation between "pin modes" and "features". But even before 3.0 it would be possible to start reporting Features and their versions separately via a new feature query. This also enables versioning of features without needing to add anything new (to query version) to existing implementation of existing features.

Here's an initial proposal:

0  START_SYSEX                (0xF0)
1  REPORT_FEATURES            (0x62)
2  1st FEATURE_ID LSB         either a "pin mode" or the subcommand byte
3  1st FEATURE_ID MSB         use 2 bytes to ensure scalability
4  1st FEATURE_MAJOR_VERSION  (0-127)
5  1st FEATURE_MINOR_VERSION  (0-127)
6  2nd FEATURE_ID LSB
7  2nd FEATURE_ID MSB
8  2nd FEATURE_MAJOR_VERSION  (0-127)
9  2nd FEATURE_MINOR_VERSION  (0-127)
... for all supported features
n  END_SYSEX                  (0xF7)

For StandardFirmata this would return the following features:

  • SERVO
  • I2C

For StandardFirmataPlus it would return the following features:

  • SERVO
  • I2C
  • MODE_SERIAL

For ConfigurableFIrmata it could return any variation, same for other "firmatas".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions