Skip to content

Commit

Permalink
Add Z_AFTER_DEACTIVATE to account for gravity (MarlinFirmware#18906)
Browse files Browse the repository at this point in the history
  • Loading branch information
swissnorp authored Aug 4, 2020
1 parent 04c10ed commit 4856ac5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
6 changes: 3 additions & 3 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 15 additions & 9 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.

// 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 look ahead buffer is (by default) half full.
// 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)
Expand Down
13 changes: 3 additions & 10 deletions Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 7 additions & 1 deletion Marlin/src/module/stepper/indirection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4856ac5

Please sign in to comment.