diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-08-03 13:45:02 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-08-03 13:45:02 +0300 |
commit | 405be3637c5cd3d590b8316cc26b46d0f60f4360 (patch) | |
tree | ea6121eef084284853fd545a6b0f97926bbdc7e2 /src/GCodes/GCodes2.cpp | |
parent | 25f69672fbeb63822943e9e54b5fd13d9a2176d1 (diff) |
Fixe pause followed by cancel in standalone mode; removed M0/1 H param
Diffstat (limited to 'src/GCodes/GCodes2.cpp')
-rw-r--r-- | src/GCodes/GCodes2.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index b5db8dd4..1296d74f 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -529,14 +529,18 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx if (!wasSimulating) // don't run any macro files or turn heaters off etc. if we were simulating before we stopped the print { // If we are cancelling a paused print with M0 and we are homed and cancel.g exists then run it and do nothing else - if (oldPauseState != PauseState::notPaused && code == 0 && AllAxesAreHomed() && DoFileMacro(gb, CANCEL_G, false, SystemHelperMacroCode)) + if (oldPauseState != PauseState::notPaused && code == 0 && AllAxesAreHomed()) { - pauseState = PauseState::cancelling; - break; + gb.SetState(GCodeState::cancelling); + if (DoFileMacro(gb, CANCEL_G, false, SystemHelperMacroCode)) + { + pauseState = PauseState::cancelling; + break; + } + // The state will be changed a few lines down, so no need to reset it to normal here } - const bool leaveHeatersOn = (gb.Seen('H') && gb.GetIValue() > 0); - gb.SetState((leaveHeatersOn) ? GCodeState::stoppingWithHeatersOn : GCodeState::stoppingWithHeatersOff); + gb.SetState(GCodeState::stoppingWithHeatersOff); (void)DoFileMacro(gb, (code == 0) ? STOP_G : SLEEP_G, false, SystemHelperMacroCode); } } |