From 785440a125bc72e8c461cfd5bcd8a867f6c274b2 Mon Sep 17 00:00:00 2001 From: David Crocker Date: Fri, 30 Aug 2024 12:48:46 +0100 Subject: [PATCH 1/8] Don't flash ACT LED when we receive a fans or filament monitor report --- src/CAN/CommandProcessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CAN/CommandProcessor.cpp b/src/CAN/CommandProcessor.cpp index 30eb1928f8..8cf8a4eea1 100644 --- a/src/CAN/CommandProcessor.cpp +++ b/src/CAN/CommandProcessor.cpp @@ -436,10 +436,11 @@ void CommandProcessor::ProcessReceivedMessage(CanMessageBuffer *buf) noexcept if (buf->id.Src() != CanInterface::GetCanAddress()) // I don't think we should receive our own broadcasts, but in case we do... { if ( buf->id.Dst() != CanId::BroadcastAddress - && buf->id.MsgType() != CanMessageType::fanTachoReport // don't flash whenever we receive a regular status message + && buf->id.MsgType() != CanMessageType::fansReport // don't flash whenever we receive a regular status message && buf->id.MsgType() != CanMessageType::heatersStatusReport && buf->id.MsgType() != CanMessageType::boardStatusReport && buf->id.MsgType() != CanMessageType::driversStatusReport + && buf->id.MsgType() != CanMessageType::filamentMonitorsStatusReportNew ) { reprap.GetPlatform().OnProcessingCanMessage(); From 271e3adeef4e7fa067b35308a6260aba0de09078 Mon Sep 17 00:00:00 2001 From: Christian Hammacher Date: Thu, 5 Sep 2024 21:24:33 +0200 Subject: [PATCH 2/8] Bug fix for release workflows --- .github/workflows/prerelease.yml | 4 +++- .github/workflows/release.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 4544977779..541296fb3d 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -2,10 +2,12 @@ name: Upload prerelease assets on: release: - types: [prereleased] + types: + - published jobs: build: + if: "github.event.release.prerelease" runs-on: ubuntu-22.04 steps: # Download release assets diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b6076e344..3240bcddbc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,10 +2,12 @@ name: Upload release assets on: release: - types: [released] + types: + - published jobs: build: + if: "!github.event.release.prerelease" runs-on: ubuntu-22.04 steps: # Download release assets From 9899b5b712df3f93d24b5a8dd629c5785ddf88dc Mon Sep 17 00:00:00 2001 From: AndyEveritt <38423143+AndyEveritt@users.noreply.github.com> Date: Thu, 12 Sep 2024 10:24:49 +0100 Subject: [PATCH 3/8] Fix typo in M569.7 causing error when using mainboard as expansion board --- src/Platform/Platform.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index c5b3bf7eed..43b6a3f215 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -5326,7 +5326,7 @@ GCodeResult Platform::EutProcessM569Point7(const CanMessageGeneric& msg, const S parser.GetStringParam('C', portName.GetRef()); //TODO use the following instead when we track the enable state of each driver individually //if (!brakePorts[drive].AssignPort(portName.c_str(), reply, PinUsedBy::gpout, (driverDisabled[drive]) ? PinAccess::write0 : PinAccess::write1)) ... - if (brakePorts[drive].AssignPort(portName.c_str(), reply, PinUsedBy::gpout, PinAccess::write0)) + if (!brakePorts[drive].AssignPort(portName.c_str(), reply, PinUsedBy::gpout, PinAccess::write0)) { return GCodeResult::error; } From 35ef7be384a24b35dddb89dab314d2c004795275 Mon Sep 17 00:00:00 2001 From: AndyEveritt <38423143+AndyEveritt@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:47:53 +0100 Subject: [PATCH 4/8] process G17-19 & G68-69 in simulation mode --- src/GCodes/GCodes2.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index b9c7c74326..a54d2a1484 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -164,7 +164,13 @@ bool GCodes::HandleGcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx } GCodeResult result = GCodeResult::ok; - if (IsSimulating() && code > 4 && code != 10 && code != 11 && code != 20 && code != 21 && (code < 53 || code > 59) && (code < 90 || code > 94)) + if (IsSimulating() && code > 4 // move & dwell + && code != 10 && code != 11 // (un)retract + && code != 17 && code != 18 && code != 19 // selected plane for arc moves + && code != 68 && code != 69 // coordinate rotation + && code != 20 && code != 21 // change units + && (code < 53 || code > 59) // coordinate system + && (code < 90 || code > 94)) // positioning & feedrate modes { HandleReply(gb, result, ""); return true; // we only simulate some gcodes From 0d061414ae5e645babcce78ef99267878e766c7e Mon Sep 17 00:00:00 2001 From: AndyEveritt <38423143+AndyEveritt@users.noreply.github.com> Date: Fri, 13 Sep 2024 18:07:44 +0100 Subject: [PATCH 5/8] `M584 S` defaults to `R` if not provided --- src/GCodes/GCodes3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GCodes/GCodes3.cpp b/src/GCodes/GCodes3.cpp index f4c4fa716a..881997662a 100644 --- a/src/GCodes/GCodes3.cpp +++ b/src/GCodes/GCodes3.cpp @@ -505,7 +505,7 @@ GCodeResult GCodes::DoDriveMapping(GCodeBuffer& gb, const StringRef& reply) THRO const AxisWrapType wrapType = (newAxesType != AxisWrapType::undefined) ? newAxesType : (c >= 'A' && c <= 'D') ? AxisWrapType::wrapAt360 // default A thru D to rotational but not continuous : AxisWrapType::noWrap; // default other axes to linear - const bool isNistRotational = (seenS) ? newAxesAreNistRotational : (c >= 'A' && c <= 'D'); + const bool isNistRotational = (seenS) ? newAxesAreNistRotational : wrapType != AxisWrapType::noWrap; platform.SetAxisType(drive, wrapType, isNistRotational); ++numTotalAxes; if (numTotalAxes + numExtruders > MaxAxesPlusExtruders) From 3261dd97a9346f60a8d09c7cffd6b4d657400001 Mon Sep 17 00:00:00 2001 From: Christian Hammacher Date: Fri, 13 Sep 2024 00:51:44 +0200 Subject: [PATCH 6/8] Hopefully fixed race condition at the end of macros --- src/GCodes/GCodeBuffer/BinaryParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GCodes/GCodeBuffer/BinaryParser.cpp b/src/GCodes/GCodeBuffer/BinaryParser.cpp index 5381b427d6..fd9240529c 100644 --- a/src/GCodes/GCodeBuffer/BinaryParser.cpp +++ b/src/GCodes/GCodeBuffer/BinaryParser.cpp @@ -597,7 +597,7 @@ void BinaryParser::SetFinished() noexcept FilePosition BinaryParser::GetFilePosition() const noexcept { - return ((header->flags & CodeFlags::HasFilePosition) != 0) ? header->filePosition : noFilePosition; + return ((header->flags & CodeFlags::HasFilePosition) != 0 && !gb.IsMacroFileClosed() && !gb.macroJustFinished) ? header->filePosition : noFilePosition; } const char* BinaryParser::DataStart() const noexcept From fa5018b0215031a86ab4d5ce071afe0332b106ad Mon Sep 17 00:00:00 2001 From: Christian Hammacher Date: Fri, 13 Sep 2024 11:08:53 +0200 Subject: [PATCH 7/8] Code cleanup Improved previous fix --- src/GCodes/GCodeBuffer/BinaryParser.cpp | 17 +++++++++++++++-- src/GCodes/GCodeBuffer/BinaryParser.h | 3 ++- src/GCodes/GCodeBuffer/GCodeBuffer.cpp | 22 +++++++++++++--------- src/GCodes/GCodeBuffer/GCodeBuffer.h | 5 ++--- src/GCodes/GCodes.cpp | 2 +- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/GCodes/GCodeBuffer/BinaryParser.cpp b/src/GCodes/GCodeBuffer/BinaryParser.cpp index fd9240529c..cc35964ab3 100644 --- a/src/GCodes/GCodeBuffer/BinaryParser.cpp +++ b/src/GCodes/GCodeBuffer/BinaryParser.cpp @@ -18,7 +18,7 @@ BinaryParser::BinaryParser(GCodeBuffer& gcodeBuffer) noexcept : gb(gcodeBuffer) { - header = reinterpret_cast(gcodeBuffer.buffer); + header = reinterpret_cast(gcodeBuffer.buffer); } void BinaryParser::Init() noexcept @@ -597,7 +597,20 @@ void BinaryParser::SetFinished() noexcept FilePosition BinaryParser::GetFilePosition() const noexcept { - return ((header->flags & CodeFlags::HasFilePosition) != 0 && !gb.IsMacroFileClosed() && !gb.macroJustFinished) ? header->filePosition : noFilePosition; + return ((header->flags & CodeFlags::HasFilePosition) != 0) ? header->filePosition : noFilePosition; +} + +void BinaryParser::SetFilePosition(FilePosition fpos) noexcept +{ + if (fpos == noFilePosition) + { + header->flags = (CodeFlags)(header->flags & ~CodeFlags::HasFilePosition); + } + else + { + header->filePosition = fpos; + header->flags = (CodeFlags)(header->flags | CodeFlags::HasFilePosition); + } } const char* BinaryParser::DataStart() const noexcept diff --git a/src/GCodes/GCodeBuffer/BinaryParser.h b/src/GCodes/GCodeBuffer/BinaryParser.h index b465dbe3cc..ec5edde01b 100644 --- a/src/GCodes/GCodeBuffer/BinaryParser.h +++ b/src/GCodes/GCodeBuffer/BinaryParser.h @@ -55,6 +55,7 @@ class BinaryParser void SetFinished() noexcept; // Set the G Code finished FilePosition GetFilePosition() const noexcept; // Get the file position at the start of the current command + void SetFilePosition(FilePosition fpos) noexcept; // Overwrite the file position, e.g. when a macro finishes const char* DataStart() const noexcept; // Get the start of the current command size_t DataLength() const noexcept; // Get the length of the current command @@ -78,7 +79,7 @@ class BinaryParser void WriteParameters(const StringRef& s, bool quoteStrings) const noexcept; size_t bufferLength; - const CodeHeader *header; + CodeHeader *header; int reducedBytesRead; ParameterLettersBitmap parametersPresent; diff --git a/src/GCodes/GCodeBuffer/GCodeBuffer.cpp b/src/GCodes/GCodeBuffer/GCodeBuffer.cpp index c1bed7a2c5..2d48267d2f 100644 --- a/src/GCodes/GCodeBuffer/GCodeBuffer.cpp +++ b/src/GCodes/GCodeBuffer/GCodeBuffer.cpp @@ -142,7 +142,7 @@ void GCodeBuffer::Reset() noexcept isBinaryBuffer = false; requestedMacroFile.Clear(); isWaitingForMacro = macroFileClosed = false; - macroJustStarted = macroJustFinished = macroFileError = macroFileEmpty = abortFile = abortAllFiles = sendToSbc = messagePromptPending = messageAcknowledged = false; + macroJustStarted = macroFileError = macroFileEmpty = abortFile = abortAllFiles = sendToSbc = messagePromptPending = messageAcknowledged = false; machineState->lastCodeFromSbc = machineState->macroStartedByCode = false; #endif cancelWait = false; @@ -298,7 +298,7 @@ void GCodeBuffer::PutBinary(const uint32_t *data, size_t len) noexcept { machineState->lastCodeFromSbc = true; isBinaryBuffer = true; - macroJustStarted = macroJustFinished = false; + macroJustStarted = false; binaryParser.Put(data, len); } @@ -1187,8 +1187,15 @@ void GCodeBuffer::MacroFileClosed() noexcept { machineState->CloseFile(); macroJustStarted = false; - macroJustFinished = macroFileClosed = true; + macroFileClosed = true; +#if HAS_SBC_INTERFACE + if (IsBinary()) + { + // File position of the last code is no longer valid when we get here, reset it + binaryParser.SetFilePosition(IsFileChannel() && OriginalMachineState().DoingFile() ? printFilePositionAtMacroStart : noFilePosition); + } reprap.GetSbcInterface().EventOccurred(); +#endif } #endif @@ -1251,12 +1258,9 @@ FilePosition GCodeBuffer::GetPrintingFilePosition(bool allowNoFilePos) const noe } #if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES || HAS_SBC_INTERFACE - const FilePosition pos = (IsDoingFileMacro() -# if HAS_SBC_INTERFACE - || IsMacroFileClosed() || macroJustFinished // wait for the next code from the SBC to update the job file position -# endif - ) ? printFilePositionAtMacroStart // the position before we started executing the macro - : GetJobFilePosition(); // the actual position, allowing for bytes cached but not yet processed + const FilePosition pos = IsDoingFileMacro() + ? printFilePositionAtMacroStart // the position before we started executing the macro + : GetJobFilePosition(); // the actual position return (pos != noFilePosition || allowNoFilePos) ? pos : 0; #else return allowNoFilePos ? noFilePosition : 0; diff --git a/src/GCodes/GCodeBuffer/GCodeBuffer.h b/src/GCodes/GCodeBuffer/GCodeBuffer.h index beab6003d0..2edac5de99 100644 --- a/src/GCodes/GCodeBuffer/GCodeBuffer.h +++ b/src/GCodes/GCodeBuffer/GCodeBuffer.h @@ -372,9 +372,8 @@ class GCodeBuffer INHERIT_OBJECT_MODEL // Accessed only when the GB mutex is acquired String requestedMacroFile; bool isBinaryBuffer; - uint16_t + uint8_t macroJustStarted : 1, // Whether the GB has just started a macro file - macroJustFinished : 1, // Whether the GB has just finished a macro file macroFileError : 1, // Whether the macro file could be opened or if an error occurred macroFileEmpty : 1, // Whether the macro file is actually empty abortFile : 1, // Whether to abort the last file on the stack @@ -391,7 +390,7 @@ class GCodeBuffer INHERIT_OBJECT_MODEL inline bool GCodeBuffer::IsDoingFileMacro() const noexcept { #if HAS_SBC_INTERFACE - return machineState->doingFileMacro || IsMacroRequestPending(); + return machineState->doingFileMacro || IsMacroRequestPending() || macroFileClosed; #else return machineState->doingFileMacro; #endif diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index 8b4fca6811..33e147c9dc 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -987,7 +987,7 @@ bool GCodes::DoAsynchronousPause(GCodeBuffer& gb, PrintPausedReason reason, GCod // TODO: when using RTOS there is a possible race condition in the following, // because we might try to pause when a waiting move has just been added but before the gcode buffer has been re-initialised ready for the next command ms.GetPauseRestorePoint().filePos = fgb.GetPrintingFilePosition(true); - while (fgb.IsDoingFileMacro()) // must call this after GetFilePosition because this changes IsDoingFileMacro + while (fgb.LatestMachineState().doingFileMacro) // must call this after GetFilePosition because this changes IsDoingFileMacro { ms.pausedInMacro = true; fgb.PopState(false); From d56654b3defe4d702ec940407a6e2215b89f5f62 Mon Sep 17 00:00:00 2001 From: Christian Hammacher Date: Tue, 10 Sep 2024 11:31:59 +0200 Subject: [PATCH 8/8] Fixed query of global vars assigned to OM arrays --- src/ObjectModel/ObjectModel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ObjectModel/ObjectModel.cpp b/src/ObjectModel/ObjectModel.cpp index 5d2ae944da..064f3f4d48 100644 --- a/src/ObjectModel/ObjectModel.cpp +++ b/src/ObjectModel/ObjectModel.cpp @@ -838,7 +838,10 @@ void ObjectModel::ReportItemAsJsonFull(OutputBuffer *buf, ObjectExplorationConte { buf->cat('['); } + + context.AddIndex(index); ReportItemAsJson(buf, context, classDescriptor, element, endptr + 1); + context.RemoveIndex(); if (*filter == 0) { @@ -1130,7 +1133,10 @@ void ObjectModel::ReportHeapArrayAsJson(OutputBuffer *buf, ObjectExplorationCont } ExpressionValue element; ah.GetElement(i, element); + + context.AddIndex(i); ReportItemAsJson(buf, context, classDescriptor, element, filter); + context.RemoveIndex(); } if (isRootArray && context.GetNextElement() < 0) {