diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index 347daccad1..64bbd9b41c 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -1203,6 +1203,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) } break; + case 99: // Return from Macro/Subprogram FileMacroCyclesReturn(gb); break; @@ -3867,6 +3868,28 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) } break; + case 704: // Run custom filament macro + if (gb.Seen('P')) + { + if (reprap.GetCurrentTool() != nullptr) + { + if (reprap.GetCurrentTool()->GetFilament() != nullptr) + { + String filename; + gb.GetPossiblyQuotedString(filename.GetRef()); + String scratchString; + scratchString.printf("%s%s/%s", FILAMENTS_DIRECTORY, reprap.GetCurrentTool()->GetFilament()->GetName(), filename.c_str()); + DoFileMacro(gb, scratchString.c_str(), true); + } + } + else + { + result = GCodeResult::error; + reply.copy("No tool selected"); + } + } + break; + #if SUPPORT_SCANNER case 750: // Enable 3D scanner extension reprap.GetScanner().Enable();