Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onewire improvements #706

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

HattoriHanzo031
Copy link

@HattoriHanzo031 HattoriHanzo031 commented Oct 2, 2024

Some improvements to OneWire/DS18B20 driver.

Although external pull-up resistor for DS18B20 is recommended, internal pull-up is good enough in some cases (for example for single sensor on a short bus), so low level functions are changed to enable internal pull-up for high state.

While testing DS18B20 sensor without internal or external pull-up, I got panic because OneWire Search function "found" more than 32 devices and overflowed the array. To prevent this, the check is added to stop the search (and return an error) when more than 32 devices are found. Also, CRC check was added to prevent adding invalid devices during search.

Additionally PR contains suggestion for changing Crc8 method and in turn OneWireDevice interface (which is a breaking change) to be a bit more idiomatic Go. This is only a suggestion and I would like to get other opinions on it.

@HattoriHanzo031 HattoriHanzo031 changed the base branch from release to dev October 2, 2024 15:17
@HattoriHanzo031 HattoriHanzo031 marked this pull request as draft October 2, 2024 16:10
@HattoriHanzo031 HattoriHanzo031 marked this pull request as ready for review October 2, 2024 17:16
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