Add one wire i2c bridge support#10078
Conversation
* Supports single readings on DS2484 * Supports readings on ch0 for DS2484_800 * Detection of variant for DS248X
* Always read temperature via ROM matching
|
@thebentern probably good to have a copilot check because the 8-channel bridge has up to 8 different addresses, which collide with quite a few of the already supported keyboards and all sort of other things. I added support for all of them, but maybe it finds a mistake. |
There was a problem hiding this comment.
Pull request overview
Adds firmware support for DS248x I2C-to-1-Wire bridges so DS18B20 temperature sensors can be reported via Environment Telemetry (single temperature reported for now, with DS2482-800 multi-channel scanning supported).
Changes:
- Introduces a new
DS248XSensortelemetry sensor implementation using Adafruit’s DS248x library. - Extends I2C scanning to detect DS248x devices (including address conflicts with other peripherals).
- Wires the new sensor into
EnvironmentTelemetryand adds the dependency inplatformio.ini.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/Telemetry/Sensor/DS248XSensor.h | New sensor header (DS248x/DS18B20 definitions and interface). |
| src/modules/Telemetry/Sensor/DS248XSensor.cpp | New sensor implementation: init, ROM discovery, and temperature reads. |
| src/modules/Telemetry/EnvironmentTelemetry.cpp | Registers DS248XSensor to be added after I2C scan. |
| src/detect/ScanI2CTwoWire.cpp | Adds DS248x detection logic to the I2C scanner in overlapping-address cases. |
| src/detect/ScanI2C.h | Adds DS248X to the DeviceType enum. |
| src/configuration.h | Adds DS248x address constants (0x18–0x1F) with conflict notes. |
| platformio.ini | Adds Adafruit_DS248x library dependency. |
|
@caveman99 since the multiple sensor protobuf option was merged, should I then support it here? |
Suggest keeping this one as is and add that in a new patch. This PR has already got a few different things going on |
Goes with meshtastic/protobufs#885
Adds support to DS248X I2C to one-wire temperature sensors like the DS18B20 (dallas/maxim/analog).
This PR supports a single sensor either via DS2482, or up to 8 sensors via DS2482-800, although currently there is no way for us to report more than one temperature (TBD potentially in 3.0).
For now, with this PR, we can report data on environment telemetry for the I2C to one-wire bridges. In the future, we could report up to 64 sensors (8 per DS2482-800, with 8 different addresses), although not worth the hassle - if we manage to make 8 sensors with one DS2482-800, that'd be quite amazing.
Tested this with both chips.
Example of DS2484-800 with two sensors connected (ch0 and ch1):
If we want to report all 8-channels already (although probably best to unify at 3.0), here is a PR for it: meshtastic/protobufs#886