{"action":"closed","issue":{"url":"https://api.github.com/repos/firmata/arduino/issues/117","labels_url":"https://api.github.com/repos/firmata/arduino/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/firmata/arduino/issues/117/comments","events_url":"https://api.github.com/repos/firmata/arduino/issues/117/events","html_url":"https://github.com/firmata/arduino/issues/117","id":27735193,"number":117,"title":"getting feature configuration","user":{"login":"soundanalogous","id":401539,"avatar_url":"https://avatars.githubusercontent.com/u/401539?v=3","gravatar_id":"","url":"https://api.github.com/users/soundanalogous","html_url":"https://github.com/soundanalogous","followers_url":"https://api.github.com/users/soundanalogous/followers","following_url":"https://api.github.com/users/soundanalogous/following{/other_user}","gists_url":"https://api.github.com/users/soundanalogous/gists{/gist_id}","starred_url":"https://api.github.com/users/soundanalogous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soundanalogous/subscriptions","organizations_url":"https://api.github.com/users/soundanalogous/orgs","repos_url":"https://api.github.com/users/soundanalogous/repos","events_url":"https://api.github.com/users/soundanalogous/events{/privacy}","received_events_url":"https://api.github.com/users/soundanalogous/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/firmata/arduino/labels/configurable","name":"configurable","color":"bfd4f2"},{"url":"https://api.github.com/repos/firmata/arduino/labels/move%20to%20firmata/ConfigurableFirmata","name":"move to firmata/ConfigurableFirmata","color":"eb6420"},{"url":"https://api.github.com/repos/firmata/arduino/labels/protocol","name":"protocol","color":"DDDDDD"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2014-02-17T17:05:45Z","updated_at":"2015-10-07T06:12:47Z","closed_at":"2015-10-07T06:12:47Z","body":"Moving this discussion over from: https://github.com/firmata/arduino/pull/115#issuecomment-35299911\r\n\r\nHere is the current protocol for a pin state response:\r\n\r\n```\r\n/* pin state response\r\n * -------------------------------\r\n * 0  START_SYSEX (0xF0) (MIDI System Exclusive)\r\n * 1  pin state response (0x6E)\r\n * 2  pin (0 to 127)\r\n * 3  pin mode (the currently configured mode)\r\n * 4  pin state, bits 0-6\r\n * 5  (optional) pin state, bits 7-13\r\n * 6  (optional) pin state, bits 14-20\r\n ...  additional optional bytes, as many as needed\r\n * N  END_SYSEX (0xF7)\r\n */\r\n```\r\n\r\nIn the FirmataExt implementation I see we have currently limited the state value to 21bits but according to the protocol we can extend this if necessary.\r\n\r\nWe currently get the pin number and pin mode. This will identify a feature associated with a pin. The state value needs to maintain backwards compatibility with existing features (that already have it specified). I'm not sure we've even been handling state for some of the new features. So what I think you're saying is that each feature should define whatever it's 'state' value should be (and we can expand this to be a structure rather than a numeric value)\r\n\r\n```\r\npinNum bits 0 - 6\r\npinMode bits 0 - 6\r\nstate (multi-byte - length determined by feature)\r\n  state (compatibility with current protocol)\r\n  config data (optional - depends on feature)\r\n  etc\r\n```\r\n\r\nWe'd have to shift the thinking from pin specific to feature specific however. For example a stepper motor may have up to 4 pins connected, yet you specify the pin state query on only a single pin, but what a user is most likely interested in is the current step position value and what type of stepper driver is used (2 wire, 4 wire, step + direction). So a pin state query on any (or on a single?) stepper pin could return something like:\r\n\r\n```\r\npinNum\r\npinMode: STEPPER\r\nstate (32bit position data)\r\nconfig (0x00: 2 wire, 0x01: 4 wire, 0x02: step + dir)\r\n```\r\n  \r\nIs this in line with your thinking or am I overlooking something?"}}