From 3a1810254aa84dc1a513e91e20c0204c9ddcc423 Mon Sep 17 00:00:00 2001 From: bdring Date: Sat, 4 Nov 2023 07:07:57 -0500 Subject: [PATCH] Cycle 0 and Macro Fixes - Homing cycle 0 was incorrectly running like -1 when run with $H - Eliminated a needless macro error when the macro was empty. --- FluidNC/src/Machine/Axis.cpp | 2 +- FluidNC/src/Machine/Macros.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/FluidNC/src/Machine/Axis.cpp b/FluidNC/src/Machine/Axis.cpp index 8c78cd6bb..1563d0aac 100644 --- a/FluidNC/src/Machine/Axis.cpp +++ b/FluidNC/src/Machine/Axis.cpp @@ -45,7 +45,7 @@ namespace Machine { m->init(); } } - if (_homing->_cycle) { + if (_homing && _homing->_cycle != Machine::Homing::set_mpos_only) { _homing->init(); set_bitnum(Axes::homingMask, _axis); } diff --git a/FluidNC/src/Machine/Macros.cpp b/FluidNC/src/Machine/Macros.cpp index 2f4e529b3..7858aaad9 100644 --- a/FluidNC/src/Machine/Macros.cpp +++ b/FluidNC/src/Machine/Macros.cpp @@ -50,15 +50,15 @@ Cmd findOverride(std::string name) { return it == overrideCodes.end() ? Cmd::None : it->second; } -bool Macro::run() { - if (sys.state != State::Idle) { - log_error("Macro can only be used in idle state"); +bool Macro::run() { // return true if the macro was run + const std::string& s = _gcode; + if (_gcode == "") { return false; } - const std::string& s = _gcode; - if (_gcode == "") { - return true; + if (sys.state != State::Idle) { + log_error("Macro can only be used in idle state"); + return false; } log_info("Running macro " << _name << ": " << _gcode);