Skip to content

Add - Sensor Settings#327

Open
brentru wants to merge 3 commits into
v2from
add/settings-v2
Open

Add - Sensor Settings#327
brentru wants to merge 3 commits into
v2from
add/settings-v2

Conversation

@brentru
Copy link
Copy Markdown
Member

@brentru brentru commented May 14, 2026

This pull request allows users to select options such as gain, oversampling, measurement rate, power mode, etc. a new settings field 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:

  • Schema update to support device settings:
    • Added a setting definition and a top-level settings array to components/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 settings to I2C sensor definitions:

    • Introduced device-specific settings (such as gain, oversampling, measurement rate, filter, mode, etc.) to the following sensor definition files: apds9999, bme280, bme680, bme688, bmp280, bmp388, bmp390, bmp580, bmp581, bmp585, ens160, ina219, ltr303, ltr329, and max44009. 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 settings to expander definitions:

    • Added a gain setting to both the ads1015 and ads1115 expander definitions, allowing users to select the programmable gain amplifier setting. [1] [2]

Copy link
Copy Markdown
Member

@lorennorman lorennorman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great, very helpful to see how this will be used across many components

Comment thread components/expanders/schema.json Outdated
Comment on lines +12 to +16
"name": {
"description": "Machine-readable key sent to firmware.",
"type": "string",
"pattern": "^[a-z][a-z0-9_]*$"
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could change it to settingName?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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", ... }
]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gain wouldn't be set twice, though

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Comment thread components/expanders/schema.json Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants