Browse Source

Don't apply hotend_offset.z to Z soft endstops (#20675)

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

+ 5
- 0
Marlin/src/feature/solenoid.cpp View File

58
     #endif
58
     #endif
59
     default: SERIAL_ECHO_MSG(STR_INVALID_SOLENOID); break;
59
     default: SERIAL_ECHO_MSG(STR_INVALID_SOLENOID); break;
60
   }
60
   }
61
+
62
+  #if ENABLED(PARKING_EXTRUDER)
63
+    if (!active && active_extruder == num) // If active extruder's solenoid is disabled, carriage is considered parked
64
+      parking_extruder_set_parked(true);
65
+  #endif
61
 }
66
 }
62
 
67
 
63
 void enable_solenoid(const uint8_t num) { set_solenoid(num, true); }
68
 void enable_solenoid(const uint8_t num) { set_solenoid(num, true); }

+ 8
- 7
Marlin/src/module/motion.cpp View File

595
       // Software endstops are relative to the tool 0 workspace, so
595
       // Software endstops are relative to the tool 0 workspace, so
596
       // the movement limits must be shifted by the tool offset to
596
       // the movement limits must be shifted by the tool offset to
597
       // retain the same physical limit when other tools are selected.
597
       // retain the same physical limit when other tools are selected.
598
-      if (old_tool_index != new_tool_index) {
599
-        const float offs = hotend_offset[new_tool_index][axis] - hotend_offset[old_tool_index][axis];
600
-        soft_endstop.min[axis] += offs;
601
-        soft_endstop.max[axis] += offs;
602
-      }
603
-      else {
604
-        const float offs = hotend_offset[active_extruder][axis];
598
+
599
+      if (new_tool_index == old_tool_index || axis == Z_AXIS) { // The Z axis is "special" and shouldn't be modified
600
+        const float offs = (axis == Z_AXIS) ? 0 : hotend_offset[active_extruder][axis];
605
         soft_endstop.min[axis] = base_min_pos(axis) + offs;
601
         soft_endstop.min[axis] = base_min_pos(axis) + offs;
606
         soft_endstop.max[axis] = base_max_pos(axis) + offs;
602
         soft_endstop.max[axis] = base_max_pos(axis) + offs;
607
       }
603
       }
604
+      else {
605
+        const float diff = hotend_offset[new_tool_index][axis] - hotend_offset[old_tool_index][axis];
606
+        soft_endstop.min[axis] += diff;
607
+        soft_endstop.max[axis] += diff;
608
+      }
608
 
609
 
609
     #else
610
     #else
610
 
611
 

+ 1
- 3
Marlin/src/module/tool_change.cpp View File

292
     return true;
292
     return true;
293
   }
293
   }
294
 
294
 
295
-  void parking_extruder_set_parked() { extruder_parked = true; }
296
-
297
   inline void parking_extruder_tool_change(const uint8_t new_tool, bool no_move) {
295
   inline void parking_extruder_tool_change(const uint8_t new_tool, bool no_move) {
298
     if (!no_move) {
296
     if (!no_move) {
299
 
297
 
378
       planner.synchronize(); // Always sync the final move
376
       planner.synchronize(); // Always sync the final move
379
 
377
 
380
       DEBUG_POS("PE Tool-Change done.", current_position);
378
       DEBUG_POS("PE Tool-Change done.", current_position);
381
-      extruder_parked = false;
379
+      parking_extruder_set_parked(false);
382
     }
380
     }
383
     else if (do_solenoid_activation) { // && nomove == true
381
     else if (do_solenoid_activation) { // && nomove == true
384
       // Deactivate current extruder solenoid
382
       // Deactivate current extruder solenoid

+ 2
- 1
Marlin/src/module/tool_change.h View File

93
 
93
 
94
   void pe_solenoid_init();
94
   void pe_solenoid_init();
95
 
95
 
96
+  extern bool extruder_parked;
97
+  inline void parking_extruder_set_parked(const bool parked) { extruder_parked = parked; }
96
   bool parking_extruder_unpark_after_homing(const uint8_t final_tool, bool homed_towards_final_tool);
98
   bool parking_extruder_unpark_after_homing(const uint8_t final_tool, bool homed_towards_final_tool);
97
-  void parking_extruder_set_parked();
98
 
99
 
99
 #elif ENABLED(MAGNETIC_PARKING_EXTRUDER)
100
 #elif ENABLED(MAGNETIC_PARKING_EXTRUDER)
100
 
101
 

Loading…
Cancel
Save