diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-11-08 19:22:57 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-11-08 19:22:57 +0300 |
commit | ef70ae2a82e78a0662c22bf29e2d1f9a03f35703 (patch) | |
tree | 81ae897e91d8c1a1a5a36b455b37ae0e47140a70 | |
parent | 8b2a3a845ae62f15f64c5b1cf378b9a1f47d00d1 (diff) | |
parent | c4a74314d77e476c93be3ca5851ba274f5a486f4 (diff) |
Merge branch 'v3-chrishamm' into 3.4-dev
-rw-r--r-- | src/SBC/SbcInterface.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/SBC/SbcInterface.cpp b/src/SBC/SbcInterface.cpp index 2230d2ec..319e3c33 100644 --- a/src/SBC/SbcInterface.cpp +++ b/src/SBC/SbcInterface.cpp @@ -258,7 +258,7 @@ void SbcInterface::ExchangeData() noexcept // Make sure no existing codes are overwritten uint16_t bufferedCodeSize = sizeof(BufferedCodeHeader) + packet->length; if ((txEnd == 0 && bufferedCodeSize > max<uint16_t>(rxPointer, SpiCodeBufferSize - txPointer)) || - (txEnd != 0 && bufferedCodeSize > rxPointer - txPointer)) + (txEnd != 0 && bufferedCodeSize > rxPointer - txPointer)) { #if false // This isn't enabled because the debug call plus critical section would lead to software resets @@ -968,6 +968,7 @@ void SbcInterface::ExchangeData() noexcept break; default: + fileOperationPending = false; REPORT_INTERNAL_ERROR; break; } @@ -1160,6 +1161,7 @@ void SbcInterface::InvalidateResources() noexcept if (fileOperation != FileOperation::none) { + fileOperationPending = false; fileOperation = FileOperation::none; fileSemaphore.Give(); } @@ -1648,6 +1650,12 @@ void SbcInterface::HandleGCodeReply(MessageType mt, OutputBuffer *buffer) noexce // This method returns true on success and false if an error occurred (e.g. file not found) bool SbcInterface::GetFileChunk(const char *filename, uint32_t offset, char *buffer, uint32_t& bufferLength, uint32_t& fileLength) noexcept { + // Don't do anything if the SBC is not connected + if (!IsConnected()) + { + return false; + } + if (waitingForFileChunk) { reprap.GetPlatform().Message(ErrorMessage, "Trying to request a file chunk from two independent tasks\n"); |