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-09-03 19:44:38 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-09-03 19:44:38 +0300
commit762a444079190a302077397cc817a5e38804b88c (patch)
tree8f178d871f76a91a9768f15ef3a84f3174f871a9 /src/GCodes/GCodes2.cpp
parent670d8f90065b3e2f66d342c12fb20c37e2fa56d2 (diff)
Added support for pausing macros and restarting them
Diffstat (limited to 'src/GCodes/GCodes2.cpp')
-rw-r--r--src/GCodes/GCodes2.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp
index 771908a1..604951da 100644
--- a/src/GCodes/GCodes2.cpp
+++ b/src/GCodes/GCodes2.cpp
@@ -973,7 +973,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
case 601:
if (pauseState == PauseState::notPaused)
{
- if (gb.IsDoingFileMacro())
+ if (gb.IsDoingFileMacro() && !gb.LatestMachineState().CanRestartMacro())
{
if (deferredPauseCommandPending == nullptr) // filament change pause takes priority
{
@@ -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())
+ else if (fileGCode->IsDoingFileMacro() && !gb.LatestMachineState().CanRestartMacro())
{
if (deferredPauseCommandPending == nullptr) // filament change pause takes priority
{
@@ -1070,7 +1070,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
// In case there are short periods of time when PrintMonitor says a file is printing but the file is not open, or DSF passes M27 to us, check that we have a file
if (fileBeingPrinted.IsLive())
{
- reply.printf("SD printing byte %lu/%lu", GetFilePosition(), fileBeingPrinted.Length());
+ reply.printf("SD printing byte %lu/%lu", GetPrintingFilePosition(), fileBeingPrinted.Length());
break;
}
}
@@ -1372,12 +1372,16 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
break;
case 98: // Call Macro/Subprogram
+ if (gb.Seen('P'))
{
- gb.MustSee('P');
String<MaxFilenameLength> filename;
gb.GetPossiblyQuotedString(filename.GetRef());
DoFileMacro(gb, filename.c_str(), true, code);
}
+ else if (gb.Seen('R'))
+ {
+ gb.LatestMachineState().SetMacroRestartable(gb.GetUIValue() == 1);
+ }
break;
case 99: // Return from Macro/Subprogram