Skip to content

Add I2C sensor settings for backported v2 drivers#336

Closed
tyeth wants to merge 2 commits into
adafruit:v2from
tyeth:add/settings-backported-i2c
Closed

Add I2C sensor settings for backported v2 drivers#336
tyeth wants to merge 2 commits into
adafruit:v2from
tyeth:add/settings-backported-i2c

Conversation

@tyeth

@tyeth tyeth commented Jun 22, 2026

Copy link
Copy Markdown
Member

Overview

Adds settings blocks to the I2C components whose firmware drivers were backported with configurable options in Adafruit_Wippersnapper_Arduino#933 — the components-side counterpart to that work, in the same spirit as #327. Setting option order and default index match the firmware set* mapping / configureDefaults().

(Re-opened from a fork branch under the tyeth account because the schema change below is a staff-only file; supersedes the earlier #335.)

Schema change

Extends components/i2c/schema.json $defs/setting to a oneOf supporting two kinds of setting:

  • option-based (unchanged) — firmware receives the selected option's 0-based index.
  • numeric (new) — type of "int" or "float" with optional min/max/default/step/unit; firmware receives the entered value directly via ws.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 (Ω) and max_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

tyeth and others added 2 commits June 22, 2026 13:59
Adds index-based `settings` blocks (per the v2 settings schema, ref adafruit#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>
@tyeth

tyeth commented Jun 22, 2026

Copy link
Copy Markdown
Member Author

Superseded by #337, opened from an upstream branch so CI runs (fork PRs don't trigger the validation workflow).

@tyeth tyeth closed this Jun 22, 2026
@tyeth tyeth deleted the add/settings-backported-i2c branch June 22, 2026 13:44
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.

1 participant