diff options
Diffstat (limited to 'src/GCodes/GCodes4.cpp')
-rw-r--r-- | src/GCodes/GCodes4.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/GCodes/GCodes4.cpp b/src/GCodes/GCodes4.cpp index f2ccb6b5..961728f9 100644 --- a/src/GCodes/GCodes4.cpp +++ b/src/GCodes/GCodes4.cpp @@ -3,6 +3,7 @@ #include "GCodes.h" #include "GCodeBuffer/GCodeBuffer.h" #include <Platform/RepRap.h> +#include <Platform/Event.h> #include <Movement/Move.h> #include <Tools/Tool.h> #include <Heating/Heat.h> @@ -1482,6 +1483,40 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) noexcept gb.SetState(GCodeState::normal); break; + // Here when we need to execute the default action for an event because the macro file was not found. We have already sent a message and logged the event. + case GCodeState::processingEvent: + { + const Event::DefaultAction action = Event::GetDefaultAction(); + if (action == Event::DefaultAction::none) + { + // Nothing more to do + gb.SetState(GCodeState::finishedProcessingEvent); + } + else + { + // We are going to pause + if (pauseState != PauseState::resuming) // if we are resuming, wait for the resume to complete + { + if (pauseState != PauseState::notPaused) + { + gb.SetState(GCodeState::finishedProcessingEvent); // already paused + } + else if (LockMovementAndWaitForStandstill(gb)) + { + gb.SetState(GCodeState::finishedProcessingEvent); + DoPause(gb, qq); + } + } + } + } + break; + + // Here when we have finished processing an event + case GCodeState::finishedProcessingEvent: + Event::FinishedProcessing(); + gb.SetState(GCodeState::normal); + break; + default: // should not happen gb.LatestMachineState().SetError("Undefined GCodeState"); gb.SetState(GCodeState::normal); |