diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-08-27 15:51:03 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-08-27 15:51:03 +0300 |
commit | 37597f0328267402d609f6e3d59c75f4794179d3 (patch) | |
tree | 48087088b6efce60013072597ba5b1705cd11bb1 /src/GCodes/GCodes2.cpp | |
parent | 396115b3269354bffb67b1652cf04820c642f340 (diff) |
Don't allow babystepping if axes haven't been homed
Diffstat (limited to 'src/GCodes/GCodes2.cpp')
-rw-r--r-- | src/GCodes/GCodes2.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index 9e3553be..64ad594c 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -2404,13 +2404,18 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx case 290: // Baby stepping { const bool absolute = (gb.Seen('R') && gb.GetIValue() == 0); - bool seen = false; float differences[MaxAxes]; + AxesBitmap axesMentioned; for (size_t axis = 0; axis < numVisibleAxes; ++axis) { if (gb.Seen(axisLetters[axis]) || (axis == 2 && gb.Seen('S'))) // S is a synonym for Z { - seen = true; + if (!LockMovement(gb)) + { + return false; + } + + axesMentioned.SetBit(axis); const float fval = gb.GetFValue(); if (absolute) { @@ -2427,11 +2432,13 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx } } - if (seen) + if (axesMentioned.IsNonEmpty()) { - if (!LockMovement(gb)) + if (CheckEnoughAxesHomed(axesMentioned)) { - return false; + reply.copy("insufficient axes homed"); + result = GCodeResult::error; + break; } // Perform babystepping synchronously with moves |