diff options
Diffstat (limited to 'src/Linux/LinuxInterface.cpp')
-rw-r--r-- | src/Linux/LinuxInterface.cpp | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/src/Linux/LinuxInterface.cpp b/src/Linux/LinuxInterface.cpp index 3535b60c..25c6e8c7 100644 --- a/src/Linux/LinuxInterface.cpp +++ b/src/Linux/LinuxInterface.cpp @@ -419,37 +419,34 @@ void LinuxInterface::Spin() } wasConnected = true; } - else if (!transfer->IsConnected()) + else if (!transfer->IsConnected() && wasConnected) { - if (wasConnected) - { - reprap.GetPlatform().Message(NetworkInfoMessage, "Lost connection to Linux\n"); + reprap.GetPlatform().Message(NetworkInfoMessage, "Lost connection to Linux\n"); - wasConnected = false; - numDisconnects++; + wasConnected = false; + numDisconnects++; - rxPointer = txPointer = txLength = 0; - sendBufferUpdate = true; - iapWritePointer = IAP_IMAGE_START; + rxPointer = txPointer = txLength = 0; + sendBufferUpdate = true; + iapWritePointer = IAP_IMAGE_START; - if (!requestedFileName.IsEmpty()) - { - requestedFileDataLength = -1; - requestedFileSemaphore.Give(); - } + if (!requestedFileName.IsEmpty()) + { + requestedFileDataLength = -1; + requestedFileSemaphore.Give(); + } - // Don't cache any messages if they cannot be sent - gcodeReply->ReleaseAll(); + // Don't cache any messages if they cannot be sent + gcodeReply->ReleaseAll(); - // Close all open G-code files - for (size_t i = 0; i < NumGCodeChannels; i++) - { - GCodeBuffer *gb = reprap.GetGCodes().GetGCodeBuffer((GCodeChannel)i); - gb->AbortFile(true, false); - gb->MessageAcknowledged(true); - } - reprap.GetGCodes().StopPrint(StopPrintReason::abort); + // Close all open G-code files + for (size_t i = 0; i < NumGCodeChannels; i++) + { + GCodeBuffer *gb = reprap.GetGCodes().GetGCodeBuffer((GCodeChannel)i); + gb->AbortFile(true, false); + gb->MessageAcknowledged(true); } + reprap.GetGCodes().StopPrint(StopPrintReason::abort); // Invalidate the G-code buffers holding binary data (if applicable) for (size_t i = 0; i < NumGCodeChannels; i++) |