Browse Source

Implement soft_endstops_enabled for clamping

Scott Lahteine 8 years ago
parent
commit
d01b915085
2 changed files with 15 additions and 3 deletions
  1. 1
    0
      Marlin/Marlin_main.cpp
  2. 14
    3
      Marlin/ultralcd.cpp

+ 1
- 0
Marlin/Marlin_main.cpp View File

@@ -8982,6 +8982,7 @@ void ok_to_send() {
8982 8982
    * Constrain the given coordinates to the software endstops.
8983 8983
    */
8984 8984
   void clamp_to_software_endstops(float target[XYZ]) {
8985
+    if (!soft_endstops_enabled) return;
8985 8986
     #if ENABLED(min_software_endstops)
8986 8987
       NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]);
8987 8988
       NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]);

+ 14
- 3
Marlin/ultralcd.cpp View File

@@ -1596,9 +1596,20 @@ KeepDrawing:
1596 1596
     if (encoderPosition) {
1597 1597
       refresh_cmd_timeout();
1598 1598
 
1599
-      // Limit to software endstops, if enabled
1600
-      float min = (soft_endstops_enabled && min_software_endstops) ? soft_endstop_min[axis] : current_position[axis] - 1000,
1601
-            max = (soft_endstops_enabled && max_software_endstops) ? soft_endstop_max[axis] : current_position[axis] + 1000;
1599
+      float min = current_position[axis] - 1000,
1600
+            max = current_position[axis] + 1000;
1601
+
1602
+      #if HAS_SOFTWARE_ENDSTOPS
1603
+        // Limit to software endstops, if enabled
1604
+        if (soft_endstops_enabled) {
1605
+          #if ENABLED(min_software_endstops)
1606
+            min = soft_endstop_min[axis];
1607
+          #endif
1608
+          #if ENABLED(max_software_endstops)
1609
+            max = soft_endstop_max[axis];
1610
+          #endif
1611
+        }
1612
+      #endif
1602 1613
 
1603 1614
       // Get the new position
1604 1615
       current_position[axis] += float((int32_t)encoderPosition) * move_menu_scale;

Loading…
Cancel
Save