Add - Sensor Settings#327
Conversation
lorennorman
left a comment
There was a problem hiding this comment.
this is great, very helpful to see how this will be used across many components
| "name": { | ||
| "description": "Machine-readable key sent to firmware.", | ||
| "type": "string", | ||
| "pattern": "^[a-z][a-z0-9_]*$" | ||
| }, |
There was a problem hiding this comment.
can name be made unique among the collection? or maybe that declaration goes on the collection and not here. (not a huge deal if that's gnarly to enforce)
There was a problem hiding this comment.
We could change it to settingName?
There was a problem hiding this comment.
you misunderstand, i'm talking about the value of name. like if a setting named "gain" is added twice to the settings array, that's legal json but an IO component settings error.
"settings": [
{ "name": "gain", ... },
{ "name": "gain", ... }
]
There was a problem hiding this comment.
gain wouldn't be set twice, though
There was a problem hiding this comment.
right, not in a perfect world. the point of the schema is to help us enforce a perfect world while allowing anyone/anything to modify the open source json files without us having to think about and catch these kinds of things.
There was a problem hiding this comment.
@lorennorman I've restructured settings as an object rather than a property to remove the duplicate key problem.. The spec. should still hold as the key is the setting's name and the value is the option's index.
This pull request allows users to select options such as gain, oversampling, measurement rate, power mode, etc. a new
settingsfield has been added to the device definition schema.Spec
PLZ see the Protobuf PR for the Specification ": adafruit/Wippersnapper_Protobuf#197
Schema and Definition Enhancements:
settingdefinition and a top-levelsettingsarray tocomponents/expanders/schema.json, specifying the structure for configurable device settings (e.g., name, display name, options, default) and ensuring validation across all supported components. [1] [2]Component Definition Updates:
Added
settingsto I2C sensor definitions:apds9999,bme280,bme680,bme688,bmp280,bmp388,bmp390,bmp580,bmp581,bmp585,ens160,ina219,ltr303,ltr329, andmax44009. Each device now exposes relevant configuration options for end-user selection. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Added
settingsto expander definitions:gainsetting to both theads1015andads1115expander definitions, allowing users to select the programmable gain amplifier setting. [1] [2]