From 301569bee6ffe77b23154ad4d155972c37993ee3 Mon Sep 17 00:00:00 2001 From: swissnorp <67485708+swissnorp@users.noreply.github.com> Date: Tue, 4 Aug 2020 07:31:45 +0200 Subject: [PATCH] Add Z_AFTER_DEACTIVATE to account for gravity (#18906) --- Marlin/Configuration.h | 6 ++--- Marlin/Configuration_adv.h | 24 ++++++++++++------- .../lcd/dogm/status_screen_lite_ST7920.cpp | 13 +++------- Marlin/src/module/planner.cpp | 7 ++++-- Marlin/src/module/stepper/indirection.h | 8 ++++++- 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9d1f7862bb..25efa79b7d 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1076,18 +1076,18 @@ #define Z_ENABLE_ON 0 #define E_ENABLE_ON 0 // For all extruders -// Disables axis stepper immediately when it's not being used. +// Disable axis steppers immediately when they're not being stepped. // WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false -// Warn on display about possibly reduced accuracy +// Turn off the display blinking that warns about possible accuracy reduction //#define DISABLE_REDUCED_ACCURACY_WARNING // @section extruder -#define DISABLE_E false // For all extruders +#define DISABLE_E false // Disable the extruder when not stepping #define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 3fae47384d..de50995ffe 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -809,24 +809,30 @@ #define INVERT_Z_STEP_PIN false #define INVERT_E_STEP_PIN false -// Default stepper release if idle. Set to 0 to deactivate. -// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true. -// Time can be set by M18 and M84. +/** + * Idle Stepper Shutdown + * Set DISABLE_INACTIVE_? 'true' to shut down axis steppers after an idle period. + * The Deactive Time can be overridden with M18 and M84. Set to 0 for No Timeout. + */ #define DEFAULT_STEPPER_DEACTIVE_TIME 120 #define DISABLE_INACTIVE_X true #define DISABLE_INACTIVE_Y true -#define DISABLE_INACTIVE_Z true // Set to false if the nozzle will fall down on your printed part when print has finished. +#define DISABLE_INACTIVE_Z true // Set 'false' if the nozzle could fall onto your printed part! #define DISABLE_INACTIVE_E true -#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate -#define DEFAULT_MINTRAVELFEEDRATE 0.0 +// If the Nozzle or Bed falls when the Z stepper is disabled, set its resting position here. +//#define Z_AFTER_DEACTIVATE Z_HOME_POS //#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated -// Minimum time that a segment needs to take if the buffer is emptied -#define DEFAULT_MINSEGMENTTIME 20000 // (µs) +// Minimum time that a segment needs to take as the buffer gets emptied +#define DEFAULT_MINSEGMENTTIME 20000 // (µs) Set with M205 B. -// Slow down the machine if the look ahead buffer is (by default) half full. +// Default Minimum Feedrates for printing and travel moves +#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s) Minimum feedrate. Set with M205 S. +#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s) Minimum travel feedrate. Set with M205 T. + +// Slow down the machine if the lookahead buffer is (by default) half full. // Increase the slowdown divisor for larger buffer sizes. #define SLOWDOWN #if ENABLED(SLOWDOWN) diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index 9338ab82e8..18894db3d6 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -819,16 +819,9 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { } if (countdown == 0 && (forceUpdate || position_changed() - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - || blink_changed() - #endif - )) { - draw_position(current_position, true - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - && all_axes_known() - #endif - ); - } + || TERN(DISABLE_REDUCED_ACCURACY_WARNING, 0, blink_changed()) + )) + draw_position(current_position, TERN(DISABLE_REDUCED_ACCURACY_WARNING, 0, all_axes_known())); #endif } diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 65a9e4e059..c2a9e6ac77 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1281,7 +1281,7 @@ void Planner::recalculate() { void Planner::check_axes_activity() { #if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z, DISABLE_E) - xyze_bool_t axis_active = { false }; + xyze_bool_t axis_active = { true, true, true, true }; #endif #if HAS_FAN @@ -1316,7 +1316,10 @@ void Planner::check_axes_activity() { #if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z, DISABLE_E) for (uint8_t b = block_buffer_tail; b != block_buffer_head; b = next_block_index(b)) { block_t *block = &block_buffer[b]; - LOOP_XYZE(i) if (block->steps[i]) axis_active[i] = true; + if (ENABLED(DISABLE_X) && block->steps[X_AXIS]) axis_active[X_AXIS] = true; + if (ENABLED(DISABLE_Y) && block->steps[Y_AXIS]) axis_active[Y_AXIS] = true; + if (ENABLED(DISABLE_Z) && block->steps[Z_AXIS]) axis_active[Z_AXIS] = true; + if (ENABLED(DISABLE_E) && block->steps[E_AXIS]) axis_active[E_AXIS] = true; } #endif } diff --git a/Marlin/src/module/stepper/indirection.h b/Marlin/src/module/stepper/indirection.h index e3d3730c79..1fd1a72e7e 100644 --- a/Marlin/src/module/stepper/indirection.h +++ b/Marlin/src/module/stepper/indirection.h @@ -848,7 +848,13 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define DISABLE_AXIS_Y() do{ DISABLE_STEPPER_Y(); DISABLE_STEPPER_Y2(); CBI(axis_known_position, Y_AXIS); }while(0) #define ENABLE_AXIS_Z() do{ ENABLE_STEPPER_Z(); ENABLE_STEPPER_Z2(); ENABLE_STEPPER_Z3(); ENABLE_STEPPER_Z4(); }while(0) -#define DISABLE_AXIS_Z() do{ DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); CBI(axis_known_position, Z_AXIS); }while(0) + +#ifdef Z_AFTER_DEACTIVATE + #define Z_RESET() do{ current_position.z = Z_AFTER_DEACTIVATE; planner.sync_plan_position(); }while(0) +#else + #define Z_RESET() +#endif +#define DISABLE_AXIS_Z() do{ DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); CBI(axis_known_position, Z_AXIS); Z_RESET(); }while(0) // // Extruder steppers enable / disable macros