Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M704 run custom g-code macro #263

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/GCodes/GCodes2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply)
}
break;


case 99: // Return from Macro/Subprogram
FileMacroCyclesReturn(gb);
break;
Expand Down Expand Up @@ -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<MaxFilenameLength> filename;
gb.GetPossiblyQuotedString(filename.GetRef());
String<ScratchStringLength> 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();
Expand Down