Add I2C sensor settings for backported v2 drivers#337
Open
tyeth wants to merge 4 commits into
Open
Conversation
Adds index-based `settings` blocks (per the v2 settings schema, ref #327) to the I2C components whose firmware drivers were backported with configurable options in Adafruit_Wippersnapper_Arduino. Each setting's option order and default index matches the firmware driver's set* mapping / configureDefaults(). Components updated: ina260, ina237, ina238, ina228, lps28dfw, spa06_003, htu31d, hdc302x, as7331, as5600, mlx90632b, mlx90632d_med, mlx90632d_ext, vcnl4200, vcnl4030. Notes: - The settings model is index-into-options only, so continuous/physical calibration values (INA shunt resistance & max current; AS5600 zero/max angle positions) are intentionally not surfaced here. - SPA06-003 exposes the 1-128 Hz output-data-rate subset. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extends the i2c settings schema to support numeric (direct-value) settings
alongside the existing option-index settings, via a `oneOf`. A numeric setting
declares `type` ("int" or "float") with optional min/max/default/step/unit, and
firmware receives the entered value directly (ws.config.Value int/float) rather
than an option index.
Uses it for the continuous/physical values that don't fit an option list:
- sea_level_pressure (hPa) on the BMP/BME altitude components (bme280, bme680,
bme688, bmp280, bmp388, bmp390, bmp580, bmp581, bmp585).
- shunt_resistance (Ω) and max_current (A) on ina237, ina238, ina228.
- z_position, m_position, max_angle (raw 12-bit) on as5600.
Firmware counterpart: adafruit/Adafruit_Wippersnapper_Arduino#933.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The HDC302x driver disables auto-mode and does a single-shot read per the user's chosen polling period (like most sensors), so the per-read trigger mode is not user-configurable. Keep only the heater setting. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The "List All Changed Files" step always diffed against origin/main, so PRs targeting v2 swept every v2-vs-main difference (.gitignore, etc.) into the filename validation and flagged them spuriously. Diff against v2 when the PR targets v2; otherwise diff against main (unchanged for main and workflow_dispatch). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds
settingsblocks to the I2C components whose firmware drivers were backported with configurable options in Adafruit_Wippersnapper_Arduino#933 — the components-side counterpart, in the same spirit as #327. Setting option order and default index match the firmwareset*mapping /configureDefaults().Schema change
Extends
components/i2c/schema.json$defs/settingto aoneOfsupporting two kinds of setting:typeof"int"or"float"with optionalmin/max/default/step/unit; firmware receives the entered value directly viaws.config.Value(int/float), not an index.Option settings added
ina260, ina237/238/228, lps28dfw, spa06_003, htu31d, hdc302x, as7331, as5600, mlx90632b/d_med/d_ext, vcnl4200/4030 — gains, integration/conversion times, modes, oversampling, rates, resolutions, etc.
Numeric settings added (new type)
sea_level_pressure(hPa) on the BMP/BME altitude components: bme280, bme680, bme688, bmp280, bmp388, bmp390, bmp580, bmp581, bmp585.shunt_resistance(Ω) andmax_current(A) on ina237, ina238, ina228.z_position,m_position,max_angle(raw 12-bit) on as5600.All 94 i2c definitions validate against the updated schema.
🤖 Generated with Claude Code