From 90e701a8f7ef911138849b9daf65d20612396de0 Mon Sep 17 00:00:00 2001 From: David Crocker Date: Sat, 5 Nov 2022 11:20:21 +0000 Subject: Fixed tool change issue --- src/GCodes/GCodeException.cpp | 2 +- src/GCodes/GCodes.cpp | 6 +++--- src/GCodes/GCodes4.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GCodes/GCodeException.cpp b/src/GCodes/GCodeException.cpp index 9789ac52..7a3d7c56 100644 --- a/src/GCodes/GCodeException.cpp +++ b/src/GCodes/GCodeException.cpp @@ -62,7 +62,7 @@ void GCodeException::GetMessage(const StringRef &reply, const GCodeBuffer *null { reply.catf(message, stringParam.c_str()); } - else if (strstr(message, "%u")) + else if (strstr(message, "%u") || strstr(message, "%c")) { reply.catf(message, param.u); } diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index ccfd4ac2..90812def 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -4963,10 +4963,10 @@ const MovementState& GCodes::GetCurrentMovementState(const ObjectExplorationCont // This relies on cooperative scheduling between different GCodeBuffer objects void GCodes::AllocateAxes(const GCodeBuffer& gb, MovementState& ms, AxesBitmap axes, ParameterLettersBitmap axLetters) THROWS(GCodeException) { - if (!ms.AllocateAxes(axes, axLetters).IsEmpty()) + const AxesBitmap badAxes = ms.AllocateAxes(axes, axLetters); + if (!badAxes.IsEmpty()) { - //TODO report the lowest axis letter that is already allocated - gb.ThrowGCodeException("Axis is already used by a different motion system"); + gb.ThrowGCodeException("Axis %c is already used by a different motion system", (unsigned int)axisLetters[badAxes.LowestSetBit()]); } UpdateUserPositionFromMachinePosition(gb, ms); } diff --git a/src/GCodes/GCodes4.cpp b/src/GCodes/GCodes4.cpp index 1c69eff4..401f6333 100644 --- a/src/GCodes/GCodes4.cpp +++ b/src/GCodes/GCodes4.cpp @@ -367,6 +367,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) noexcept #if SUPPORT_ASYNC_MOVES && PREALLOCATE_TOOL_AXES // Whenever we release axes, we must update lastKnownMachinePositions for those axes first so that whoever allocated them next gets the correct positions ms.SaveOwnAxisCoordinates(); + gb.AdvanceState(); ReadLockedPointer newTool = Tool::GetLockedTool(ms.newToolNumber); if (newTool.IsNull()) @@ -406,7 +407,6 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) noexcept DoFileMacro(gb, scratchString.c_str(), false, ToolChangeMacroCode); } } - gb.AdvanceState(); } break; -- cgit v1.2.3