diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-09-06 12:27:43 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-09-06 12:27:43 +0300 |
commit | 214214ed84a9ff1f809e567b836b62cdc42d391f (patch) | |
tree | 033362ad5d8eb6527adb553363a19601947e03a8 /src/GCodes/GCodes2.cpp | |
parent | 11423af6eb4866b0596ac751f4402324299a7cc5 (diff) |
Changes to allow macros to be paused and restarted
Diffstat (limited to 'src/GCodes/GCodes2.cpp')
-rw-r--r-- | src/GCodes/GCodes2.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index 604951da..b4649035 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -1024,7 +1024,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx reply.copy("Cannot pause print, because no file is being printed!"); result = GCodeResult::error; } - else if (fileGCode->IsDoingFileMacro() && !gb.LatestMachineState().CanRestartMacro()) + else if (fileGCode->IsDoingFileMacro() && !fileGCode->LatestMachineState().CanRestartMacro()) { if (deferredPauseCommandPending == nullptr) // filament change pause takes priority { @@ -1380,7 +1380,18 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx } else if (gb.Seen('R')) { - gb.LatestMachineState().SetMacroRestartable(gb.GetUIValue() == 1); + const bool restartable = (gb.GetUIValue() == 1); + gb.LatestMachineState().SetMacroRestartable(restartable); + reprap.InputsUpdated(); + if (restartable) + { + CheckForDeferredPause(gb); + } + } + else + { + reply.copy("No P or R parameter"); + result = GCodeResult::error; } break; |