diff options
-rw-r--r-- | src/GCodes/GCodeBuffer/GCodeBuffer.cpp | 2 | ||||
-rw-r--r-- | src/GCodes/GCodeMachineState.cpp | 11 | ||||
-rw-r--r-- | src/GCodes/GCodeMachineState.h | 1 | ||||
-rw-r--r-- | src/GCodes/GCodes4.cpp | 7 |
4 files changed, 17 insertions, 4 deletions
diff --git a/src/GCodes/GCodeBuffer/GCodeBuffer.cpp b/src/GCodes/GCodeBuffer/GCodeBuffer.cpp index fea25c00..e3dc4862 100644 --- a/src/GCodes/GCodeBuffer/GCodeBuffer.cpp +++ b/src/GCodes/GCodeBuffer/GCodeBuffer.cpp @@ -771,7 +771,7 @@ bool GCodeBuffer::PopState(bool withinSameFile) noexcept return false; } - machineState = ms->GetPrevious(); + machineState = ms->Pop(); // get the previous state and copy down any error message delete ms; return true; diff --git a/src/GCodes/GCodeMachineState.cpp b/src/GCodes/GCodeMachineState.cpp index b3fc004a..1af502d1 100644 --- a/src/GCodes/GCodeMachineState.cpp +++ b/src/GCodes/GCodeMachineState.cpp @@ -189,6 +189,17 @@ void GCodeMachineState::RetrieveStateMachineResult(GCodeResult& rslt, const Stri } } +GCodeMachineState *GCodeMachineState::Pop() const noexcept +{ + GCodeMachineState * const rslt = GetPrevious(); + if (errorMessage != nullptr) + { + rslt->errorMessage = errorMessage; + rslt->stateMachineResult = stateMachineResult; + } + return rslt; +} + void GCodeMachineState::SetState(GCodeState newState) noexcept { if (state == GCodeState::normal && newState != GCodeState::normal) diff --git a/src/GCodes/GCodeMachineState.h b/src/GCodes/GCodeMachineState.h index b6f47e6c..31fafdbe 100644 --- a/src/GCodes/GCodeMachineState.h +++ b/src/GCodes/GCodeMachineState.h @@ -191,6 +191,7 @@ public: inline void AdvanceState() noexcept { state = static_cast<GCodeState>(static_cast<uint8_t>(state) + 1); } GCodeMachineState *GetPrevious() const noexcept { return previous; } + GCodeMachineState *Pop() const noexcept; uint8_t GetBlockNesting() const noexcept { return blockNesting; } VariableSet variables; // local variables and parameters diff --git a/src/GCodes/GCodes4.cpp b/src/GCodes/GCodes4.cpp index 244a3a7d..8dcaf4de 100644 --- a/src/GCodes/GCodes4.cpp +++ b/src/GCodes/GCodes4.cpp @@ -262,14 +262,15 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) noexcept else { String<StringLength20> nextHomingFileName; - AxesBitmap mustHomeFirst = reprap.GetMove().GetKinematics().GetHomingFileName(toBeHomed, axesHomed, numVisibleAxes, nextHomingFileName.GetRef()); + const AxesBitmap mustHomeFirst = reprap.GetMove().GetKinematics().GetHomingFileName(toBeHomed, axesHomed, numVisibleAxes, nextHomingFileName.GetRef()); if (mustHomeFirst.IsNonEmpty()) { // Error, can't home this axes - reply.copy("Must home these axes:"); + reply.copy("Must home axes ["); AppendAxes(reply, mustHomeFirst); - reply.cat(" before homing these:"); + reply.cat("] before homing ["); AppendAxes(reply, toBeHomed); + reply.cat(']'); stateMachineResult = GCodeResult::error; toBeHomed.Clear(); gb.SetState(GCodeState::normal); |