one-wire: a lost echo and a dead line are not the same report
The blind-write path said "lost to the device's ack" for any missing echo, and the count is what distinguishes two different faults. Some bytes lost is the device's ack winning the line against the host's series resistor — ordinary, and what the knock retry absorbs. *Every* byte lost is nothing coming back at all, which means the line is not free: a pin held low, a wedge, or an RX that is not on it. Found pointing the wrong way on purpose-built hardware. This rig's LED demo ends by driving every port pin low, and one of them is the shared link — so a knock into a finished demo got no echo whatsoever and was told the device had acked, when nothing had answered and nothing could. Same retry either way, but blaming an ack that never happened sends the reader to the protocol when the answer is a pin. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -497,8 +497,20 @@ class OneWirePort:
|
||||
raise Error(f"one-wire echo missing after {len(data) - len(remaining)} of "
|
||||
f"{len(data)} byte(s) — is the adapter's RX tied to the line?")
|
||||
self.lost_echoes += len(remaining)
|
||||
verbose(f"one-wire: {len(remaining)} of {len(data)} knock byte(s) lost to the "
|
||||
f"device's ack; retrying")
|
||||
# Which loss this is matters, and the count says it. *Some* bytes lost is
|
||||
# the device's ack winning the line against the host's series resistor —
|
||||
# ordinary, and what the retry absorbs. *Every* byte lost is nothing
|
||||
# coming back at all, which is a line that is not free: an application
|
||||
# holding the shared pin low (this rig's LED demo ends that way), a
|
||||
# wedge, or an RX that is not on the line. Same retry either way, but
|
||||
# blaming an ack that never happened sends the reader to the wrong place.
|
||||
if len(remaining) == len(data):
|
||||
verbose(f"one-wire: none of {len(data)} byte(s) echoed — the line is not "
|
||||
f"coming back. Held low by something? (a pin driven low, a wedge, "
|
||||
f"or an RX not on the line)")
|
||||
else:
|
||||
verbose(f"one-wire: {len(remaining)} of {len(data)} knock byte(s) lost to the "
|
||||
f"device's ack; retrying")
|
||||
|
||||
def write_blind(self, data):
|
||||
self.write(data, blind=True)
|
||||
|
||||
Reference in New Issue
Block a user