Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-06-04 20:06:53 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-06-04 20:06:53 +0300
commit18626db77266e1b5014736a4dce9317a5a7e8a63 (patch)
treea15902e460a0d278e4facb0185d2b7dc7e375e65
parentc2f540aa1a0d227d4839062784147cae56c9c1e1 (diff)
Bug fix: when a macro was aborted the error message was lost
-rw-r--r--src/GCodes/GCodeBuffer/GCodeBuffer.cpp2
-rw-r--r--src/GCodes/GCodeMachineState.cpp11
-rw-r--r--src/GCodes/GCodeMachineState.h1
-rw-r--r--src/GCodes/GCodes4.cpp7
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);