diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-10-22 23:35:16 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-10-22 23:35:16 +0300 |
commit | 8a9e12718b8161283dba0d54907e5586b560993b (patch) | |
tree | 552c1be769028da59b9007af67e9ee8b9f15f5ef /src/GCodes/GCodes.cpp | |
parent | 89e64be0cb6b8fb9f39a5fac0c47fc8d91ce137d (diff) |
Reduce acceleration when homing using stall detection
Diffstat (limited to 'src/GCodes/GCodes.cpp')
-rw-r--r-- | src/GCodes/GCodes.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index 8ba9a2c8..874088c3 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -1604,7 +1604,7 @@ bool GCodes::LockMovementAndWaitForStandstill(GCodeBuffer& gb) noexcept } // Save (some of) the state of the machine for recovery in the future. -bool GCodes::Push(GCodeBuffer& gb, bool withinSameFile) +bool GCodes::Push(GCodeBuffer& gb, bool withinSameFile) noexcept { const bool ok = gb.PushState(withinSameFile); if (!ok) @@ -1616,7 +1616,7 @@ bool GCodes::Push(GCodeBuffer& gb, bool withinSameFile) } // Recover a saved state -void GCodes::Pop(GCodeBuffer& gb) +void GCodes::Pop(GCodeBuffer& gb) noexcept { // FIXME If withinSameFile is false, we should pop all stack levels that have the same file (ID) // and output a warning message is the stack is popped more than once @@ -1631,7 +1631,7 @@ void GCodes::Pop(GCodeBuffer& gb) // 'moveBuffer.moveType' and 'moveBuffer.isCoordinated' must be set up before calling this // 'isPrintingMove' is true if there is any axis movement // Returns nullptr if this gcode is valid so far, or an error message if it should be discarded -const char * GCodes::LoadExtrusionAndFeedrateFromGCode(GCodeBuffer& gb, bool isPrintingMove) +const char * GCodes::LoadExtrusionAndFeedrateFromGCode(GCodeBuffer& gb, bool isPrintingMove) THROWS(GCodeException) { // Deal with feed rate, also determine whether M220 and M221 speed and extrusion factors apply to this move if (moveState.isCoordinated || machineType == MachineType::fff) @@ -1804,7 +1804,7 @@ bool GCodes::CheckEnoughAxesHomed(AxesBitmap axesMoved) noexcept // If we can't execute the move, return true with 'err' set to the error message // Else return true with 'err' left alone (it is set to nullptr on entry) // We have already acquired the movement lock and waited for the previous move to be taken. -bool GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated, const char *& err) +bool GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated, const char *& err) THROWS(GCodeException) { if (moveFractionToSkip > 0.0) { @@ -1997,10 +1997,14 @@ bool GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated, const char *& e // no break case 1: case 4: - if (!platform.GetEndstops().EnableAxisEndstops(axesMentioned & AxesBitmap::MakeLowestNBits(numTotalAxes), moveState.moveType == 1)) { - err = "Failed to enable endstops"; - return true; + bool reduceAcceleration; + if (!platform.GetEndstops().EnableAxisEndstops(axesMentioned & AxesBitmap::MakeLowestNBits(numTotalAxes), moveState.moveType == 1, reduceAcceleration)) + { + err = "Failed to enable endstops"; + return true; + } + moveState.reduceAcceleration = reduceAcceleration; } moveState.checkEndstops = true; break; |