feat(sensors): add 1-Wire (Dallas) temperature sensor support#2822
Open
drewmccal wants to merge 1 commit into
Open
feat(sensors): add 1-Wire (Dallas) temperature sensor support#2822drewmccal wants to merge 1 commit into
drewmccal wants to merge 1 commit into
Conversation
Add a portable 1-Wire bus driver to EnvironmentSensorManager covering the DallasTemperature-supported temperature families (DS18B20, DS18S20, DS1822, DS1825/MAX31850, DS28EA00). Each detected probe on the bus is registered as its own telemetry sub-channel, so multiple probes on one pin work without configuration. The driver gates on a 1-Wire presence pulse before engaging DallasTemperature, mirroring the I2C ACK check, so an absent bus pushes no telemetry entries. Boards opt in purely via build flags (ENV_INCLUDE_ONEWIRE + TELEM_ONEWIRE_PIN) with no source changes; the RAK4631 sensor env enables it on WB_IO1. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Closes #2692
Summary
Adds 1-Wire (Dallas) temperature sensor support to
EnvironmentSensorManager, so any board can report temperature telemetry from a DS18B20-family probe with no source changes — just two build flags.What's included
OneWireSensordriver (src/helpers/sensors/OneWireSensor.{cpp,h}) covering every DallasTemperature-supported temperature family:EnvironmentSensorManager::begin()via a dedicated 1-Wire registration pass. Each detected probe on the bus is enumerated and exposed as its own telemetry sub-channel, so multiple probes on one pin work without configuration.RAK_4631_sensorenv enables it as a reference (WB_IO1).How to enable on a board
Add to the board env's
build_flags:(plus the
paulstoffregen/OneWireandmilesburton/DallasTemperaturelib deps, added to the sharedlib_deps)Portability
No board-specific pins or
#ifdefs in the driver — the bus pin comes fromTELEM_ONEWIRE_PIN, and the whole module compiles out whenENV_INCLUDE_ONEWIREis unset. The same flags can be added to other server builds (e.g. the repeater), since they shareEnvironmentSensorManager.Testing
Tested and confirmed working on a RAK4631 on a WisBlock base board: a DS18B20 probe wired to
WB_IO1(DATA), 3V3, GND with a 4.7 kΩ pull-up. The probe is detected at boot and its temperature is reported as a telemetry channel, verified via the companion's Request Telemetry. Absent-bus and multi-probe enumeration paths both exercised.🤖 Generated with Claude Code