Browse Source

Combine Z_AFTER_DEACTIVATE with UNKNOWN_Z_NO_RAISE (#20444)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
swissnorp 3 years ago
parent
commit
bcda46e3f3
No account linked to committer's email address

+ 7
- 2
Marlin/Configuration.h View File

@@ -569,7 +569,6 @@
569 569
  * the issues involved, don't use chamber PID until someone else verifies that your hardware works.
570 570
  */
571 571
 //#define PIDTEMPCHAMBER
572
-
573 572
 //#define CHAMBER_LIMIT_SWITCHING
574 573
 
575 574
 /**
@@ -1196,7 +1195,13 @@
1196 1195
 
1197 1196
 //#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed. Also enable HOME_AFTER_DEACTIVATE for extra safety.
1198 1197
 //#define HOME_AFTER_DEACTIVATE   // Require rehoming after steppers are deactivated. Also enable NO_MOTION_BEFORE_HOMING for extra safety.
1199
-//#define UNKNOWN_Z_NO_RAISE      // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off.
1198
+
1199
+/**
1200
+ * Set Z_IDLE_HEIGHT if the Z-Axis moves on its own when steppers are disabled.
1201
+ *  - Use a low value (i.e., Z_MIN_POS) if the nozzle falls down to the bed.
1202
+ *  - Use a large value (i.e., Z_MAX_POS) if the bed falls down, away from the nozzle.
1203
+ */
1204
+//#define Z_IDLE_HEIGHT Z_HOME_POS
1200 1205
 
1201 1206
 //#define Z_HOMING_HEIGHT  4      // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ...
1202 1207
                                   // Be sure to have this much clearance over your Z_MAX_POS to prevent grinding.

+ 0
- 3
Marlin/Configuration_adv.h View File

@@ -869,9 +869,6 @@
869 869
 #define DISABLE_INACTIVE_Z true  // Set 'false' if the nozzle could fall onto your printed part!
870 870
 #define DISABLE_INACTIVE_E true
871 871
 
872
-// If the Nozzle or Bed falls when the Z stepper is disabled, set its resting position here.
873
-//#define Z_AFTER_DEACTIVATE Z_HOME_POS
874
-
875 872
 // Default Minimum Feedrates for printing and travel moves
876 873
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // (mm/s) Minimum feedrate. Set with M205 S.
877 874
 #define DEFAULT_MINTRAVELFEEDRATE     0.0     // (mm/s) Minimum travel feedrate. Set with M205 T.

+ 2
- 4
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -326,14 +326,12 @@ void GcodeSuite::G28() {
326 326
 
327 327
     #endif
328 328
 
329
-    const float z_homing_height = TERN1(UNKNOWN_Z_NO_RAISE, axis_is_trusted(Z_AXIS))
330
-                                  ? (parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT)
331
-                                  : 0;
329
+    const float z_homing_height = parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT;
332 330
 
333 331
     if (z_homing_height && (doX || doY || TERN0(Z_SAFE_HOMING, doZ))) {
334 332
       // Raise Z before homing any other axes and z is not already high enough (never lower z)
335 333
       if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) by ", z_homing_height);
336
-      do_z_clearance(z_homing_height, axis_is_trusted(Z_AXIS), DISABLED(UNKNOWN_Z_NO_RAISE));
334
+      do_z_clearance(z_homing_height);
337 335
     }
338 336
 
339 337
     #if ENABLED(QUICK_HOME)

+ 4
- 0
Marlin/src/inc/SanityCheck.h View File

@@ -539,6 +539,10 @@
539 539
   #endif
540 540
 #elif defined(ASSISTED_TRAMMING_MENU_ITEM)
541 541
   #error "ASSISTED_TRAMMING_MENU_ITEM is deprecated and should be removed."
542
+#elif defined(UNKNOWN_Z_NO_RAISE)
543
+  #error "UNKNOWN_Z_NO_RAISE is replaced by setting Z_IDLE_HEIGHT to Z_MAX_POS."
544
+#elif defined(Z_AFTER_DEACTIVATE)
545
+  #error "Z_AFTER_DEACTIVATE is replaced by Z_IDLE_HEIGHT."
542 546
 #endif
543 547
 
544 548
 /**

+ 9
- 4
Marlin/src/module/motion.cpp View File

@@ -83,7 +83,13 @@ bool relative_mode; // = false;
83 83
  *   Used by 'line_to_current_position' to do a move after changing it.
84 84
  *   Used by 'sync_plan_position' to update 'planner.position'.
85 85
  */
86
-xyze_pos_t current_position = { X_HOME_POS, Y_HOME_POS, Z_HOME_POS };
86
+xyze_pos_t current_position = { X_HOME_POS, Y_HOME_POS,
87
+  #ifdef Z_IDLE_HEIGHT
88
+    Z_IDLE_HEIGHT
89
+  #else
90
+    Z_HOME_POS
91
+  #endif
92
+};
87 93
 
88 94
 /**
89 95
  * Cartesian Destination
@@ -494,9 +500,8 @@ void do_blocking_move_to_xy_z(const xy_pos_t &raw, const float &z, const feedRat
494 500
   do_blocking_move_to(raw.x, raw.y, z, fr_mm_s);
495 501
 }
496 502
 
497
-void do_z_clearance(const float &zclear, const bool z_trusted/*=true*/, const bool raise_on_untrusted/*=true*/, const bool lower_allowed/*=false*/) {
498
-  const bool rel = raise_on_untrusted && !z_trusted;
499
-  float zdest = zclear + (rel ? current_position.z : 0.0f);
503
+void do_z_clearance(const float &zclear, const bool lower_allowed/*=false*/) {
504
+  float zdest = zclear;
500 505
   if (!lower_allowed) NOLESS(zdest, current_position.z);
501 506
   do_blocking_move_to_z(_MIN(zdest, Z_MAX_POS), TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS)));
