diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-07-26 10:27:53 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-07-26 10:27:53 +0300 |
commit | 6892c9713ccb2cb7f66635920fb441d51fb88fb8 (patch) | |
tree | 90e3874f3a720ff0e4353b052a04eb6734061cba /src | |
parent | 50693602898130cbcb46da51cc195c8269c239b4 (diff) |
Fixes issues with workplace coords being used in homing & tool changing
Diffstat (limited to 'src')
-rw-r--r-- | src/GCodes/GCodes.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index 5e7c5703..5659a8fa 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -2816,10 +2816,32 @@ bool GCodes::DoFileMacro(GCodeBuffer& gb, const char* fileName, bool reportMissi #if HAS_LINUX_INTERFACE || HAS_MASS_STORAGE gb.LatestMachineState().doingFileMacro = true; - gb.LatestMachineState().runningM501 = (codeRunning == 501); - gb.LatestMachineState().runningM502 = (codeRunning == 502); - gb.LatestMachineState().runningSystemMacro = (codeRunning == SystemHelperMacroCode || codeRunning == AsyncSystemMacroCode || codeRunning == 29 || codeRunning == 32); - // running a system macro e.g. homing, so don't use workplace coordinates + + // The following three flags need to be inherited in the case that a system macro calls another macro, e.g.homeall.g calls homez.g. The Push call copied them over already. + switch (codeRunning) + { + case 501: + gb.LatestMachineState().runningM501 = true; + gb.LatestMachineState().runningSystemMacro = true; // running a system macro e.g. homing, so don't use workplace coordinates + break; + + case 502: + gb.LatestMachineState().runningM502 = true; + gb.LatestMachineState().runningSystemMacro = true; // running a system macro e.g. homing, so don't use workplace coordinates + break; + + case SystemHelperMacroCode: + case AsyncSystemMacroCode: + case ToolChangeMacroCode: + case 29: + case 32: + gb.LatestMachineState().runningSystemMacro = true; // running a system macro e.g. homing, so don't use workplace coordinates + break; + + default: + break; + } + gb.SetState(GCodeState::normal); gb.Init(); |