diff options
author | Christian Hammacher <bmasterc@gmail.com> | 2021-08-23 18:00:25 +0300 |
---|---|---|
committer | Christian Hammacher <bmasterc@gmail.com> | 2021-08-23 18:00:25 +0300 |
commit | 59d8d5b76922cf2dc3ed20ba90034dc1a312070a (patch) | |
tree | 58b4f5e32d40fcefd2c374ae0c57243177606de9 /src/Linux | |
parent | 0f9331e76c5c4ed1ce49394c5bd741a00c46f359 (diff) |
Work towards v3.4-b3
M955 outputs the configuration only if requested
Minor refactoring in the Linux interface files
Bug fix: M918 didn't update the boards seq number
Bug fix: RRF could leave "starting" mode too early
Diffstat (limited to 'src/Linux')
-rw-r--r-- | src/Linux/LinuxInterface.cpp | 31 | ||||
-rw-r--r-- | src/Linux/LinuxInterface.h | 14 | ||||
-rw-r--r-- | src/Linux/LinuxMessageFormats.h | 2 |
3 files changed, 22 insertions, 25 deletions
diff --git a/src/Linux/LinuxInterface.cpp b/src/Linux/LinuxInterface.cpp index 39eb7880..d1c442e1 100644 --- a/src/Linux/LinuxInterface.cpp +++ b/src/Linux/LinuxInterface.cpp @@ -50,7 +50,7 @@ extern "C" [[noreturn]] void SBCTaskStart(void * pvParameters) noexcept LinuxInterface::LinuxInterface() noexcept : isConnected(false), numDisconnects(0), numTimeouts(0), maxDelayBetweenTransfers(SpiTransferDelay), numMaxEvents(SpiEventsRequired), delaying(false), numEvents(0), - reportPause(false), reportPauseWritten(false), printStopped(false), + reportPause(false), reportPauseWritten(false), printAborted(false), codeBuffer(nullptr), rxPointer(0), txPointer(0), txEnd(0), sendBufferUpdate(true), iapWritePointer(IAP_IMAGE_START), waitingForFileChunk(false), fileMutex(), fileSemaphore(), fileOperation(FileOperation::none), fileOperationPending(false) #ifdef TRACK_FILE_CODES @@ -292,7 +292,13 @@ void LinuxInterface::Spin() noexcept case LinuxRequest::PrintStopped: { const PrintStoppedReason reason = transfer.ReadPrintStoppedInfo(); - if (reason == PrintStoppedReason::normalCompletion) + if (reason == PrintStoppedReason::abort) + { + // Stop the print with the given reason + printAborted = true; + InvalidateBufferedCodes(GCodeChannel::File); + } + else { // Just mark the print file as finished GCodeBuffer * const gb = reprap.GetGCodes().GetGCodeBuffer(GCodeChannel::File); @@ -306,13 +312,6 @@ void LinuxInterface::Spin() noexcept packetAcknowledged = false; } } - else - { - // Stop the print with the given reason - printStopReason = (StopPrintReason)reason; - printStopped = true; - InvalidateBufferChannel(GCodeChannel::File); - } break; } @@ -612,8 +611,8 @@ void LinuxInterface::Spin() noexcept break; } - // All the files have been aborted on the given channel - case LinuxRequest::FilesAborted: + // Invalidate all files and codes on a given channel + case LinuxRequest::InvalidateChannel: { const GCodeChannel channel = transfer.ReadCodeChannel(); if (channel.IsValid()) @@ -629,6 +628,7 @@ void LinuxInterface::Spin() noexcept { // Note that we do not call StopPrint here or set any other variables; DSF already does that gb->AbortFile(true, false); + InvalidateBufferedCodes(channel); } else { @@ -989,7 +989,7 @@ void LinuxInterface::Spin() noexcept // Invalidate buffered codes if required if (gb->IsInvalidated()) { - InvalidateBufferChannel(gb->GetChannel()); + InvalidateBufferedCodes(gb->GetChannel()); gb->Invalidate(false); } @@ -1146,9 +1146,8 @@ void LinuxInterface::Spin() noexcept gb->MessageAcknowledged(true); } - // Stop the print (if applicable) - printStopReason = StopPrintReason::abort; - printStopped = true; + // Abort the print (if applicable) + printAborted = true; // Turn off all the heaters reprap.GetHeat().SwitchOffAll(true); @@ -1675,7 +1674,7 @@ void LinuxInterface::EventOccurred(bool timeCritical) noexcept } } -void LinuxInterface::InvalidateBufferChannel(GCodeChannel channel) noexcept +void LinuxInterface::InvalidateBufferedCodes(GCodeChannel channel) noexcept { TaskCriticalSectionLocker locker; if (rxPointer != txPointer || txEnd != 0) diff --git a/src/Linux/LinuxInterface.h b/src/Linux/LinuxInterface.h index 43b179db..62c5ff69 100644 --- a/src/Linux/LinuxInterface.h +++ b/src/Linux/LinuxInterface.h @@ -46,8 +46,7 @@ public: void EventOccurred(bool timeCritical = false) noexcept; // Called when a new event has happened. It can optionally start off a new transfer immediately GCodeResult HandleM576(GCodeBuffer& gb, const StringRef& reply) noexcept; // Set the SPI communication parameters - bool HasPrintStopped(); - StopPrintReason GetPrintStopReason() const { return printStopReason; } + bool IsPrintAborted() noexcept; // Check if the current print has been aborted bool FillBuffer(GCodeBuffer &gb) noexcept; // Try to fill up the G-code buffer with the next available G-code void SetPauseReason(FilePosition position, PrintPausedReason reason) noexcept; // Set parameters for the next pause request @@ -80,8 +79,7 @@ private: GCodeFileInfo fileInfo; FilePosition pauseFilePosition; PrintPausedReason pauseReason; - bool reportPause, reportPauseWritten, printStopped; - StopPrintReason printStopReason; + bool reportPause, reportPauseWritten, printAborted; char *codeBuffer; volatile uint16_t rxPointer, txPointer, txEnd; @@ -135,7 +133,7 @@ private: volatile size_t fileCodesRead, fileCodesHandled, fileMacrosRunning, fileMacrosClosing; #endif - void InvalidateBufferChannel(GCodeChannel channel) noexcept; // Invalidate every buffered G-code of the corresponding channel from the buffer ring + void InvalidateBufferedCodes(GCodeChannel channel) noexcept; // Invalidate every buffered G-code of the corresponding channel from the buffer ring }; inline void LinuxInterface::SetPauseReason(FilePosition position, PrintPausedReason reason) noexcept @@ -151,12 +149,12 @@ inline void LinuxInterface::ReportPause() noexcept reportPause = true; } -inline bool LinuxInterface::HasPrintStopped() +inline bool LinuxInterface::IsPrintAborted() noexcept { TaskCriticalSectionLocker locker; - if (printStopped) + if (printAborted) { - printStopped = false; + printAborted = false; return true; } return false; diff --git a/src/Linux/LinuxMessageFormats.h b/src/Linux/LinuxMessageFormats.h index 82c645bf..598f7624 100644 --- a/src/Linux/LinuxMessageFormats.h +++ b/src/Linux/LinuxMessageFormats.h @@ -263,7 +263,7 @@ enum class LinuxRequest : uint16_t EvaluateExpression = 16, // Evaluate an arbitrary expression Message = 17, // Send an arbitrary message MacroStarted = 18, // Macro file has been started - FilesAborted = 19, // All files on the given channel have been aborted by DSF + InvalidateChannel = 19, // Invalidate all files and codes on a given channel SetVariable = 20, // Assign a variable (global, set, var) DeleteLocalVariable = 21, // Delete an existing local variable at the end of a code block CheckFileExistsResult = 22, // Result of a request to check if a given file exists |