502 507
 }

+ 1
- 1
Marlin/src/module/motion.h View File

@@ -278,7 +278,7 @@ void remember_feedrate_and_scaling();
278 278
 void remember_feedrate_scaling_off();
279 279
 void restore_feedrate_and_scaling();
280 280
 
281
-void do_z_clearance(const float &zclear, const bool z_trusted=true, const bool raise_on_untrusted=true, const bool lower_allowed=false);
281
+void do_z_clearance(const float &zclear, const bool lower_allowed=false);
282 282
 
283 283
 /**
284 284
  * Homing and Trusted Axes

+ 1
- 8
Marlin/src/module/probe.cpp View File

@@ -401,14 +401,7 @@ bool Probe::set_deployed(const bool deploy) {
401 401
     constexpr bool z_raise_wanted = true;
402 402
   #endif
403 403
 
404
-  // For beds that fall when Z is powered off only raise for trusted Z
405
-  #if ENABLED(UNKNOWN_Z_NO_RAISE)
406
-    const bool z_is_trusted = axis_is_trusted(Z_AXIS);
407
-  #else
408
-    constexpr float z_is_trusted = true;
409
-  #endif
410
-
411
-  if (z_is_trusted && z_raise_wanted)
404
+  if (z_raise_wanted)
412 405
     do_z_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
413 406
 
414 407
   #if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)

+ 2
- 2
Marlin/src/module/probe.h View File

@@ -100,7 +100,7 @@ public:
100 100
 
101 101
     static void move_z_after_probing() {
102 102
       #ifdef Z_AFTER_PROBING
103
-        do_z_clearance(Z_AFTER_PROBING, true, true, true); // Move down still permitted
103
+        do_z_clearance(Z_AFTER_PROBING, true); // Move down still permitted
104 104
       #endif
105 105
     }
106 106
     static float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true, const bool sanity_check=true);
@@ -120,7 +120,7 @@ public:
120 120
 
121 121
   static void move_z_after_homing() {
122 122
     #ifdef Z_AFTER_HOMING
123
-      do_z_clearance(Z_AFTER_HOMING, true, true, true);
123
+      do_z_clearance(Z_AFTER_HOMING, true);
124 124
     #elif BOTH(Z_AFTER_PROBING, HAS_BED_PROBE)
125 125
       move_z_after_probing();
126 126
     #endif

+ 2
- 2
Marlin/src/module/stepper/indirection.h View File

@@ -862,8 +862,8 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
862 862
 #define  ENABLE_AXIS_Z() if (SHOULD_ENABLE(z))  {  ENABLE_STEPPER_Z();  ENABLE_STEPPER_Z2();  ENABLE_STEPPER_Z3();  ENABLE_STEPPER_Z4(); AFTER_CHANGE(z, true); }
863 863
 #define DISABLE_AXIS_Z() if (SHOULD_DISABLE(z)) { DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); AFTER_CHANGE(z, false); set_axis_untrusted(Z_AXIS); Z_RESET(); }
864 864
 
865
-#ifdef Z_AFTER_DEACTIVATE
866
-  #define Z_RESET() do{ current_position.z = Z_AFTER_DEACTIVATE; sync_plan_position(); }while(0)
865
+#ifdef Z_IDLE_HEIGHT
866
+  #define Z_RESET() do{ current_position.z = Z_IDLE_HEIGHT; sync_plan_position(); }while(0)
867 867
 #else
868 868
   #define Z_RESET()
869 869
 #endif

+ 1
- 1
buildroot/tests/STM32F103RC_btt-tests View File

@@ -17,7 +17,7 @@ opt_set X_DRIVER_TYPE TMC2209
17 17
 opt_set Y_DRIVER_TYPE TMC2209
18 18
 opt_set Z_DRIVER_TYPE TMC2209
19 19
 opt_set E0_DRIVER_TYPE TMC2209
20
-opt_enable PINS_DEBUGGING
20
+opt_enable PINS_DEBUGGING Z_IDLE_HEIGHT
21 21
 
22 22
 exec_test $1 $2 "BigTreeTech SKR Mini E3 1.0 - Basic Config with TMC2209 HW Serial" "$3"
23 23
 

Loading…
Cancel
Save