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
path: root/src
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-07-26 10:27:53 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-07-26 10:27:53 +0300
commit6892c9713ccb2cb7f66635920fb441d51fb88fb8 (patch)
tree90e3874f3a720ff0e4353b052a04eb6734061cba /src
parent50693602898130cbcb46da51cc195c8269c239b4 (diff)
Fixes issues with workplace coords being used in homing & tool changing
Diffstat (limited to 'src')
-rw-r--r--src/GCodes/GCodes.cpp30
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();