-
Notifications
You must be signed in to change notification settings - Fork 151
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
add a way to query supported features and version #41
Comments
related discussion in #40 |
Since DeviceFirmata should take care of most devices, the FEATURE ID can be shortened to a single byte:
I'm not sure yet if all features should be reported (including AnalogInput, DigitalInput, DigitalOutput, etc), or only optional-features and contributed features. The reason to exclude some core features is they will continue to be reported by the capability query, whereas features such as OneWire, Stepper, etc would no longer need to be reported by the capability query. The capability query would be reserved for reporting pin-specific capabilities. I'm not sure yet if that would still included features such as I2C and Serial that utilize multiple pins. It would probably be better to query those pins via a function of the respective feature. |
Probably still worth allocating 2 bytes for the ID to ensure scalability:
Bugfix version not necessary since it doesn't change anything about the API and we need to save some bytes here. Tempted to limit feature versioning to a single byte rather than semver, but then it gets tricky to track impact of change. |
Another approach for versioning would be to use a single value for the version to be incremented for any backwards compatible change. If a non backwards compatible change is introduced, a new FEATURE_ID should be allocated for the feature. That would ensure that no exiting Firmata client APIs would break. In this approach the single value would essentially be the minor version. The major version would increment for each new FEATURE_ID and a bugfix version could be tracked if necessary, it just wouldn't be reported. |
Rereading the sysex documentation from a midi spec book, it states that first byte in a System Exclusive message should be the ID. This was for the initial set of manufacturer IDs (1 - 127). If the ID is 0, then the next two bytes are used as extensions to the manufacturer ID (0 - 16383). So this is another approach and perhaps makes the most sense since it was the original intent and some midi parsers may even expect this structure. It could also be a way to help keep the feature report short since an ID of 0 would indicate that 2 additional ID bytes should follow, otherwise assume only a 1 byte ID. The general sysex message structure would then look like this and could be the model for all future Firmata features that use sysex:
This is how the REPORT_FEATURES reply would look, note that because 0 signals extended ID we only need a single byte for the ID if the value is > 0.
|
Final draft: REPORT_FEATURES_QUERY
REPORT_FEATURES_RESPONSE
|
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:
And the following as "pin modes" since the represent supported modes of a given pin:
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:
For StandardFirmata this would return the following features:
For StandardFirmataPlus it would return the following features:
For ConfigurableFIrmata it could return any variation, same for other "firmatas".
The text was updated successfully, but these errors were encountered: