Skip to content

Different One Wire devices mess up the search #1

@tlynchst

Description

@tlynchst

I have a board with multiple different one wire parts on the same bus. The driver here doesn't properly identify the DS2408. It just counts how many DS2408s are detected and then assumes that the first two found are the first two one wire devices that respond.

The for loop only gets looped through as many times as there are DS2408s detected, but if the DS2408 is the fourth one wire device to respond, it incorrectly saves the address for the first device.

From DS2408.cpp


uint8_t DS2408::find(Devices* devices) {
uint8_t count = 0;
Device device;
while(this->search(device)) {
if(device[0] == DS2408_FAMILY) {
Serial.println("Count!!");
count++;
}
}
this->reset_search();
delay(250);

*devices = (Devices) malloc(count*sizeof(Device));
for (int index = 0; index < count; index++)
    this->search((*devices)[index]);
return count;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions