Skip to content

Commit

Permalink
Bug fix for SPI timeout handling
Browse files Browse the repository at this point in the history
SPI interface was not invalidated when the connection could be established again after a timeout
  • Loading branch information
chrishamm committed Dec 23, 2022
1 parent 3b5f0d9 commit dac9d0a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/DuetControlServer/SPI/DataTransfer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,17 @@ public static void PerformFullTransfer(bool connecting = false)
Logger.LogOutput(MessageType.Warning, "Incompatible firmware, please upgrade as soon as possible");
}

// Deal with timeouts
// Deal with timeouts and the first transmission
if (_hadTimeout)
{
Logger.LogOutput(MessageType.Success, "Connection to Duet established");
_hadTimeout = _resetting = false;
}

// Deal with the first transmission
if (!_connected)
else if (!_connected)
{
_lastTransferNumber = (ushort)(_rxHeader.SequenceNumber - 1);
_connected = true;
}
_connected = true;

// Transfer OK
_numMeasuredTransfers++;
Expand Down

0 comments on commit dac9d0a

Please sign in to comment.